Explorar el Código

added timings function

Mark VandenBrink hace 12 años
padre
commit
db79584923
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      utils.lisp

+ 5 - 0
utils.lisp

@@ -109,3 +109,8 @@ The above will expand to (ash (logand #xFFFBB240 #xFFE00000) -21) at COMPILE tim
 (defmacro memoize (func-name)
   "Memoize function associated with Function-Name. Simplified version"
   `(setf (symbol-function ,func-name) (utils::mk-memoize ,func-name)))
+
+(defun timings (function)
+  (let ((real-base (get-internal-real-time)))
+    (funcall function)
+    (float (/ (- (get-internal-real-time) real-base) internal-time-units-per-second))))