linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] perf_event: inst_retired:any_p:c=16:i=1 is not equivalent to cpu_clk_unhalted:thread_p
@ 2011-01-18 18:05 Stephane Eranian
  2011-01-18 18:36 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Stephane Eranian @ 2011-01-18 18:05 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, mingo, Lin Ming, Andi Kleen

Peter,

commit 7639dae0ca11038286bbbcda05f2bef601c1eb8d
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date:   Tue Dec 14 21:26:40 2010 +0100

    perf, x86: Provide a PEBS capable cycle event



Even with the transformation cmask=16:invert=1, you are not quite
counting the same thing.

inst_retired:any_p:c=16:i=1  is different from cpu_clk_unhalted:thread_p

Simply because, I think, this form of inst_retired counts in HALTED state.

This automatic transformation would be "okay" in per-thread mode, but
not in system-wide mode. It should not be done under the cover. I would
rather have this option at the user level.

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

* Re: [BUG] perf_event: inst_retired:any_p:c=16:i=1 is not equivalent to cpu_clk_unhalted:thread_p
  2011-01-18 18:05 [BUG] perf_event: inst_retired:any_p:c=16:i=1 is not equivalent to cpu_clk_unhalted:thread_p Stephane Eranian
@ 2011-01-18 18:36 ` Peter Zijlstra
  2011-01-18 20:26   ` Stephane Eranian
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2011-01-18 18:36 UTC (permalink / raw)
  To: Stephane Eranian; +Cc: LKML, mingo, Lin Ming, Andi Kleen

On Tue, 2011-01-18 at 19:05 +0100, Stephane Eranian wrote:
> Peter,
> 
> commit 7639dae0ca11038286bbbcda05f2bef601c1eb8d
> Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Date:   Tue Dec 14 21:26:40 2010 +0100
> 
>     perf, x86: Provide a PEBS capable cycle event
> 
> 
> 
> Even with the transformation cmask=16:invert=1, you are not quite
> counting the same thing.
> 
> inst_retired:any_p:c=16:i=1  is different from cpu_clk_unhalted:thread_p
> 
> Simply because, I think, this form of inst_retired counts in HALTED state.

Drad it does indeed:

# perf stat -a -e cycles:p -e cycles sleep 1

 Performance counter stats for 'sleep 1':

        61,634,870 cycles                  
        26,703,249 cycles                  

        1.000860820  seconds time elapsed


> This automatic transformation would be "okay" in per-thread mode, but
> not in system-wide mode. It should not be done under the cover. I would
> rather have this option at the user level.

Agreed, since its not identical it had best be done in userspace, too
bad :/ I'll revert this patch.

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

* Re: [BUG] perf_event: inst_retired:any_p:c=16:i=1 is not equivalent to cpu_clk_unhalted:thread_p
  2011-01-18 18:36 ` Peter Zijlstra
@ 2011-01-18 20:26   ` Stephane Eranian
  0 siblings, 0 replies; 3+ messages in thread
From: Stephane Eranian @ 2011-01-18 20:26 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: LKML, mingo, Lin Ming, Andi Kleen

On Tue, Jan 18, 2011 at 7:36 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, 2011-01-18 at 19:05 +0100, Stephane Eranian wrote:
>> Peter,
>>
>> commit 7639dae0ca11038286bbbcda05f2bef601c1eb8d
>> Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
>> Date:   Tue Dec 14 21:26:40 2010 +0100
>>
>>     perf, x86: Provide a PEBS capable cycle event
>>
>>
>>
>> Even with the transformation cmask=16:invert=1, you are not quite
>> counting the same thing.
>>
>> inst_retired:any_p:c=16:i=1  is different from cpu_clk_unhalted:thread_p
>>
>> Simply because, I think, this form of inst_retired counts in HALTED state.
>
> Drad it does indeed:
>
> # perf stat -a -e cycles:p -e cycles sleep 1
>
>  Performance counter stats for 'sleep 1':
>
>        61,634,870 cycles
>        26,703,249 cycles
>
>        1.000860820  seconds time elapsed
>
What's interesting here is that this cycles:p is not event equal to 1x CPU freq
given your measuring for 1s. So it must stop counting at some point.

>
>> This automatic transformation would be "okay" in per-thread mode, but
>> not in system-wide mode. It should not be done under the cover. I would
>> rather have this option at the user level.
>
> Agreed, since its not identical it had best be done in userspace, too
> bad :/ I'll revert this patch.
>
Yes, it would have been nice. But if you know what you're doing, this is
still doable from user space. So I think we are okay.

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

end of thread, other threads:[~2011-01-18 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-18 18:05 [BUG] perf_event: inst_retired:any_p:c=16:i=1 is not equivalent to cpu_clk_unhalted:thread_p Stephane Eranian
2011-01-18 18:36 ` Peter Zijlstra
2011-01-18 20:26   ` Stephane Eranian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).