API for profile - clojure-contrib v1.2 (stable)

by Stuart Sierra

clojure-contrib is now deprecated

clojure-contrib is no longer being developed or maintained.

Rather than a single, monolithic, contributions library, Clojure now has a set of separate libraries for each unit of functionality. The libraries are in the Clojure GitHub organization at https://github.com/clojure. API documentation of the libraries can be found at http://clojure.github.io.

If you're looking for a specific function or namespace from the old clojure-contrib, see "Where Did Clojure.Contrib Go".


Full namespace name: clojure.contrib.profile

Overview

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.

Public Variables and Functions



*enable-profiling*

var
This library, clojure-contrib, is deprecated. See here for more information.

  
Set this to false before loading/compiling to omit
profiling code.
Source


print-summary

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (print-summary profile-summary)
Prints a table of the results returned by summarize.
Source


prof

macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (prof name & body)
If *enable-profiling* is true, wraps body in profiling code.
Returns the result of body. Profile timings will be stored in
*profile-data* using name, which must be a keyword, as the key.
Timings are measured with System/nanoTime.
Source


profile

macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (profile & body)
Runs body with profiling enabled, then prints a summary of
results.  Returns nil.
Source


summarize

function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (summarize profile-data)
Takes the raw data returned by with-profile-data and returns a map
from names to summary statistics.  Each value in the map will look
like:

   {:mean ..., :min ..., :max ..., :count ..., :sum ...}

:mean, :min, and :max are how long the profiled section took to run,
in nanoseconds.  :count is the total number of times the profiled
section was executed.  :sum is the total amount of time spent in the
profiled section, in nanoseconds.
Source


with-profile-data

macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (with-profile-data & body)
Executes body with *profile-data* bound to an atom of a new map.
Returns the raw profile data as a map.  Keys in the map are profile
names (keywords), and values are lists of elapsed time, in
nanoseconds.
Source
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.