Hi, Thanks to Andrew Morton who tried some things that I probably should have but didn't, here's the second version of a patch to give microstate accounting capability to Linux 2.5.73 I've also included a sample program to use the new system call, and to print out the times spent on active and expired queues, time spent sleeping, and time spent interrupted, etc. To save you having to dig up my previous email, here's what it does again: -- The results of getrusage() are unreliable in two ways: 1. Interrupt handlers are charged to the task that was interrupted, giving too high a system time. 2. User and system times are accrued at scheduler_tick time. If a task is I/O bound, then it tends to do a little bit of work (less than a tick) then sleep, so it's almost never running when the tick happens, so the user time is too low. -- To diagnose some of the interactivity problems we've been seeing in 2.5, you really want to know if the problem is that a task is spending too much time on the EXPIRED queue, is being starved because of interrupt load, or whatever. The attached patch allows one to measure these directly. The Microstate accounting patch (MSA) measures with the precision of the in-chip clock (TSC on IA32, ITC on IA64) the time spent in the various states, and exports the timers via a new system call (msa()) and through a new file /proc/pid/msa It gives misleading results on my laptop, where the power management seems to change the TSC frequency rather often, but on the UP P4 desktop machine, and the single and dual Itanium-2 boxes I tried, the results correlate extremely well with other timing information that I have (e.g., perfmon). I tried using the monotonic clock but that had the same problem (i.e., when the machine is less than 100% utilised, the clock speed drops and the INTERRUPTIBLE SLEEP timer reads low) The measured overhead of having MSA in place is available on http://www.gelato.unsw.edu.au/IA64wiki/MicroStateAccounting To summarise: the cost of a context switch goes up by under 5%; but kernbench shows no significant time differences between with and without the patch in and enabled.