gpt4 book ai didi

java - Time Profiler、Instruments、OS X 中缺少 JAVA 过程名称

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:22:49 24 4
gpt4 key购买 nike

我正在使用 Java 编写算法实现。在 OS X 10.7 之前,我使用 Shark Profiler 来分析我的实现,效果相当好。但是,新的 Instruments 不再找到过程名称。我已经尝试使用 shark 的 VM 参数(即 -agentlib:Shark )运行 java 应用程序,但是 10.7 不知道它们,而且我找不到这样的仪器 agentlib。

关于如何将过程名称附加到 Insturments 中的符号名称(这是一些十六进制数字)的任何想法?我正在使用 Eclipse Indigo,如果这有什么不同的话。

谢谢!

编辑:到目前为止,OS X Mountain Lion 没有任何变化。

编辑 #2:来自(?)开发人员通过 apple 的错误报告器的更新:

dtrace has had support for Java stacks at points in the past, though I honestly couldn't say whether the support has been maintained. It may be a viable workaround for what you're trying to measure – which is otherwise not a priority for the performance tools at this point. You may want to start with the D script in /usr/bin/cpu_profiler.d and amend it to collect the jstack as well.

编辑 #3:好吧,经过更多讨论后发现开发人员本人并不知道该脚本的来源。显然,Instruments 中的时间分析器无论如何都不使用 DTrace,因此剩下的唯一选择就是编写我们自己的 DTrace 脚本或工具。

You're right, and I apologize. I'm not sure where that script came from, and when I looked at it carefully, it doesn't have jstack actions in it so it's not what you want anyway. It looks like the only java profiling option I can offer you is DTrace. DTrace has a profile provider, and a jstack action that collects java stacks. You can use "aggregates" to determine the heaviest stack traces, and all of this works from the command line. The documentation for DTrace is mostly maintained by Sun and I'd direct you to any DTrace tutorial since most cover the profile provider.

Despite what people say online, Instruments does not use DTrace for everything, specifically time profiling, so I can't offer you a quick fix in the Instruments UI.

最佳答案

Instruments 依赖于 Sun 开发的一个名为 dtrace 的可爱软件。 dtrace 有一个名为“jstack()”的函数,它应该用 java 符号打印堆栈跟踪,还有一个“ustack()”应该为其他语言(python、node.js 等)做类似的事情。 ).不幸的是,OS X 的 dtrace 版本不支持这些方法,因此 Instruments 不会提供该功能。

因此,不幸的是,在 Apple 修复这些工具之前,您无法从这些工具中获取这些信息。 :(

关注此主题以获取更多信息:http://www.mail-archive.com/dtrace-discuss@opensolaris.org/msg04863.html

我已经向 apple 提交了一个关于他们缺乏对帮助堆栈跟踪器的支持的错误,如果你想要这个功能,你也应该提交一个错误:https://bugreport.apple.com

关于java - Time Profiler、Instruments、OS X 中缺少 JAVA 过程名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8446503/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com