Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Chasing Concept ACKs and opinions on approach taken.
After researching on flamegraphs I've concluded that for my system (macOS) the best way to generate flamegraphs is using DTrace to sample the active stack frames of the specified process and then https://github.com/brendangregg/FlameGraph to convert the stack traces into the flame graph. Therefore this initial approach is a script to simplify the execution process, from profiling to flamegraphs generation.
The logic is based off some work by fanquake, which I tried to enhance and pack into a script for ease of use.
It's an issue that the process is not the same for all systems, but hopefully with some minor changes this will also work for Linux using
perf
.There are 2 scenarios for flame graphs usage, real-life and custom scenarios. This PR is for the latter, although paving the way towards real scenarios where we will create flame graphs on actual usage of the accumulator.
No documentation has been written, as I am still not sure of this approach, but I tried to explain everything with comments in the code.
Note: for this to work, you need to clone the FlameGraph repo and set the appropriate variable at
generate_flamegraph
.Bellow are some of the flamegraphs, hosted at my own domain to take advantage of the .svg capabilities:
./generate_flamegraph
: profiling_demo.svg./generate_flamegraph 30 bench_utreexo ProveElementsForest
: bench_provelementsforest.svg./generate_flamegraph 30 bench_utreexo AddElementsPollard
: bench_addelementspollard.svg