All of lore.kernel.org
 help / color / mirror / Atom feed
* perf CPU profiling in Xen guest fail & workaround
@ 2015-07-29 19:04 Brendan Gregg
  2015-07-29 19:15 ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Brendan Gregg @ 2015-07-29 19:04 UTC (permalink / raw)
  To: linux-perf-use.

G'Day perf users,

I just debugged something and wanted to share in case others hit
this... perf CPU profiling didn't work for this Linux 4.1 guest (AWS
EC2):

# ./perf record -F 99 -a -g -- sleep 5
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.300 MB perf.data ]
# ./perf script
#

There are no CPU samples recorded (perf.data just has
PERF_RECORD_MMAP, etc). I believe it's because it's using the "cycles"
PMC event, and not "cpu-clock". And cycles is bogus:

# ./perf stat -e cycles -a sleep 1 2>&1 | grep cycles
    68,719,476,704      cycles
# ./perf stat -e cycles -a sleep 2 2>&1 | grep cycles
    68,719,476,704      cycles

I can fix it by profiling cpu-clock:

# ./perf record -e cpu-clock -a -g -- sleep 5
[ perf record: Woken up 27 times to write data ]
[ perf record: Captured and wrote 9.884 MB perf.data (105989 samples) ]
# ./perf script
[...data...]

Which is what I think all my other systems are doing anyway; some perf
-v -v output from those other systems:

[...]
sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
sys_perf_event_open failed, error -2
Warning:
The cycles event is not supported, trying to fall back to cpu-clock-ticks
[...]

This 4.1 system has these:

# cat /sys/devices/cpu/events/cpu-cycles
event=0x3c

Which other systems don't. Profiling these (eg, -e r003c) also doesn't work.

So I can use "-e cpu-clock", which is fine. It even lets me set the
profile frequency:

# ./perf record -F 99 -e cpu-clock -a -- sleep 1

Maybe this issue is already known and fixed in latest. I couldn't find
anything in a search...

Brendan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-29 22:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-29 19:04 perf CPU profiling in Xen guest fail & workaround Brendan Gregg
2015-07-29 19:15 ` David Ahern
2015-07-29 19:27   ` Brendan Gregg
2015-07-29 20:02     ` David Ahern
2015-07-29 22:21   ` Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.