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)
Note: you cannot call start-profiling inside the scope of the macro profile or while the graphical Profiler is profiling, because the two profiling modes are incompatible.
LispWorks User Guide and Reference Manual - 21 Dec 2011