FunctionPackage: profToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
New since the initial 10.1 release.

save-named-profile

Arguments: name

Returns the current profile after saving it with the name name. The profile can be saved (and thus named) while running (you are asked if you want the profile stopped and if you answer y it is stopped). If the profile is already stopped, it is saved. It is not necessary to analyze the profile (with, say, show-call-graph or show-flat-profile) before saving a stopped profile.

Examples

cl-user(3): (prof:start-profiler)
:sampling
cl-user(4): (dotimes (i 10000) (* i i))
nil

;; Trying to save a profile while a profile has been started
;; and not stopped will cause the user to be asked what should
;; be done:
;;
cl-user(5): (prof:save-named-profile 'foo)
The previous time profile is still in progress.  Do you want to stop
it? [y or n] n
;;
;; 'n' means do not abort the running profile
;;
The time profiler is currently running.  Thus, a new profile was not
initiated.
Warning: The current profile has not been saved.
nil
;; This time we do abort the running profile:
;;
cl-user(6): (prof:save-named-profile 'foo)
The previous time profile is still in progress.  Do you want to stop
it? [y or n] y
#<time profile foo>
cl-user(7): (prof:find-named-profile 'foo)
#<time profile foo>
t

;; Once a profile is stopped and saved, there is no :current profile:
;;
cl-user(8): (prof:find-named-profile :current)
nil
cl-user(9): (prof:start-profiler)
:sampling
cl-user(10): (dotimes (i 10000) (* i i))
nil
cl-user(11): (prof:stop-profiler)
:saved

;;
;; The just stopped profile is the :current profile.
;;
cl-user(12): (prof:find-named-profile :current)
#<time profile current>

;; We can save it with a name ('bar' in this case):
;;
cl-user(13): (prof:save-named-profile 'bar)
#<time profile bar>

;; Here is its status. In this simple example intended to show
;; functions being used, not real profile information was collected.
;;
cl-user(14): (prof:profiler-status :profile (prof:find-named-profile 'bar))
Named profile bar:
The time profiler is stopped and 1 samples were collected.
Use profiler:show-flat-profile, profiler:show-call-graph,
profiler:disassemble-profile or, if you are running the IDE, select the menu
item Run/Runtime Analyzer Results Dialog to see the results.

cl-user(15): (prof:show-flat-profile)
Sampling stopped after 1 samples taken for the time profiler.

Sample represents .0 seconds of user+system CPU time.

Times below 1.0% will be suppressed.

  %     %   self total         self   total  Function                                  
 Time  Cum. secs  secs calls ms/call ms/call   name                                    
100.0 100.0  0.0   0.0                       ... dotimes


;; Functions like PROF:SHOW-FLAT-PROFILE, SHOW-CALL-GRAPH
;; and CL:DISASSEMBLE will find a profile when a name is supplied
;; as the value of the :PROFILE argument. At the beginning of this
;; example, we saved a profile named FOO:
;;
cl-user(16): (prof:show-flat-profile :profile 'foo)
Sampling stopped after 1 samples taken for the time profiler.

Sample represents .0 seconds of user+system CPU time.

Times below 1.0% will be suppressed.

  %     %   self total         self   total  Function                                  
 Time  Cum. secs  secs calls ms/call ms/call   name                                    
100.0 100.0  0.0   0.0                       "sigprocmask"
cl-user(17): 

See runtime-analyzer.htm for general information on profiling and the runtime analyzer.


Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page is new in the 10.1 release.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
New since the initial 10.1 release.