Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Profiling a slow function under SBCL

I'm in the need to profile a function that is "slow", i.e. it takes a very long time to terminate (if ever). It seems to me that it should be possible to profile this function nonetheless using the statistical profiler in SBCL, as it just takes samples in regular intervals. However, when I run

(sb-sprof:with-profiling (:max-samples 1000 :report :flat :loop nil)
   (the-function-in-question))

the profiler just prints

Profiler sample vector full (537 traces / 10000 samples), doubling the size

but never returns with the report.

Is it even possible what I have in mind, and if so, how do I achieve it?

like image 417
BlenderBender Avatar asked Nov 26 '25 03:11

BlenderBender


1 Answers

If the function doesn't return, the report will not be printed, obviously. What you could do to see the report is use the following sequence of operations:

  1. (require :sb-sprof)
  2. (sb-sprof:start-profiling)
  3. (the-function-in-question)
  4. abort the execution of the function after some time
  5. (sb-sprof:report :type :flat)
like image 137
Vsevolod Dyomkin Avatar answered Nov 28 '25 17:11

Vsevolod Dyomkin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!