lkml.org 
[lkml]   [1997]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subject[patch][x86][hardcntr] Harware counter per process support
From
Date
 Hi all linux hackers,

<resume-for-linus> ;)

Per task/process hardware counters support for PPro and
PII. /proc/<pid> interface.

</resume-for-linus>

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.

With this patch, it is now possible to monitor per process behaviour
without any impact on the process.

Actually, a per process copy of hardware counters is maintained for
each task and hardware counters are changed at each context switch.

Of course, this patch is far from perfect, therefore I would like to
ask mainly two things:

1. For Linux gurus (Linus, Alan Cox, David Miller, Bill Hawes, Ingo
Molnar, ...): is it The Right Way(tm) to do such a thing ?

2. For other people: could they try this patch on various x86 hardware
(classic pentium) and report success or failure ? I am also interested
in AMD and Cyrix users to help me to support those architectures.

I have made a page (http://www.irisa.fr/prive/mentre/linux-counters/)
to provide various information about hardware counters. I would be glad
to have further information to complete it.

Features:
- SMP support
- updates at each context switch
- works on PII (tested), should work on PPro (untested)

Future improvements planned:
- Cyrix and AMD support (anybody with such hardware to help me ?)
- multi-architecture support (anybody with an Alpha to help me as I
haven't any access to a Linux Alpha machine ?)
- userland apps to use those counters.
- Hardware-Counters-HOWTO
- ??

d.

--
David.Mentre@irisa.fr -- CAPS research team - Irisa - France
Personal info: http://www.irisa.fr/prive/mentre/
Professional info: http://www.irisa.fr/caps/PEOPLE/David/

[unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2005-03-22 13:40    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site