perf: h/w counters not counted and no error/info reported to user

From: David Ahern
Date: Thu May 26 2011 - 18:10:28 EST



By default (tip-perf-core) perf-stat enables a number of H/W counters:

perf stat -- sleep 1

Performance counter stats for 'sleep 1':

1.346889 task-clock
1 context-switches
0 CPU-migrations
157 page-faults
<not counted> cycles
<not counted> stalled-cycles-frontend
<not counted> stalled-cycles-backend
493,740 instructions
137,062 branches
6,773 branch-misses

In this case 3 of them are not counted and perf does not tell me why.
I'm guessing that my processor (Core2 Duo T9550) does not support the
stalled cycles counters. Should perf not emit a message telling me that?

However, cycles is supported by the processor:

perf stat -e cycles -- sleep 1

Performance counter stats for 'sleep 1':

1,091,102 cycles

Based on that I am guessing that only the last N requested events are
counted where N is processor specific. In my case N is apparently 3 as
this works:

perf stat -e cycles -e instructions -e branches -- sleep 1

Performance counter stats for 'sleep 1':

1,028,331 cycles
634,101 instructions
130,253 branches

but adding a fourth causes the first one to roll off -- again without
any message from perf:

perf stat -e cycles -e instructions -e branches -e branch-misses -v --
sleep 1
Performance counter stats for 'sleep 1':

<not counted> cycles
219,727 instructions
128,071 branches
6,625 branch-misses

Which is confusing -- cycles are not counted, yet it should be given
that it is supported.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/