Liking cljdoc? Tell your friends :D

cider.inlined-deps.profile.v0v5v2.profile.core

A Clojure library for profiling.

Example

(require '[cider.inlined-deps.profile.v0v5v2.profile.core :refer :all])
(defn my-add [a b] (+ a b))
(defn my-mult [a b] (* a b))

(profile-vars my-add my-mult)

(profile {}
 (my-add (my-mult (rand-int 100000) (rand-int 1000000))
         (my-mult (rand-int 100000) (rand-int 1000000))))

profile prints output to *err* using pprint/print-table; it looks like this:

|          :name | :n | :sum | :q1 | :med | :q3 | :sd | :mad |
|----------------+----+------+-----+------+-----+-----+------|
|  #'user/my-add |  1 |  2µs | 2µs |  2µs | 2µs | 0µs |  0µs |
| #'user/my-mult |  2 | 11µs | 3µs |  8µs | 3µs | 3µs |  5µs |
A Clojure library for profiling.

## Example

```clojure
(require '[cider.inlined-deps.profile.v0v5v2.profile.core :refer :all])
(defn my-add [a b] (+ a b))
(defn my-mult [a b] (* a b))

(profile-vars my-add my-mult)

(profile {}
 (my-add (my-mult (rand-int 100000) (rand-int 1000000))
         (my-mult (rand-int 100000) (rand-int 1000000))))
```

`profile` prints output to `*err*` using `pprint/print-table`; it
looks like this:

```
|          :name | :n | :sum | :q1 | :med | :q3 | :sd | :mad |
|----------------+----+------+-----+------+-----+-----+------|
|  #'user/my-add |  1 |  2µs | 2µs |  2µs | 2µs | 0µs |  0µs |
| #'user/my-mult |  2 | 11µs | 3µs |  8µs | 3µs | 3µs |  5µs |
```
raw docstring

*profile-data*clj

source

clear-profile-dataclj

(clear-profile-data)
source

max-sample-countclj

(max-sample-count)

Return maximum sample count of current profile session.

Return maximum sample count of current profile session.
sourceraw docstring

print-entry-summaryclj

(print-entry-summary name)
(print-entry-summary session name)

Prints a table of profiling statistics to *err* for var with name if present. Returns nul.

Prints a table of profiling statistics to `*err*` for var with
`name` if present. Returns nul.
sourceraw docstring

(print-summary)
(print-summary session)

Prints to err statistics for profiled names. Returns nil.

Prints to *err* statistics for profiled names. Returns nil.
sourceraw docstring

profilecljmacro

(profile options & body)

Execute body in a new profile session using options and print summary of collected profile data to *err* using print-summary.

Execute body in a new profile session using `options` and print
summary of collected profile data to `*err*` using `print-summary`.
sourceraw docstring

profile-nsclj

(profile-ns ns)
(profile-ns ns include-private?)

Equivalent to evaluating profile-var* on each function-containing var is ns. If include-private? is present and true, profile functions associated with private vars in addition to public vars, otherwise profile only public functions. Returns true value.

Equivalent to evaluating `profile-var*` on each function-containing
var is `ns`. If `include-private?` is present and true, profile
functions associated with private vars in addition to public vars,
otherwise profile only public functions. Returns true value.
sourceraw docstring

profile-sessionclj

(profile-session)
(profile-session max-sample-count)

Inititalize profile session with optional maximum sample count. Default maximum sample count is 10,000.

Inititalize profile session with optional maximum sample
count. Default maximum sample count is 10,000.
sourceraw docstring

profile-varcljmacro

(profile-var var)

If var is not already profiled, wraps the associated value with a function that accrues time to the current profile session.

If `var` is not already profiled, wraps the associated value with a
function that accrues time to the current profile session.
sourceraw docstring

profile-var*clj

(profile-var* var)

Given a var value, profile it if it is not already profiled.

Given a var value, profile it if it is not already profiled.
sourceraw docstring

profile-varscljmacro

(profile-vars & vars)

Equivalent to evaluating profile-var on each element of vars.

Equivalent to evaluating `profile-var` on each element of `vars`.
sourceraw docstring

profiled?clj

(profiled? f)

Reurns a true value if f is currently profiled.

Reurns a true value if `f` is currently profiled.
sourceraw docstring

set-max-sample-countclj

(set-max-sample-count n)

Set maximum sample count of current profile session. Maximum sample count refers to the the maximum number of samples any individual name may be associated with. Value is applied when time is accured; this call will not truncate any profile data.

Set maximum sample count of current profile session. Maximum sample
count refers to the the maximum number of samples any individual
name may be associated with. Value is applied when time is accured;
this call will not truncate any profile data.
sourceraw docstring

summaryclj

(summary)
(summary session)

Returns a map containing two keys, :stats and :agg-stats. The former containts a sequence of maps containing statistics describing the profile data for each profiled name. :agg-stats contains a map of statistics relevant to the aggregate of all profiles names.

Returns a map containing two keys, `:stats` and `:agg-stats`. The
former containts a sequence of maps containing statistics describing
the profile data for each profiled name. `:agg-stats` contains a map
of statistics relevant to the aggregate of all profiles names.
sourceraw docstring

toggle-profile-nsclj

(toggle-profile-ns ns)
(toggle-profile-ns ns include-private?)

If any vars in ns are profiled, unprofile all vars in ns, regardless whether public or private. If no vars in ns are profiled, profiles each public (and private, if include-private? is present and true) function-containing var. Returns true value if namespace is profiled.

If any vars in `ns` are profiled, unprofile all vars in `ns`,
regardless whether public or private. If no vars in `ns` are
profiled, profiles each public (and private, if `include-private?`
is present and true) function-containing var. Returns true value if
namespace is profiled.
sourceraw docstring

toggle-profile-varcljmacro

(toggle-profile-var var)

Profiles or unprofiles var depending on its current state. Returns a truthy value if var is profiled subsequent to evaluation of this macro.

Profiles or unprofiles `var` depending on its current
state. Returns a truthy value if `var` is profiled subsequent to
evaluation of this macro.
sourceraw docstring

toggle-profile-var*clj

(toggle-profile-var* v)

For use by cider-nrepl.

For use by cider-nrepl.
sourceraw docstring

unprofile-nsclj

(unprofile-ns ns)

Equivalent to evaluating unprofile-var* on each function-containing var in ns, whether public or private. Returns not-true value.

Equivalent to evaluating `unprofile-var*` on each
function-containing var in `ns`, whether public or private. Returns
not-true value.
sourceraw docstring

unprofile-varcljmacro

(unprofile-var var)

If var is profiled, replaces binding with original function.

If `var` is profiled, replaces binding with original function.
sourceraw docstring

unprofile-var*clj

(unprofile-var* var)

Given a var value, unprofile it if it is profiled.

Given a var value, unprofile it if it is profiled.
sourceraw docstring

unprofile-varscljmacro

(unprofile-vars & vars)

Equivalent to evaluating unprofile-var on each element of vars.

Equivalent to evaluating `unprofile-var` on each element of
`vars`.
sourceraw docstring

with-sessioncljmacro

(with-session options & body)

Evaluate body in context of a new profile sassion initializaed with options, a map that may contain a :max-sample-count.

Evaluate `body` in context of a new profile sassion initializaed
with `options`, a map that may contain a `:max-sample-count`.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close