keeping track of time spend in non-user space

From: Sjaak Koot (sk75362@fokkerspace.nl)
Date: Fri Feb 11 2000 - 04:23:38 EST


Hi,

I am using linux kernel 2.2.13 on a Pentium PC.

I would like to keep track of the CPU time in user space of a process or
task. The user/system time currently implemented is not accurate enough,
its resolution is 10 ms.

The idea was to keep track when a process enters/leaves the kernel space
and use the time stamp counter to measure the amount of time spend in
the kernel and substract this from the wall clock time. Note that I would like
to know the CPU time in user space for each process separately.

Anyone already implemented this ?

I started playing around with the kernel and added a call to a stop trace
routine
at the "restore_all" label in entry.S. I also added a call to a start trace
routine
in do_IRQ (for all interrupts), and at the entries system_call, lcall7 and the
label
error_code (to cover e.g. page faults(?)). In addition I keep track on the depth

of the entrances to the kernel through a counter to locate the last return into
user space.
Somehow I am still missing entries into the kernel as the stop trace routine is
called when the depth counter=0. Thus the stop trace has been called more often
than the start trace routine. Which entries into the kernel could I be missing?
Is this approach at all ok?

Sjaak Koot.

--
+------------------------------------------------------------+
| Sjaak Koot                                Fokker Space B.V.|
|                                                            |
| Phone: +31.(0)71-5245453                  Newtonweg 1      |
| Email: sk75362@fokkerspace.nl             P.O. Box 32070   |
| Fax  : +31.(0)71-5245499                  2303 DB Leiden   |
|                                           The Netherlands  |
+------------------------------------------------------------+

- 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/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:19 EST