2009-01-12 20 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。