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

From: David Ahern
Date: Fri May 27 2011 - 11:04:49 EST




On 05/27/2011 03:50 AM, Ingo Molnar wrote:
>
> * David Ahern <dsahern@xxxxxxxxx> wrote:
>
>> By default (tip-perf-core) perf-stat enables a number of H/W counters:
>>
>> perf stat -- sleep 1
>
> did you mean to do 'perf stat -a sleep 1' ?

Adding the -a has its own problems. It blocks reading from fd=0 (stdin);
I have to type Ctrl-D to see the results. The FD array gets initialized
to 0 and some case is not erroring out or setting the fd.

perf stat -a -- sleep 1

Performance counter stats for 'sleep 1':

2008.600377 task-clock
545 context-switches
31 CPU-migrations
198 page-faults
101,938,898 cycles
140,734,186,560,480 stalled-cycles-frontend
0 stalled-cycles-backend
115,406,129 instructions

26,361,321 branches
1,068,804 branch-misses

1.003842524 seconds time elapsed

The stalled-cycles-frontend is off the chats, but shows a value.
Similarly, backed shows 0 versus <not counted>.


>
> 'perf stat sleep 1' in itself will only measure that very simple
> command - which does not do much.

Simple program for a simple test. I just wanted to know which counters
are available for a given processor.

Per your comment and Corey's I tried a program that does some work:

perf stat -- openssl speed aes

Performance counter stats for 'openssl speed aes':

44964.148608 task-clock
4,593 context-switches
48 CPU-migrations
487 page-faults
124,134,470,217 cycles
<not counted> stalled-cycles-frontend
<not counted> stalled-cycles-backend
319,440,401,206 instructions
6,710,107,937 branches
1,638,412 branch-misses

45.012092601 seconds time elapsed
This time I get data for 4 events -- which I did not get with sleep --
but I get <not counted> for the stalled cycles.

How is the <not counted> supposed to be interpreted?

Also, back to the 'perf stat -- sleep 1' example: If I run it with
individual -e <event> args I get values -- up to 3. Sure sleep is a
simple program, but some counter value comes out. What's magical about 3?

David


>
> Thanks,
>
> Ingo
--
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/