Can JProfiler measure stack depth?

空扰寡人 提交于 2019-12-11 02:58:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!