当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Can JProfiler measure stack depth?

问题描述:

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.

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: