Skip to content
/ tufte Public

Simple performance monitoring library for Clojure/Script

License

Notifications You must be signed in to change notification settings

taoensso/tufte

Repository files navigation

Taoensso open source
Documentation|Latest releases|Get support

Tufte

Simple performance monitoring library for Clojure/Script

Tufteallows you toeasily monitor the ongoing performanceof your Clojure and ClojureScript applications in production and other environments.

It providessensible application-level metrics,and gives them to you asClojure datathat can be easily analyzed programatically.

Carte Figurative

Carte Figurative,one ofEdward Tufte's favourite data visualizations.

Latest release/s

Main tests Graal tests

Seeherefor earlier releases.

Why Tufte?

  • Small,fast,cross-platform Clojure/Script codebase
  • Sensibleapplication-level metricswithout the obscure JVM-level noise
  • Metrics as Clojure maps:easily aggregate,analyse,log, serialize to db, etc.
  • Tiny,flexible API:p,profiled,profile
  • Greatcompile-time elisionandruntime filteringsupport
  • Arbitrary Clojure/Scriptform-levelprofiling
  • Full support forthread-localandmulti-threadedprofiling

10-second example

(require'[taoensso.tufte:astufte:refer[defnpp 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
(defnget-x[] (Thread/sleep500)"x val")
(defnget-y[] (Thread/sleep(rand-int1000))"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%

Documentation

Funding

You canhelp supportcontinued work on this project, thank you!! 🙏

License

Copyright © 2016-2024Peter Taoussanis.
Licensed underEPL 1.0(same as Clojure).