Collection of scripts to manipulate flamegraphs and collapsed stacks
1 sdkman
2 jbang - $ sdk install jbang
-
LambdaNormalize - Lambdas are wrapped by dynamically named classes at runtime. For stack profiles captured for code that creates new ClassLoaders, invoked lambdas are named differently for each ClassLoader. When plotted in a flamegraphs, each different Lambda name is plotted separately in the call stack and the flamegraph not correctly represent the actual stacktrace. This script inspects the stack frames, and when it finds a dynamically named Lambda, it normalizes it to a frame name common to a particular call stack
Usage:
$ java --agentpath:/path/to/libasyncProfiler.so=start,file=/path/to/profile.folded -jar /path/to/jar $ jbang -p ./scripts/LambdaNormalize /path/to/profile.folded > /path/to/profile.folded.lambda $ /path/to/FlameGraph/flamegraph.pl /path/to/profile.folded.lambda > /path/to/profile.folded.svg
-
ExtractFolded - Extract the folded stacks and sample counts from a flamegraph.svg
Usage:
$ java --agentpath:/path/to/libasyncProfiler.so=start,file=/path/to/profile.svg -jar /path/to/jar $ jbang -p ./scripts/ExtractFolded /path/to/profile.svg > /path/to/profile.extracted.folded $ /path/to/flamegraph.pl /path/to/profile.extracted.folded > /path/to/profile.extracted.folded.svg