@c Generated by the sb-manual contrib. Do not edit.

@node profiling
@cindex profiling
@chapter Profiling

@menu
* Deterministic Profiler: deterministic profiler.
* Statistical Profiler: statistical profiler.
@end menu

SBCL includes both a deterministic profiler, that can collect
statistics on individual functions, and a more "modern",
statistical profiler.

Inlined functions do not appear in the results reported by either.

@node deterministic profiler
@cindex profiling, deterministic
@section Deterministic Profiler

The package @code{sb-profile} provides a classic, per-function-call
profiler.

@quotation
@strong{Warning}: When profiling code executed by multiple threads in
parallel, the consing attributed to each function is inaccurate.
@end quotation

@anchor{Macro sb-profile profile}
@ffindex @sortas{profile sb-profile} profile [sb-profile]
@deffn{Macro} sb-profile:profile &rest names
If no names are supplied, return the list of profiled functions.

If names are supplied, wrap profiling code around the named functions.
As in @code{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
@code{unprofile}, @code{report} and @code{reset}.
@end deffn
@anchor{Macro sb-profile unprofile}
@ffindex @sortas{unprofile sb-profile} unprofile [sb-profile]
@deffn{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. @code{names} defaults to the list of names of all currently
profiled functions.
@end deffn
@anchor{Function sb-profile report}
@ffindex @sortas{report sb-profile} report [sb-profile]
@deffn{Function} sb-profile:report &key limit print-no-call-list
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.

If @code{limit} is set to an integer, only the top @code{limit} results are
reported. If @code{print-no-call-list} is @code{t} (the default) then a list of
uncalled profiled functions are listed.
@end deffn
@anchor{Function sb-profile reset}
@ffindex @sortas{reset sb-profile} reset [sb-profile]
@deffn{Function} sb-profile:reset
Reset the counters for all profiled functions.
@end deffn
@include ../../contrib/sb-sprof/sb-sprof.texinfo
