All Manuals > LispWorks User Guide and Reference Manual > 32 The HCL Package

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
(set-up-profiler 
 :symbols '(* sqrt floor))
=>
20
 
(profile
  (let ((x 1))
    (loop for a from 1 to 500000
          do (setq x (floor (* a (sqrt x))))
          finally (return (integer-length x)))))
=>
profile-stacks called 401 times
 
Call tree
Symbol                                          seen   (%)
    1: "CAPI Execution Listener 1"               401 (100)
     2: *                                          5 (  1)
     2: SQRT                                       4 (  1)
     2: FLOOR                                      1 (  0)
 
 
Cumulative profile summary
Symbol                called  profile   (%)      top   (%)
*                          0        5 (  1)        0 (  0)
SQRT                       0        4 (  1)        1 (  0)
FLOOR                      0        1 (  0)        0 (  0)
 
On average   1.0 stacks profiled each profiler invocation
Top of stack not monitored 100% of the time
38
See also

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


LispWorks User Guide and Reference Manual - 21 Dec 2011

NextPrevUpTopContentsIndex