Documentation | Latest releases | Get support
Tufte allows you to easily monitor the ongoing performance of your Clojure and ClojureScript applications in production and other environments.
It provides sensible application-level metrics, and gives them to you as Clojure data that can be easily analyzed programatically.
Carte Figurative, one of Edward Tufte's favourite data visualizations.
2023-09-27
2.6.3
: changesSee here for earlier releases.
p
, profiled
, profile
(require '[taoensso.tufte :as tufte :refer [defnp p profiled profile]])
;; Request to send `profile` stats to `println`:
(tufte/add-basic-println-handler! {})
;;; Define a couple dummy fns to simulate doing some expensive work
(defn get-x [] (Thread/sleep 500) "x val")
(defn get-y [] (Thread/sleep (rand-int 1000)) "y val")
;; Let's check how these fns perform:
(profile ; Profile any `p` forms called during body execution
{} ; Profiling options; we'll use the defaults for now
(dotimes [_ 5]
(p :get-x (get-x))
(p :get-y (get-y))))
;; The following will be printed to *out*:
;;
;; pId nCalls Min 50% ≤ 90% ≤ 95% ≤ 99% ≤ Max Mean MAD Clock Total
;; :get-x 5 501ms 503ms 505ms 505ms 505ms 505ms 503ms ±0% 2.52s 53%
;; :get-y 5 78ms 396ms 815ms 815ms 815ms 815ms 452ms ±48% 2.25s 47%
;;
;; Accounted 4.78s 100%
;; Clock 4.78s 100%
You can help support continued work on this project, thank you!! 🙏
Copyright © 2016-2023 Peter Taoussanis.
Licensed under EPL 1.0 (same as Clojure).
Can you improve this documentation? These fine people already did:
Peter Taoussanis, r6eve & Ivar RefsdalEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close