stopwatch

A Clojure/script stopwatch

Downloads
21.5K
Stars
5
Committers
2

stopwatch

A Clojure/script stopwatch implementation.

Uses System/nanoTime on the JVM.

Uses the most precise mechanism depending on the Javascript runtime:

Usage

Add the following dependency to your project.clj or build.boot:

[dm3/stopwatch "0.1.1"]

then require the namespace:

(require '[stopwatch.core :as stopwatch])

Using synchronously:

(let [elapsed (stopwatch/start)]
  (do-work)
  (println "Elapsed: " (elapsed) "ns"))

and asynchronously, using core.async:

(let [elapsed (stopwatch/start)]
  (go
    (<! (do-work))
    (println "Elapsed: " (elapsed) "ns")))

License

Copyright © 2017 Vadim Platonov

Distributed under the MIT License.