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

Peter Chubb
2003-08-27T07:39:42Z

>> Command exited with non-zero status 100 Command being timed:
>> "apt-get update" User time (seconds): 0.01 System time (seconds):
>> 0.00 Percent of CPU this job got: 6% Elapsed (wall clock) time
>> (h:mm:ss or m:ss): 0:00.32 Average shared text size (kbytes): 0
>> Average unshared data size (kbytes): 0 Average stack size (kbytes):
>> 0 Average total size (kbytes): 0 The averages might be nice...

William> The averages themselves aren't reported with getrusage(),
William> only direct usage measurements. Presumably luserspace
William> computes the averages itself. i.e. the counters are all for
William> non-average versions of these stats and (because we're seeing
William> all 0's) are not reported at all.

Yes, the kernel is (supposed) to calculate the integral over time of
the memory sizes; user space divides these integrals by elapsed time
to get averages.

To calculate these you need a timestamp for last change, and a set of
counters.
Then code to update all the counters every time one of the sizes
change (otherwise you need a timestamp for each counter) by adding
current_size*(current_time - last_change_time) to each counter.

William> On Tue, Aug 26, 2003 at 06:29:14PM -0700, Mike Fedyk wrote:
>> Maximum resident set size (kbytes): 0 But the maximum would allow
>> any polling app to do its polling less often. As well as the
>> averages above... Average resident set size (kbytes): 0 Major
>> (requiring I/O) page faults: 320 Minor (reclaiming a frame) page
>> faults: 21

William> The fault counters are vaguely bogus when threads are
William> involved. There's a comment alluding to that nearby.

The fault counters are incorrect anyway --- faults satisfied from the
page cache are counted as major faults, whereas we expect only faults
that sleep for disk I/O to be counted as major faults.

William> On Tue, Aug 26, 2003 at 06:29:14PM -0700, Mike Fedyk wrote:
>> Swaps: 0 Counting swaps would be nice too.

William> This already has two counters in the task_t (no, I will not
William> use Finnish Hungarian notation in my general posts) that are
William> 100% unused. Probably the only thing preventing slab poison
William> from showing up there outright is the whole task_t copy in
William> kernel/fork.c and the bss zeroing for init_task.

It's unclear what `swaps' are in Linux. Traditionally, this rusage
field was the number of complete swapouts --- I'm not sure what the
equivalent is when processes are not swapped out holus-bolus, but are
paged gradually.

William> On Tue, Aug 26, 2003 at 06:29:14PM -0700, Mike Fedyk wrote:
>> File system inputs: 0 File system outputs: 0 Socket messages sent:
>> 0 Socket messages received: 0 Signals delivered: 0 Yes, yes, yes.

William> These would be easy to set up, they just need counters and
William> the ticking of the counters dropped in.

It's on my list of things to do, if not soon, then I'm hoping for a
summer student to do some of this stuff.

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