error: perf.data file has no samples

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

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) ]

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

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

Perf annotate has this error:

the perf.data file has no samples

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

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.

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

Any help?

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


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

perf stat ./pi-serial-ps

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
链接地址: http://www.djcxy.com/p/80046.html

上一篇: GAE / Google API刷新访问令牌的DeadlineExceededErrors

下一篇: 错误:perf.data文件没有样本