javajvmjmcjfrflamegraph

How to avoid truncated stack traces with Java Flight Recorder


I am using Oracle Java Flight Recorder to collect stack trace samples of a Java application. Theses stack traces allows me to eventually produce a CPU Flamegraph.

My issue is that stack traces deeper than 64 frames are truncated by Java Flight Recorder. It's very easy to observe in the Flamegraph and using a debugger I can observe that no FLRStackTrace has more than 64 FLRFrames and that almost all stack traces with 64 frames have their TruncationState set to TRUNCATED.

Does anyone know if this 64 frames limit can be increased ? Flamegraphs are useless if the stack traces are incomplete.


Solution

  • Yep! But not if you're running on JRockit. If running on HotSpot, simply use the flag -XX:FlightRecorderOptions=stackdepth=<n>, where n, as you have discovered, defaults to 64.

    More info here: http://hirt.se/blog/?p=364