The function
start-profiling
starts collecting profiling information.
If
initialize
is non-
nil
any profiling information collected so far is discarded. The default value of
initialize
is
t
.
If processes is supplied, the set of processes that will be profiled is set as if by calling:
(set-process-profiling :set :processes
processes
)
Otherwise, the set of processes remains unchanged, so is controlled by any previous calls to set-process-profiling.
Only processes that are active are profiled.
start-profiling
can be repeatedly called without intervening calls to stop-profiling, for example to change the profiled processes.
start-profiling
cannot be used while profile is used or while the Profiler tool is profiling (on any thread). Between the call to
start-profiling
and the next call to stop-profiling with
print
t
(or omitted), profile and the Profiler tool cannot be used.
Various parameters which are set by set-up-profiler control the behavior of the profiler. See the documentation for set-up-profiler.
The following sequence of calls to
start-profiling
and
stop-profiling
can be used to profile only interesting work and print the results:
Start profiling the current process:
(start-profiling :processes :current)
(do-interesting-work)
Temporarily suspend profiling:
(stop-profiling :print nil)
(do-uninteresting-work)
(start-profiling :initialize nil)
(do-more-interesting-work)
(stop-profiling)