The problem with seeing cputime with 'vmstat', 'top', and 'ps' has to do
with a misdeclaration of __kernel_clock_t
(include/asm-mips64/posix_types.h), which is the base type of clock_t.
When I change the declaration from "typedef int" to "typedef long",
those commands produce apparently accurate reports for user, system, and
idle time.
The mistyping results in an error in proc_pid_stat() (fs/proc/array.c)
where task->times.tms_utime (and other similar clock_t variables) are
formatted as %lu in an sprintf(), i.e., expecting those fields to be
64-bit longs, not 32-bit ints. A 32-bit tms_utime formatted by %lu
produces a huge ascii value in /proc/<pid>/stat.
If everyone is comfortable with this fix (i.e., if you don't think it
breaks anything when various clock_t and __kernel_clock_t fields
increase in size from 32 to 64 bits), then I'd be happy to do a CVS
checkin. Except I've never done a CVS checkin, and I'll need a little
guidance. I'm not even sure if I'm set up on oss.sgi.com with
permission to do updates.
John H.
|