NextPrevUpTopContentsIndex

profile

Macro
Summary

Runs the specified forms, and prints a performance profile.

Package

hcl

Signature

profile &body forms => final

Arguments

forms

The forms making up the program being profiled.

Values

final

The result of evaluating the final form.

Description

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.

Examples
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
See also

print-profile-list
*profile-symbol-list*
set-up-profiler


LispWorks Reference Manual - 12 Mar 2008

NextPrevUpTopContentsIndex