Linux 上是否有类似的工具,可以像 Mac OS X 上的 Shark 一样工作?

发布于 2024-07-07 17:42:43 字数 273 浏览 9 评论 0原文

Mac OS X 上的 Shark 是在运行的系统上分析应用程序的绝佳工具。 Linux 有类似的工具吗?

OProfile 看起来可能是这样,有人用过吗?

Shark on Mac OS X is a great tool for profiling an application on a running system. Is there any similar tools for Linux?

OProfile looks like it could be, anyone used it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

灵芸 2024-07-14 17:42:43

扩展另一个答案,我使用 valgrind 的“callgrind”选项(http://valgrind.org)。 然后从 KDE 安装 kcachegrind 以获得漂亮的 GUI 界面。

作为傻瓜教程,请执行以下操作:

1) 使用调试信息编译应用程序。 尝试在打开和关闭优化的情况下进行分析是个好主意,关闭优化后您将获得更多信息,但可能不太准确(特别是微小的函数似乎会占用比其应有的时间更多的时间。2

)运行:

valgrind --tool=callgrind <name of your app> <your app's options>

这应该会生成一个名为“callgrind.something”的文件,您可以将其加载到 kcachegrind 中。

您还可以查看:

valgrind --tool=cachegrind <name of your app> <your app's options>

这将为您提供有关应用程序如何与 CPU 缓存交互的信息。

请注意,虽然 valgrind 和 shark 看起来很相似,但它们的工作方式却截然不同。 当您在 valgrind 中运行应用程序时,它的运行速度会比正常情况慢很多倍(通常慢 40 倍以上),但您得到的结果比 shark 的准确得多。 我倾向于同时使用两者,这样我可以获得尽可能多的信息!

Extending another answer, I use the 'callgrind' option of valgrind (http://valgrind.org). Then install kcachegrind from KDE for a nice GUI interface.

As a dummy's tutorial, do:

1) Compile your application with debugging information. It's a good idea to try profiling with optimization both on and off, with optimization off you will get more information, but it may be less accurate (in particular tiny functions will seem to take up more time than they deserve.

2) Run with:

valgrind --tool=callgrind <name of your app> <your app's options>

This should produce a file called 'callgrind.something', which you can load into kcachegrind.

You can also look at:

valgrind --tool=cachegrind <name of your app> <your app's options>

Which will give you information about how your app is interacting with your CPU's cache.

Note that while valgrind and shark seem like similar apps, they work very differently. When you run an app in valgrind it will run many times slower than normal (often over 40 times slower), but the results you get are much more accurate than shark's. I tend to use both, so I can get as much information as possible!

哆啦不做梦 2024-07-14 17:42:43

您也许可以尝试 Valgrind (http://valgrind.org/)。 他们有运行时和编译时分析工具。

You can probably try Valgrind (http://valgrind.org/). They have both runtime and compile time profiling tools.

南城旧梦 2024-07-14 17:42:43

回答这个问题有点晚了,但最接近的答案是 Zoom。 Shark 团队的一些成员参与了这项工作。

A bit late to answer this one, but the closest answer is Zoom. Some of the Shark team worked on it.

陌生 2024-07-14 17:42:43

OProfile 是一个对您的应用程序进行基于采样的分析的工具以及它所做的系统调用。 这样可以查看有关其花费时间的详细信息。 它没有 GUI,但有几个前端可以让您处理运行中的信息。

我已经广泛地将它用于桌面应用程序和嵌入式系统。 解释结果需要花费一些精力,但是调用图输出在这里非常有用。

OProfile is a tool that does sampling-based profiling of both your application and the system calls it makes. This allows for seeing detailed information about where it's spending time. It doesn't have a GUI, but there are several front-ends that will let you process the information from the runs.

I've used it extensively, both for desktop applications and for embedded systems. It takes a little effort to interpret the results, but the callgraph output is really useful here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文