A simple, fast, monitoring profiler for Clojure/Script.
Usage: wrap+name interesting body exprs with the p
macro. Then activate
profiling of these wrapped exprs using the profiled
or profile
macros:
(profiled {} (p :my-fn (my-fn))) ; Returns [<body-result> <?pstats>] (profile {} (p :my-fn (my-fn))) ; Returns <body-result>, dispatches ; ?pstats to any registered handlers.
Extensive facilities are provided for compile-time elision and runtime filtering.
See the relevant docstrings for more info:
p
, profiled
, profile
, add-handler!
; Core API
(p [opts & body] [id & body]) ; e.g. (p ::my-pid (do-work))
(profiled [opts & body]) ; e.g. (profiled {:level 2} (my-fn))
(profile [opts & body]) ; e.g. (profiled {:level 2} (my-fn))
(add-handler! [handler-id ns-pattern handler-fn])
How/where to use this library: Tufte profiling is highly optimized: even without elision, you can usually leave profiling enabled in production (e.g. for sampled profiling, or to detect unusual performance behaviour). Tufte's stats maps are well suited to programmatic monitoring.
Abbreviations, etc.
p
profile
A simple, fast, monitoring profiler for Clojure/Script. Usage: wrap+name interesting body exprs with the `p` macro. Then activate profiling of these wrapped exprs using the `profiled` or `profile` macros: (profiled {} (p :my-fn (my-fn))) ; Returns [<body-result> <?pstats>] (profile {} (p :my-fn (my-fn))) ; Returns <body-result>, dispatches ; ?pstats to any registered handlers. Extensive facilities are provided for compile-time elision and runtime filtering. See the relevant docstrings for more info: `p`, `profiled`, `profile`, `add-handler!` ; Core API (p [opts & body] [id & body]) ; e.g. `(p ::my-pid (do-work))` (profiled [opts & body]) ; e.g. `(profiled {:level 2} (my-fn))` (profile [opts & body]) ; e.g. `(profiled {:level 2} (my-fn))` (add-handler! [handler-id ns-pattern handler-fn]) How/where to use this library: Tufte profiling is highly optimized: even without elision, you can usually leave profiling enabled in production (e.g. for sampled profiling, or to detect unusual performance behaviour). Tufte's stats maps are well suited to programmatic monitoring. Abbreviations, etc. - form id = pid = id given in `p` - group id = gid = id given in `profile`
This is mostly stuff for the README atm.
This is mostly stuff for the README atm.
No vars found in this namespace.
Private implementation details.
profiled
-> [<result> <derefable-and-mergeable-pstats>].
Profiling consists of:
Basic implementation:
Private implementation details. `profiled` -> [<result> <derefable-and-mergeable-pstats>]. Profiling consists of: 1. State init ; On thread 2. Capture ; On thread 3. State deref ; On thread 4. ?Merging ; Off thread, on demand (deferred cost) 5. ?Realization ; Off thread, on demand (deferred cost) Basic implementation: - Capture [<id> <elapsed>]s into single mutable acc - May compact acc to id-times, {<id> (<time> ...)} - May compact id-times to id-stats, {<id> (<stats/stats> ...)} - Merge pours (read-only) acc0 + acc1 into id-times - May compact id-times to id-stats, {<id> (<stats/stats> ...)} - Realization: - Generates {<id> <stats/stats>} from id-times. - Merges with id-stats.
Basic stats utils. Private, subject to change.
Basic stats utils. Private, subject to change.
Simple logging handler for integration with Timbre.
Simple logging handler for integration with Timbre.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close