0.8.13.70: MORE DOCUMENTATION
[sbcl.git] / contrib / sb-sprof / sb-sprof.texinfo
1 @cindex Profiling, statistical
2
3 The @code{sb-sprof} module, loadable by 
4 @lisp
5 (require :sb-sprof)
6 @end lisp
7 provides an alternate profiler which works by taking samples of the
8 program execution at regular intervals, instead of instrumenting
9 functions like @code{sb-profile:profile} does. You might find
10 @code{sb-sprof} more useful than accurate profiler when profiling
11 functions in the @code{common-lisp}-package, SBCL internals, or code
12 where the instrumenting overhead is excessive.
13
14 This module is known not to work consistently on the Alpha platform,
15 for technical reasons related to the implementation of a machine
16 language idiom for marking sections of code to be treated as atomic by
17 the garbage collector;  However, it should work on other platforms,
18 and the deficiency on the Alpha will eventually be rectified.
19
20 @subsection Example Usage
21
22 @lisp
23 (require :sb-sprof)
24 (sb-sprof:start-profiling)
25
26 (defvar *a* 0)
27 (dotimes (i (expt 2 26))
28   (setf *a* (logxor *a* (* i 5)
29                     (+ *a* i))))
30
31 (sb-sprof:stop-profiling)
32 (sb-sprof:report)
33 @end lisp
34
35 The profiler hooks into the disassembler such that instructions which
36 have been sampled are annotated with their relative frequency of
37 sampling.  This information is not stored across different sampling
38 runs. @c FIXME: maybe it should be?
39
40 @subsection Functions
41
42 @include fun-sb-sprof-report.texinfo
43
44 @include fun-sb-sprof-reset.texinfo
45
46 @include fun-sb-sprof-start-profiling.texinfo
47
48 @include fun-sb-sprof-stop-profiling.texinfo
49
50 @subsection Macros
51
52 @include macro-sb-sprof-with-profiling.texinfo
53
54 @subsection Variables
55
56 @include var-sb-sprof-star-max-samples-star.texinfo
57
58 @include var-sb-sprof-star-sample-interval-star.texinfo
59    
60 @subsection Credits
61
62 @code{sb-sprof} is an SBCL port, with enhancements, of Gerd
63 Moellmann's statistical profiler for CMUCL.