views:

274

answers:

1

Update: Upgrading to SBCL 1.0.24 fixed my problem. (Though I also needed to upgrade SLIME to the 11-23-2008 revision. The stable 2006-04-20 revision, as well as the head of CVS don't seem to work with SBCL 1.0.24.)

The documentation for the SBCL statistical profiler indicates that you can profile memory allocation in addition to CPU usage. However, for the life of me, I have not been able to get it to profile more than a trivial Lisp form. Here's an example of what happens:

CL-USER> (require :sb-sprof)
("SB-SPROF")
CL-USER> (defun ! (n)
           (if (= n 1)
               1
               (* n (! (- n 1)))))
!
CL-USER> (sb-sprof:with-profiling (:mode :alloc :loop nil :show-progress t :max-samples 100 :report :flat)
           (dotimes (n 100)
             (print n)
             (! 10)))
===> 0 of 100 samples taken.

0 
1 
2 
3 
4 
Profiler sample vector full (12 traces / 1000 samples), doubling the size
Profiler sample vector full (17 traces / 2000 samples), doubling the size
Profiler sample vector full (25 traces / 4000 samples), doubling the size
Profiler sample vector full (36 traces / 8000 samples), doubling the size
Profiler sample vector full (52 traces / 16000 samples), doubling the size
Profiler sample vector full (74 traces / 32000 samples), doubling the size

At this point, it usually hangs.

Has anyone had success with this?

+1  A: 

Works for me (i.e. no hanging) except that your example conses very little and takes 1ms to run so you probably want to take more samples and pass :LOOP T instead.

Luís Oliveira