1.2.0 permalink Arrow_down_16x16

DocString

Simple code profiling & timing measurement.

Wrap any section of code in the prof macro, giving it a name, like this:

(defn my-function [x y]
(let [sum (prof :addition (+ x y))
product (prof :multiplication (* x y))]
[sum product]))

The run your code in the profile macro, like this:

(profile (dotimes [i 10000] (my-function 3 4)))

Which prints a report for each named section of code:

Name mean min max count sum
addition 265 0 37000 10000 2655000
multiplication 274 0 53000 10000 2747000

Times are measured in nanoseconds, to the maximum precision available
under the JVM. See the function documentation for more details.

Vars in clojure.contrib.profile