Open xd009642 opened 2 years ago
I'm also having this same issue using version 0.9
.
I was able to address this by passing in a --profile-time
. This will run the profile (and not do the normal Criterion analysis). Note that if you're using cargo bench
then you'll need to invoke the command something like $ cargo bench --bench benchmark -- --profile-time 60
. Refer to the Criterion FAQ for more details.
@maxcountryman Do you know why add profile-time
will solve this?
@maxcountryman Do you know why add
profile-time
will solve this?
From criterion's document:
These functions will be called before and after each benchmark when running in --profile-time mode, and will not be called otherwise. This makes it easy to integrate in-process profiling into benchmarks when wanted, without having the profiling instrumentation affect regular benchmark measurements.
To my understanding, criterion is using this option as a switch for the external profiler.
I tried to use pprof with criterion to generate a flamegraph and I'm not sure what I'm missing as it seems to match the example functionally but no SVG is generated. Below is the entire benchmark source but it can also be found here https://github.com/xd009642/yin/blob/pprof_test/benches/yin_benchmark.rs
Also not sure if there's some way to turn on some form of logging for pprof but it could be useful for something just to help diagnose if things like that are a user problem or a pprof problem. I didn't see any mentioned and tried a quick
RUST_LOG
change which didn' do anything but if anyone has any tips in that regard I'd be interested :eyes: