错误:perf.data文件没有样本 [英] error: perf.data file has no samples

查看:323
本文介绍了错误:perf.data文件没有样本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在学习使用perf.我有硬件事件的输出,但没有cpu-cycles或cpu-clock之类的软件事件的输出.

I'm currently learning to use perf. I have output for hardware events, but not for software events like cpu-cycles or cpu-clock.

我使用详细选项调用了perf:

I invoked perf with the verbose option:

$ > perf record -v ./pi-serial-ps
mmap size 528384B
Reference Pi: 3.1415926536
Simulated Pi: 3.1415209778
[ perf record: Woken up 15 times to write data ]
Looking at the vmlinux_path (7 entries long)
Using /proc/kallsyms for symbols
[ perf record: Captured and wrote 3.694 MB perf.data (96497 samples) ]

使用-e cpu-clock调用perf记录可得到相同的输出.我查看了真实样本大小:

Invoking perf record with -e cpu-clock gives the same output. I looked at the real sample size:

$ > perf report -D -i perf.data | grep RECORD_SAMPLE | wc -l
96497

性能报告TUI提供一个没有错误的空表.使用详细选项,它输出:

The perf report TUI provides an empty table without errors. With verbose option, it outputs:

$ > perf report -v perf.data
build id event received for [kernel.kallsyms]: d9ffffc97cd9edb0ddd58462595dd69a8c8b694
build id event received for /lib/modules 2.6.32-642.11.1.el6.Bull.106.x86_64/kernel/net/sunrpc/sunrpc.ko: 31402cf2d9ace7f86d54601334db6931390f8f6c
build id event received for /home/h1/s7330426/_Exercises/X03/x03/pi-serial-ps: bd3a924ac41ff481a4bc5bf034853f03b76193f4
build id event received for /lib64/ld-2.12.so: f3eebd18e66eb139ea4d76cdfa86d643abcf0070
build id event received for /lib64/libc-2.12.so: 24d3ab3db0f38c7515feadf82191651da4117a18

性能注释出现此错误:

the perf.data file has no samples

即使使用冗长的选项,它也不会向控制台输出任何内容.

It doesn't output anything to the console, not even with verbose option.

我检查了这个问题 perf.data文件没有示例还有这个 http://www.spinics.net/lists/linux-perf-users/msg01437.html 两者都没有解决我的问题.

I checked this question perf.data file has no samples and also this http://www.spinics.net/lists/linux-perf-users/msg01437.html which both didn't solve my problem.

我正在不具有root特权的本地主机上使用Linux版本2.6.32-642.11.1.el6.Bull.106.x86_64.

I'm working with Linux version 2.6.32-642.11.1.el6.Bull.106.x86_64 on a local host without root privileges.

有帮助吗?

我找到了一种解决方法来测量cpu时钟,但是我不知道它是否可靠:性能:软件事件之间的奇怪关系

I found a work-around to measure cpu-clock, but I don't know if it's reliable: perf: strange relation between software events

推荐答案

perf stat 开始以获取通用的原始性能计数器值:

Start with perf stat to get generic raw performance counter values:

perf stat ./pi-serial-ps

如果某些事件 event 的原始计数超过几百或数千,并且目标程序运行了几毫秒以上,则可以使用 perf record -e event (或 perf record -e event:u (不分析内核代码).perf记录通常会将采样率自动调整到几kHz左右(例如,如果您的程序有1亿个周期,perf记录可能每隔100万个周期选择一次作为采样生成器),并且原始计数器值太低的事件可能不会生成任何采样.您还可以使用perf记录的 -c 选项为每个样本设置事件计数,在此示例中,我们要求perf记录在程序的用户空间代码中每花费10000个周期后生成一次样本;将为运行8469个循环的程序生成零样本:

If some event event has raw counts more than several hundreds or thousands and target program runs for more than several milliseconds, you may use perf record -e event (or perf record -e event:u to not profile kernel code). perf record usually autotune sample rate to around several kHz (for example if your program has 100 millions of cycles, perf record may select around every 1 mln cycles as sample generator), and events with too low raw counter value may not generate any samples. You also may set event count for every sample with -c option of perf record, in this example we asked perf record to generate sample after every 10000 cycles spent in userspace code of program; zero samples will be generated for program which runs for 8469 cycles:

perf record -e cycles:u -c 10000 ./pi-serial-ps

这篇关于错误:perf.data文件没有样本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆