The profiler has two distinct modes. You can use both in the same session, but not at the same time.
The macro profile simply profiles all processes while a body of code is run, as described in 12.3.1 Using the macro profile. Start profiling this way if you don't see a need to use the alternate mode.
Alternatively the functions start-profiling, stop-profiling and set-process-profiling offer programmatic control over when profiling occurs and which processes are profiled. This is described in 12.3.2 Programmatic control of profiling.
To profile your Lisp forms enter:
Your program can control profiling. This is useful when you want to profile only a part of the program.
In your program, call start-profiling start collecting profiling information. Call stop-profiling with print
nil to temporarily stop collecting, or call stop-profiling with print
t to stop collecting and print the results. At any point you can call set-process-profiling to modify the set of processes for which profiling information is being (or will be) collected.
;; start profiling, current process only (start-profiling :processes :current) (do-interesting-work) ;; temporarily suspend profiling (stop-profiling :print nil) (do-uninteresting-work) ;; resume profiling (start-profiling :initialize nil) (do-more-interesting-work) ;; now, all processes are interesting (set-process-profiling :set :all) (do-some-more-interesting-work) ;; stop profiling and print the results (stop-profiling)
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:20