6

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.

Kire Haglin
  • 6,569
  • 22
  • 27
Clément MATHIEU
  • 3,030
  • 23
  • 25

1 Answers1

8

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

Suma
  • 33,181
  • 16
  • 123
  • 191
Hirt
  • 1,664
  • 10
  • 12
  • Thanks Marcus ! Any chance to be able to configure that at run time in the future ? I am a huge fan of the MBean feature and it would be great to be able to pass this as an option to jfrStart or through the settings. – Clément MATHIEU Aug 22 '15 at 14:31
  • I would think that the flag is a general setting for the flight recorder engine, which is already started when you call the MBean to start a particular recording, so you would still need the flag on the command line. – Klara Aug 24 '15 at 11:04
  • For JDK 9 we're looking at being able to configure the max stack depth at runtime, either as part of either the recording configuration or the template. – Hirt Aug 25 '15 at 12:30