如何使用 SBCL 的 SB-SPROF 分配分析?

发布于 2024-07-11 06:24:50 字数 1205 浏览 10 评论 0原文

更新:升级到 SBCL 1.0.24 解决了我的问题。 (虽然我还需要将SLIME升级到11-23-2008修订版。稳定的2006-04-20修订版以及CVS的头部似乎不适用于SBCL 1.0.24。)

SBCL 统计分析器的文档表明您还可以分析内存分配到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

此时,它通常会挂起。

有人在这方面取得过成功吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蹲墙角沉默 2024-07-18 06:24:50

对我有用(即没有挂起),只是你的例子消耗很少并且需要 1ms 来运行,所以你可能想要获取更多样本并传递 :LOOP T 。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文