This macro starts up the LispWorks program profiler. This tool is useful for determining the time critical elements of a program.
At a regular time interval the Lisp process is halted and the execution stack is scanned for the presence of any symbols in the list *profile-symbol-list*. Counters are maintained for the number of calls to each symbol, the total number of times the symbol is found on the stack, and the number of times the profiler finds the symbol on the top of the stack.
This information is then presented as absolute numbers and as a percentage of the total number of calls to the profiler. These figures taken together give useful information about which functions the program spends most of its time executing.
USER 22 > (set-up-profiler
:symbols '(* gethash typep maphash))
NIL
USER 23 > (profile (let ((x 1))
(loop for a from 1 to 50 by 1
do (setq x (* a x))
finally (return x))))
profile-stacks called 12 times
Symbol called profile (%) top (%)
MAPHASH 1 0 (0) 0 (0)*
50 1 (8) 0 (0)
SYSTEM::DUMMY-STRUCTURE-ACCESSOR 6 0 (0) 0 (0)
SYSTEM::DUMMY-STRUCTURE-SETTER 9 0 (0) 0 (0)
TYPEP 19 1 (8) 0 (0)
GETHASH 78 3 (25) 3 (25)
Top of stack not monitored 75% of the time
30414093201713378043612608166064768844377641568960512000000000000