问题
This is closely related to another question: How can I measure thread stack depth?
Can JProfiler watch threads and measure where the deepest stacks occur? If so, how can I do that? I'd like find spots in my application where I'm getting dangerously close to triggering a StackOverflowError.
回答1:
JProfiler does not have this as a feature directly. However, you can do the following:
Record CPU data with sampling and no filters
go to the call tree view in the CPU section
export the call tree in XML format, selecting the "entire tree" option at the bottom of the file chooser dialog
write a small program that analyzes the exported XML file and finds the most deeply nested elements
You can also automate this with offline profiling and a trigger to record CPU data and save a snapshot. With the "jpexport" command line executable, you can then export the call tree from the saved snapshot.
来源:https://stackoverflow.com/questions/8330033/can-jprofiler-measure-stack-depth