2009-01-12 10 views
4

更新:升级到SBCL 1.0.24解决了我的问题。 (虽然我也需要将SLIME升级到11-23-2008版本,稳定的2006-04-20版本,以及CVS的负责人似乎没有与SBCL 1.0.24一起工作。)如何使用SBCL的SB-SPROF分配分析?

SBCL统计分析器的documentation表示除CPU使用率外,还可以分析内存分配。然而,在我的生活中,我一直无法将它变成一个简单的Lisp表单。下面是一个发生的例子:

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 

在这一点上,它通常挂起。

有没有人有过这方面的成功?

+0

挂起听起来不太好,所以你至少应该指定你正在使用的版本以及在什么平台上。在sbcl-devel邮件列表上报告也可能是一个好主意。 – 2009-01-12 13:48:40

回答

1

适用于我(即不挂),除非您的示例非常少,只需1ms即可运行,因此您可能需要更多样本并传递:LOOP T。