Re: [patch][x86][hardcntr] Harware counter per process support

Jakub Jelinek (jj@sunsite.ms.mff.cuni.cz)
Thu, 27 Nov 1997 08:48:21 +0100 (MET)


> Various recent processors (PPro, PII, Alpha, MIPS R10000, PPC 604e)
> have hardware counters builtin to count various events (cache misses,
> instruction fetch, etc.). I have made a patch (SilentCounters(tm) :) to
> provide access to such counters in a per process manner (patch which can
> be applied against 2.1.65 and 2.1.66).
>
> This patch add /proc/<pid>/hardcntr directory with ctrl0 and ctrl1 to
> access Pentium (PPro and PII) control registers and cntr0 and cntr1 to
> access counter registers.
>

UltraSPARC I, II and III have them as well.
We were thinking about adding such a support by extending the ptrace system
call. In any case it seems to me like your interface is too much
architecture specific (haven't studied your patch deeply), the interface
should have some architecture neutral control, like you'd say you're
interested in that and that and it would tell you either ok, this machine
supports it, or no, sorry, this architecture cannot do it, and there are some
performance issues in your patch, like the switch_to function should be put
into some arch specific header and inlined into schedule, as that routine must
fly... Also, we should answer the question to whom do irqs belong to, is it
the current process or to nobody, or to any other task? That won't show in
user time, of course, but in task kernel time for sure.

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
Ultralinux - first 64bit OS to take full power of the UltraSparc
Linux version 2.1.65 on a sparc64 machine (333.41 BogoMips).
___________________________________________________________________