gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 18:40:39 27 4
gpt4 key购买 nike

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

documentation对于 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

此时,它通常会挂起。

有人成功过吗?

最佳答案

对我有用(即没有挂起),除了你的例子非常少并且需要 1ms 运行所以你可能想要获取更多样本并通过 :LOOP T 代替。

关于lisp - 如何使用 SBCL 的 SB-SPROF 分配分析?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/434937/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com