linux-origin
[Top] [All Lists]

Re: mips64 'top' and 'vmstat' and cputimes

To: "Ulf Carlsson" <ulfc@xxxxxxxxxxxxxxxxxxxx>, "linux-origin" <linux-origin@xxxxxxxxxxx>
Subject: Re: mips64 'top' and 'vmstat' and cputimes
From: "John Hawkes" <hawkes@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 26 May 2000 15:30:18 -0700
Cc: "Ralf Baechle" <ralf@xxxxxxxxxxx>, "Kanoj Sarcar" <kanoj@xxxxxxxxxxxxxxxxxxxx>
References: <Pine.LNX.4.21.0005251802430.15277-100000@xxxxxxxxxxxxxxxxxxxx>
Sender: owner-linux-origin@xxxxxxxxxxx
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.


<Prev in Thread] Current Thread [Next in Thread>