Next: Statistical Profiler, Up: Profiling

### 15.1 Deterministic Profiler

The package `sb-profile` provides a classic, per-function-call profiler.

NOTE: When profiling code executed by multiple threads in parallel, the consing attributed to each function is inaccurate.

— Macro: sb-profile:profile &rest names

> `profile` Name*

> If no names are supplied, return the list of profiled functions.

> If names are supplied, wrap profiling code around the named functions. As in `trace`, the names are not evaluated. A symbol names a function. A string names all the functions named by symbols in the named package. If a function is already profiled, then unprofile and reprofile (useful to notice function redefinition.) If a name is undefined, then we give a warning and ignore it. See also `unprofile`, `report` and `reset`.

— Macro: sb-profile:unprofile &rest names

> Unwrap any profiling code around the named functions, or if no names are given, unprofile all profiled functions. A symbol names a function. A string names all the functions named by symbols in the named package. `names` defaults to the list of names of all currently profiled functions.

— Function: sb-profile:report

> Report results from profiling. The results are approximately adjusted for profiling overhead. The compensation may be rather inaccurate when bignums are involved in runtime calculation, as in a very-long-running Lisp process.

— Function: sb-profile:reset

> Reset the counters for all profiled functions.