Re: perf: h/w counters not counted and no error/info reported touser

From: Corey Ashford
Date: Fri May 27 2011 - 02:31:52 EST


On 05/26/2011 03:10 PM, David Ahern wrote:

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

I suspect that what's happening is that "sleep 1" is not a very good test case, because it's sleeping most of the time. The result is that some of the events don't have time enough to get counted because not enough system ticks occur while the "sleep 1" is running to get all of the events to be scheduled onto the PMU.

Try a simple problem which spins, or otherwise chews up cycles, for a second or so instead of sleeps. I think you will get more events counted.

- Corey
--
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/