Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Like time, but more of it
Clojure
branch: master
Failed to load latest commit information.
doc Initial commit
src/extra_time Simple tests
test/extra_time/test Simple tests
.gitignore Simple tests
.travis.yml Added .travis.yml
LICENSE Clarified licence
README.md Long overdue bumping of the Clojure version.
project.clj Fix project.clj

README.md

Build Status

extra-time

A Clojure library designed to capture execution time in a more granular way than clojure.core's time, but less so than a proper profiling tool.

Usage

Obtainable from Clojars:

Clojars Project

To capture timing information for a block, wrap with with-times. This returns a tuple containing first the timing information, as a map, secondly the result of the block:

(let [[timings result] (with-times (do-stuff 1 2))]
  (println "Total time: " (:total timings))
  (do-something result))

To capture timing information, and print out a summary, wrap with report-times:

(report-times (do-stuff 1 2))

To capture more granular timings, in addition to the total time, use cap-time:

(report-times
  (doseq [x (range 1000)]
    (cap-time :inner (reduce + (range x)))))

This prints a summary that looks a bit like:

:inner  =>  {:count 1000, :average 0.07283200000000019, :sum 72.83200000000019}
:total  =>  (86.418)

The same block with with-times returns a Map that contains all the interim values, rather than the summary.

Something went wrong with that request. Please try again.