在 Linux 下可以使用哪些免费、低开销(统计)分析器?

发布于 2024-07-13 06:33:40 字数 23 浏览 5 评论 0原文

最好来自 Ubuntu 存储库。

Preferably from Ubuntu repositories.

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

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

发布评论

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

评论(5

梦纸 2024-07-20 06:33:40

其他人提到了OProfile; 对于现代 Linux 安装上的全系统统计分析,它确实很强大。

更古老的工具(不需要内核支持,因此可以在旧版本的 Linux 甚至非 Linux 操作系统下工作)是 GNU gprof,包含在 binutils 中> (因此无疑已经安装在您的开发环境中)。

要使用 gprof,只需使用 gcc-pg 参数编译应用程序即可; 程序退出后将创建一个名为 gmon.out 的文件,然后可以使用 gprof 来分析该文件。

Others have mentioned OProfile; for full-system statistical profiling on modern Linux installations, it does indeed rock.

The more venerable tool (which doesn't require kernel support and thus will work under older versions of Linux or even non-Linux operating systems) is GNU gprof, included in binutils (and thus doubtless already installed in your development environment).

To use gprof, just compile your application with the -pg argument to gcc; a file called gmon.out will be created after your program exits, and gprof can then be used to analyze this file.

甜妞爱困 2024-07-20 06:33:40

一种简单但有效的技术是在 GDB 下运行程序并处理 SIGINT 信号。 当程序运行时,通过键入 control-c 或其他方式手动生成 SIGINT,当程序停止时,记录调用堆栈。 多次执行此操作,例如 10 或 20 次,同时程序主观上会很慢。 这会让你很好地了解时间都花在哪里了。

这种方法并不能给你精确的计时,但它可以精确地定位到花费最多时间的指令,包括调用指令。

如何分析运行在Linux?

A simple but effective technique is to run the program under GDB and handle the SIGINT signal. While the program is running, generate SIGINT manually by typing control-c or whatever, and while it is halted, record the call stack. Do this a number of times, like 10 or 20, while the program is being subjectively slow. This will give you a very good idea of where the time goes.

This method does not give you precise timing, but it does precisely locate the instructions, including call instructions, that cost the most time.

How can I profile C++ code running in Linux?

魂归处 2024-07-20 06:33:40

Sysprof 是一个很好的分析器,类似于 OProfile(也有 gtk GUI) 。 它可以在 Ubuntu 存储库中找到。 它是一个内核级分析器,需要一个与 gprof 不同的内核模块,但也与 gprof 不同,它可以分析多线程应用程序。

Sysprof is a good profiler, similar to OProfile (also has a gtk GUI). which is available in the Ubuntu repository. It's a kernel level profiler, requiring a kernel module unlike gprof, however, also unlike gprof, it can profile multithreaded applications.

別甾虛僞 2024-07-20 06:33:40

OProfile。 使用起来并不困难,但有些问题。

There is OProfile. It is not that difficult to use, but is somewhat buggy.

行至春深 2024-07-20 06:33:40

我在 oprofile 方面取得了巨大成功(http://oprofile.sourceforge.net/news/ ),它在 Ubuntu 存储库中也可用。 它不需要重新编译,并且对共享对象等没有任何限制。

I've had good success with oprofile (http://oprofile.sourceforge.net/news/) which is available in Ubuntu repositories as well. It doesn't require recompilation, and doesn't have any limitations regarding shared objects or the like.

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