在 SBCL 下分析一个慢函数
Profiling a slow function under SBCL
我需要分析一个 "slow" 的函数,即它需要 非常 很长时间才能终止(如果有的话)。在我看来,应该可以使用 SBCL 中的统计分析器来分析这个函数,因为它只是定期采样。
然而,当我 运行
(sb-sprof:with-profiling (:max-samples 1000 :report :flat :loop nil)
(the-function-in-question))
探查器只打印
Profiler sample vector full (537 traces / 10000 samples), doubling the size
但从未returns报告。
是否有可能实现我的想法,如果有,我该如何实现?
如果该函数没有 return,显然不会打印报告。要查看报告,您可以使用以下操作顺序:
(require :sb-sprof)
(sb-sprof:start-profiling)
(the-function-in-question)
- 一段时间后中止函数的执行
(sb-sprof:report :type :flat)
我需要分析一个 "slow" 的函数,即它需要 非常 很长时间才能终止(如果有的话)。在我看来,应该可以使用 SBCL 中的统计分析器来分析这个函数,因为它只是定期采样。 然而,当我 运行
(sb-sprof:with-profiling (:max-samples 1000 :report :flat :loop nil)
(the-function-in-question))
探查器只打印
Profiler sample vector full (537 traces / 10000 samples), doubling the size
但从未returns报告。
是否有可能实现我的想法,如果有,我该如何实现?
如果该函数没有 return,显然不会打印报告。要查看报告,您可以使用以下操作顺序:
(require :sb-sprof)
(sb-sprof:start-profiling)
(the-function-in-question)
- 一段时间后中止函数的执行
(sb-sprof:report :type :flat)