Re: [Perfctr-devel] Re: Enabling RDPMC in user space by default

Stephane Eranian
2005-11-29T22:20:32Z

Andi,

On Tue, Nov 29, 2005 at 10:52:07PM +0100, Andi Kleen wrote:
> On Tue, Nov 29, 2005 at 01:43:11PM -0800, Nicholas Miell wrote:
> > On Tue, 2005-11-29 at 19:13 +0100, Andi Kleen wrote:
> > > > Where did you see that PMC0 (PERSEL0/PERFCTR0) can only be programmed
> > > > to count cpu cycles (i.e. cpu_clk_unhalted)? As far as I can tell from
> > > > the documentation, the 4 counters are symetrical and can measure
> > > > any event that the processor offers.
> > >
> > > Linux NMI watchdog does that.
> > >
> > > All other perfctr users are supposed to keep their fingers away
> > > from the watchdog (it looks like oprofile doesn't but not for much
> > > longer ...)
> >
> > Why? Hardcoding PMC 0 to be a cycle counter seems to be a waste of a
> > perfectly usable performance counter. What if I want to profile four
> > things, none of them requiring a cycle count?
>

On AMD you only have 4 counters. That's not a lot for some measurements.
The other thing is that PERCTR0 is not like the TSC. It can count cycles
but it does only implement 47bits. At a high clock rate, this can wrap
around fairly rapidly. It all depends on what is the intended usage model.

Suppose you would have a "stable" performance monitoring interface.
One could just use that interface to measure time only when needed.

--
-Stephane