在 .so 库上使用 gprof?

发布于 2024-09-09 17:34:53 字数 108 浏览 4 评论 0原文

我正在构建一个 .so 插件,并想使用 gprof 对其进行分析。目前,我无法重建(使用 -pg 选项)链接到它的可执行文件。一旦加载并链接到这个 .so 文件,是否可以使用 gprof 对其进行分析?

I'm building a .so plugin and would like to profile it using gprof. At the moment, I don't have the ability to rebuild (with the -pg option) the executable that links to it. Is it possible to use gprof to profile just this .so file once it's loaded up and linked to?

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

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

发布评论

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

评论(2

手长情犹 2024-09-16 17:34:53

gprof 是不可能的(根据我的经验,gprof 基本上不起作用,除非你可以静态链接一切,包括 libc,而 libc 人们现在真的不希望你这样做),但是你应该能够使用 kcachegrind 来做到这一点。它会为您提供整个程序的详细信息,但对于您没有源代码的部分没有符号,您只需忽略该部分即可。奖励:无需重新编译。

It's not possible with gprof (in my experience, gprof basically doesn't work unless you can statically link everything including libc, and the libc people really don't want you to do that these days) but you should be able to do this with kcachegrind. It'll give you details on the whole program, but with no symbols for the part you don't have source for, and you just ignore that part. Bonus: no need to recompile.

初熏 2024-09-16 17:34:53

正如 Zack 所说,gprof 不会这样做。

但即使确实如此,您也可能会感到失望,因为 gprof 只能发现某些类型的问题。如果您发现并修复了这些问题,那么您的性能就会受到未发现的问题的限制。

这里列出了问题列表,不仅涉及 gprof,还涉及许多分析器。

给出 < a href="http://www.rotateright.com/" rel="nofollow noreferrer">缩放 尝试一下。

As Zack said, gprof won't do that.

But even if it did, you could be disappointed, because gprof only finds certain kinds of problems. If you find and fix those problems, you are left with performance being limited by the problems it didn't find.

Here's a list of issues, not just with gprof, but with many profilers.

Give Zoom a try.

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