[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

simple speed check macro

From: Paul Pogonyshev
Subject: simple speed check macro
Date: Wed, 29 Sep 2004 00:09:37 -0200
User-agent: KMail/1.4.3

Not sure if Emacs has something similar already, at least I
couldn't find it.

(defmacro measure-time-spent (&rest body)
  (declare (indent 0) (debug t))
  `(let ((start-time  (prog1 (current-time)
         (finish-time (current-time)))
     (+ (* (- (nth 2 finish-time) (nth 2 start-time)) 1e-6)
           (- (nth 1 finish-time) (nth 1 start-time))
        (* (- (nth 0 finish-time) (nth 0 start-time)) #x10000))))

It can be used for quick speed checks like this:

        M-: (measure-time-spent (foo) (bar))

Does this look useful enough for a patch?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]