
9.2 Setting up the profiler
Before a profiling session can start several parameters must be set, using the function set-up-profiler
. This function is introduced here and the full syntax is given in the LispWorks Reference Manual . There are three main areas to consider: the symbols to be profiled, the time interval between samples, and the kind of profiling required.
- It is possible to keep track of every function called during a particular computation, but significant effort is involved in determining which symbols are suitable for profiling and in keeping track of the results. To minimize this effort you need to specify which symbols to profile, either by naming the required symbols, or by naming a package, all of whose symbols are profiled. The profiler first checks that these symbols have indeed got function definitions and are therefore suitable for profiling.
- You might want to specify the time interval between interrupts. The resolution of this value is clearly dependent on the operating system. For example, the greatest number of interrupts that can be sent to a process under SunOS is 100 per second. This number is important, because with these statistical methods of program profiling the accuracy of the results increases with the number of samples taken. In most cases the default values, 10 ms, is adequate.
Below is an example of setting up the profiler:
(set-up-profiler :symbols '(car cdr))
Here the functions car
and cdr
are going to be profiled.
The function set-up-profiler
adds symbols to the *profile-symbol-list*
. The functions add-symbol-profiler
and remove-symbol-profiler
can also be used to change the symbols profiled.
The function set-profiler-threshold
can be used with reset-profiler
to control the effects of repeated profiler runs.
LispWorks User Guide - 14 Dec 2001
