Re: [PATCH] 2.6.0-test4 -- add context switch counters

From: Peter Chubb
Date: Tue Aug 26 2003 - 20:52:02 EST


>>>>> "Andrew" == Andrew Morton <akpm@xxxxxxxx> writes:

Andrew> Peter Chubb <peterc@xxxxxxxxxxxxxxxxxx> wrote:
>> Currently, the context switch counters reported by getrusage() are
>> always zero. The appended patch adds fields to struct task_struct
>> to count context switches, and adds code to do the counting.
>>
>> The patch adds 4 longs to struct task struct, and a single addition
>> to the fast path in schedule().

Andrew> OK... Why is this useful? A bit of googling doesn't show
Andrew> much interest in it.

/usr/bin/time reports the info, yes.

It's useful for tuning the scheduler, and when developing and tuning
posix thread apps.

I wanted to know if the work I did on adding preemption support to IA64
actually made much difference in the number of involuntary context
switches. It doesn't, at least on the measurements I've made so far.

I'm actually intested in getting most of the rusage fields filled in
properly, at least the ones that make sense for Linux.

Things to do are:
-- Track maxrss and report it.
-- Track and integrate rss.
-- Fix the page fault accounting (currently some minor faults
are counted as major faults)
-- add signal accounting

Block I/O isn't that important -- it almost all goes through the page
cache anyway, and it's a bit difficult to assign a particular I/O to a
particular process. Likewise, message I.O isn't that important AFAIK.

The stack, data and unshared data sizes aren't currently
accounted for separately at all, so it'd be a bit difficult to track
the integral of those numbers.

--
Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au
You are lost in a maze of BitKeeper repositories, all slightly different.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/