问题标签 [oprofile]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
624 浏览

profiling - 我应该使用什么分析器来测量在此函数中花费的 _real_ 时间(包括等待系统调用),而不是 _CPU_ one

该应用程序不计算事物,但执行 i/o、读取文件、使用网络。我希望分析器显示它。

我期望像 callgrind 这样的东西,每个问题都会调用 clock_gettime 。

或者像 oprofile 那样中断我的应用程序(当它正在睡眠或等待套接字/文件/任何东西时)以查看它在做什么。

我希望像“read”、“connect”、“nanosleep”、“send”,尤其是“fsync”(以及他们所有的调用者)这样的东西是粗体的(而不是像执行计算的字符串或数字函数这样的东西)。

平台:GNU/Linux @ i386

0 投票
2 回答
2205 浏览

c++ - How am I supposed to interpret OProfile output?

I tried profiling my application with OProfile recently. The data gathered is already very valuable to me, but I'm having difficulties with its precise interpretation. After running my app with oprofile set up and running, I generated the report and got:

root@se7xeon:src# opreport image:test -l -t 1
Overflow stats not available
CPU: P4 / Xeon with 2 hyper-threads, speed 3191.66 MHz (estimated)
Counted GLOBAL_POWER_EVENTS events (time during which processor is not stopped) with a unit mask of 0x01 (mandatory) count 750000
samples % symbol name
215522 84.9954 cci::Image::interpolate(unsigned char*, cci::Matrix const&) const
17998 7.0979 cci::Calc::diff(unsigned char const*, unsigned char const*)
13171 5.1942 cci::Image::getIRect(unsigned char*, int, int) const
5519 2.1765 cci::Image::getFRect(unsigned char*, double, double) const

Okay, so my interpolation function is responsible for 84% of the application's (too long) execution time. Seems a good idea to look into it then:

root@se7xeon:src# opannotate image:test --source
[...]

If I understand correctly, the if conditional is responsible for over 22% of the program's execution time. The opening brace and the function declaration seem to take time, is that supposed to correspond to the function call overhead ("push parameters on stack, jump, pop parameters" sequence)?

I changed some things in the source (related to a later bottleneck because I had no idea how to optimize an if), recompiled, ran through oprofile again (not forgetting opcontrol --reset). Now the annotated code looks like this in the same place:

This time the if takes basically no time at all (?), the most expensive instruction is "col1 = col0 + 1", and the whole time-taking block seems to have shifted upwards. How can this be? Can this be trusted at all to pinpoint bottlenecks in the source?

An another point of doubt for me is that when I set up opcontrol, I entered the traced event as GLOBAL_POWER_EVENTS, with the number of samples being 750k. In the output, the interpolation function seems to take 84%, but the number of samples recorded inside it is only a little bit above 200k. That isn't even 50% of the requested number. Am I to understand that the remaining ~500k samples was taken by applications not listed in the output (kernel, Xorg, etc.)?

0 投票
1 回答
1086 浏览

linux - oprofile 不能使用硬件性能计数器

我在带有 2 个 Xeon E5504 处理器的 IBM HS22 刀片上安装了 debian 5.0 linux 服务器。我发现 oprofile 在此设置中无法识别硬件性能计数器,只有定时器中断可用:

系统信息为:

oprofile 是使用 apt 从 debian 存储库安装的。

我应该怎么做才能启用硬件性能计数器?谢谢!

0 投票
1 回答
3081 浏览

c - 在 Linux 中监视上下文切换

有没有办法在不使用分析器的情况下确定何时发生上下文切换?我编写了一个 C 程序来监视程序中不同进程完成执行所花费的时间。我也想展示进程/线程上下文切换。切换发生的时间和从prev_id -> curr_id。这 3 个信息会有所帮助。

0 投票
1 回答
432 浏览

c++ - 可以使用 oprofile 进行分析

我正在使用 cent os 5.5 。

Linux localhost.localdomain 2.6.18-164.el5xen #1 SMP Thu Sep 3 04:03:03 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

我正在尝试使用用 c++ 编写的 oprofile 来分析我的项目(服务器)。

因此,为此我使用的是 eclipse Helios Service Release 2,它有一个用于 oprofile 的插件。我已经通过eclipse安装了插件。但是当我尝试使用 oprofile 进行分析时,会弹出一条消息说,

“发生错误。有关详细信息,请参阅错误日志。java.lang.ExceptionInInitializerError”

我也尝试过使用 eclipse 插件 gprof。它创建了 gmon.out 文件,但不幸的是它没有采样。它只能显示调用 qa 函数的次数,但不能显示函数执行的持续时间。谁能告诉我为什么会这样?

谁能告诉我 cent os 内核是否支持使用 oprofile 进行分析。

我的项目是一个用 C++ 编写的服务器。它具有共享库并且是多线程的。效率不高。所以我试图找出它在哪里花费了很多时间以及它在哪里使 cpu 过载。

如果有人能告诉我如何以适当的方式在 Eclipse 中使用 oprofile 或 gprof 分析我的服务器,那将是一个 gr8 帮助。我更喜欢 eclipse,因为它以更易于理解的方式显示 gmon.out 或 oprofile 的输出

谢谢

0 投票
1 回答
548 浏览

oprofile - 剥离二进制文件上的 oprofile

我正在尝试找到在剥离的二进制文件上使用 oprofile 的方法,但在以后符号表可用时仍然可以获得详细信息,但到目前为止我还没有找到任何解决方案。

这是我的情况:我们的软件被剥离给我们的客户,但我们的构建机器上有未剥离的版本。当我们发生软件崩溃时,回溯可以被发回,我们可以用本地未剥离的构建来解释它。

由于 oprofile 是关于取样和解释样本,有没有办法解耦这个过程?oprofile/opreport 有没有办法生成基于十六进制地址的配置文件信息,这些信息可以在具有所有可用符号的不同机器上解释。也许我可以通过复制示例文件来做到这一点?

我相信这一定是可能的,所以我正在向专家寻求建议。详细的步骤会很好。

提前致谢。

0 投票
1 回答
2057 浏览

linux - oprofile 还活着吗?

oprofile 项目还活着吗?

我知道默认的 linux 内核仍然支持它,并且用户空间实用程序可以工作(至少在我正在运行的 Arch linux 上),但是它的大部分文档似乎已经过时了?

是否有其他分析器可以在 linux 上完成与 oprofile 相同的工作,或者它只是过去几年一切运行良好的一个案例?还是每个人都有英特尔核心 iGezillion 处理器?

0 投票
2 回答
561 浏览

linux - 可以使 oprofile 使用 /root/.oprofile 以外的目录吗?

我们正在尝试使用oprofile来跟踪服务器集群上的性能问题。但是,有问题的服务器有一个只读文件系统,其中 /var/tmp 是唯一可写的目录。

OProfile 想要在运行时创建两个目录:/root/.oprofile/var/lib/oprofile,但它不能,因为文件系统是只读的。我可以使用--session-dir命令行选项使其将日志写入./var/lib/root/.oprofile

文件系统是只读的,因为它位于不可写介质上,而不是因为权限——即,即使是超级用户也不能写入这些目录。我们可以制作文件系统的新 ROM 映像(显然,这就是我们安装 oprofile 的方式),但是运行时程序无法写入 /root,无论它是否是超级用户。

我尝试在指向 /root/.oprofile -> /var/tmp/oprofile 的 ROM 中创建一个符号链接,但显然 oprofile 没有将此符号链接视为目录,并且在运行时失败:

我们必须在这个特定系统上运行我们的分析器,因为如果我们在开发服务器上构建和运行应用程序,我们试图调查的性能问题不会显现出来。我们不能只在程序员的工作站上运行我们的测试并在那里配置应用程序,因为问题不会在那里发生。

有没有办法配置 oprofile 使其不使用/root

0 投票
1 回答
994 浏览

amazon-ec2 - 在 EC2 上运行时,如何让 OProfile / Xenoprof 使用事件计数器?

我正在为 EC2 编写一个集群范围的分析工具,旨在通过在每个实例上运行 OProfile 来收集数据。我最终想汇总 opreport 生成的 XML 输出,并在以后对其进行分析。

现在,我一直坚持让 OProfile 来查看硬件事件——我所能做的就是在 Timer Interrupt 模式下构建配置文件。我有一种感觉,这是因为 EC2 实例在虚拟化环境中运行,而 OProfile 无法看到硬件事件。

我对这种预感进行了一些研究,并提出了 Xenoprof 作为一种可能的解决方案,但是关于如何使用 EC2 启动并运行它的文档非常有限。

如果有人在 EC2 上运行 Xenoprof 有任何成功(我知道肯定有一些成功,因为有几篇关于它的论文),你能告诉我出了什么问题吗?

当我运行 yum install oprofile

然后是 man opcontrol

在实例上,我看到 xen 的选项在那里,我认为这意味着必须安装 Xenoprof。我只是不知道如何将硬件事件作为我的样本。

任何建议将不胜感激!谢谢。

0 投票
1 回答
1209 浏览

linux - oprofile 未对 LLC_MISSES 缓存事件进行采样

我正在尝试使用oprofile在大型实时应用程序中记录缓存未命中:

但是当我查看报告时,它没有提到缓存未命中。它仅对 CPU_CLK_UNHALTED 进行采样:

但是 --status 声称 oprofile正在采样 L2 未命中:

我究竟做错了什么?我无法让它对其中列出的任何其他计数器进行采样ophelp

这是 Ubuntu 上的 oprofile 0.9.6,内核版本 2.6.38。