diff options
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r-- | bin/ps/print.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index 5d7a0fd..a2b69be 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; #endif static const char rcsid[] = - "$Id: print.c,v 1.25 1998/05/15 06:29:16 charnier Exp $"; + "$Id: print.c,v 1.26 1998/05/25 05:07:18 steve Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -446,35 +446,35 @@ cputime(k, ve) VARENT *ve; { VAR *v; + int64_t sec; long secs; long psecs; /* "parts" of a second. first micro, then centi */ char obuff[128]; v = ve->var; if (KI_PROC(k)->p_stat == SZOMB || !k->ki_u.u_valid) { - secs = 0; - psecs = 0; + sec = 0; } else { /* * This counts time spent handling interrupts. We could * fix this, but it is not 100% trivial (and interrupt * time fractions only work on the sparc anyway). XXX */ - secs = KI_PROC(k)->p_rtime.tv_sec; - psecs = KI_PROC(k)->p_rtime.tv_usec; + sec = KI_PROC(k)->p_runtime; if (sumrusage) { - secs += k->ki_u.u_cru.ru_utime.tv_sec + - k->ki_u.u_cru.ru_stime.tv_sec; - psecs += k->ki_u.u_cru.ru_utime.tv_usec + + sec += (k->ki_u.u_cru.ru_utime.tv_sec + + k->ki_u.u_cru.ru_stime.tv_sec) * + (int64_t)1000000; + sec += k->ki_u.u_cru.ru_utime.tv_usec + k->ki_u.u_cru.ru_stime.tv_usec; } - /* - * round and scale to 100's - */ - psecs = (psecs + 5000) / 10000; - secs += psecs / 100; - psecs = psecs % 100; } + /* + * round and scale to 100's + */ + sec = (sec + 5000) / 10000; + secs = sec / 100; + psecs = sec % 100; (void)snprintf(obuff, sizeof(obuff), "%3ld:%02ld.%02ld", secs/60, secs%60, psecs); (void)printf("%*s", v->width, obuff); |