Project

General

Profile

Bug #1484 ยป top.diff

Anonymous, 09/03/2009 03:00 PM

View differences:

usr.bin/top/machine.c
#define LP(pp, field) ((pp)->kp_lwp.kl_ ## field)
#define VP(pp, field) ((pp)->kp_vm_ ## field)
/* define what weighted cpu is. */
#define weighted_cpu(pct, pp) (PP((pp), swtime) == 0 ? 0.0 : \
((pct) / (1.0 - exp(PP((pp), swtime) * logcpu))))
/* what we consider to be process size: */
#define PROCSIZE(pp) (VP((pp), map_size) / 1024)
......
*/
static char smp_header[] =
" PID %-*.*s PRI NICE SIZE RES STATE C TIME WCPU CPU COMMAND";
" PID %-*.*s PRI NICE SIZE RES STATE C TIME CPU COMMAND";
#define smp_Proc_format \
"%5d %-*.*s %3d %3d%7s %6s %-6.6s %1x%7s %5.2f%% %5.2f%% %.*s"
"%5d %-*.*s %3d %3d%7s %6s %-6.6s %1x%7s %5.2f%% %.*s"
static char up_header[] =
" PID %-*.*s PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND";
" PID %-*.*s PRI NICE SIZE RES STATE TIME CPU COMMAND";
#define up_Proc_format \
"%5d %-*.*s %3d %3d%7s %6s %-6.6s%.0d%7s %5.2f%% %5.2f%% %.*s"
"%5d %-*.*s %3d %3d%7s %6s %-6.6s%.0d%7s %5.2f%% %.*s"
......
return(-1);
}
/* this is used in calculating WCPU -- calculate it ahead of time */
logcpu = log(loaddouble(ccpu));
pbase = NULL;
pref = NULL;
nproc = 0;
......
status,
(int)(smpmode ? LP(pp, cpuid) : 0),
format_time(cputime),
100.0 * weighted_cpu(pct, pp),
100.0 * pct,
cmdlength,
printable(PP(pp, comm)));
    (1-1/1)