If your processor supports performance-monitoring counters,
has a performance event which just counts cycles, and can
limit counters to user-mode (CPL 3), then you can achieve this
using the virtual per-process counters implemented by my
performance-monitoring counters driver.
(Available at http://www.csd.uu.se/~mikpe/linux/perfctr/.)
E.g., on a Pentium MMX, you'd set up the CESR register for a
given process to count cycles <ES0=0x30> at CPL 3 <CC0=0x2>.
The kernel and the driver cooperate to maintain per-process
state at scheduling points. The hardware setup will be different,
but Pentium Pro/II/III, Celeron, and Athlon processors are also
capable of counting user-space cycles.
/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/