top.diff

Anonymous, 09/03/2009 03:00 PM

Download (1.71 KB)

View differences:

usr.bin/top/machine.c
90 90
#define LP(pp, field) ((pp)->kp_lwp.kl_ ## field)
91 91
#define VP(pp, field) ((pp)->kp_vm_ ## field)
92 92

  
93
/* define what weighted cpu is.  */
94
#define weighted_cpu(pct, pp) (PP((pp), swtime) == 0 ? 0.0 : \
95
			 ((pct) / (1.0 - exp(PP((pp), swtime) * logcpu))))
96

  
97 93
/* what we consider to be process size: */
98 94
#define PROCSIZE(pp) (VP((pp), map_size) / 1024)
99 95

  
......
102 98
 */
103 99

  
104 100
static char smp_header[] =
105
  "  PID %-*.*s PRI NICE  SIZE    RES STATE  C   TIME   WCPU    CPU COMMAND";
101
  "  PID %-*.*s PRI NICE  SIZE    RES STATE  C   TIME   CPU COMMAND";
106 102

  
107 103
#define smp_Proc_format \
108
	"%5d %-*.*s %3d %3d%7s %6s %-6.6s %1x%7s %5.2f%% %5.2f%% %.*s"
104
	"%5d %-*.*s %3d %3d%7s %6s %-6.6s %1x%7s %5.2f%% %.*s"
109 105

  
110 106
static char up_header[] =
111
  "  PID %-*.*s PRI NICE  SIZE    RES STATE    TIME   WCPU    CPU COMMAND";
107
  "  PID %-*.*s PRI NICE  SIZE    RES STATE    TIME   CPU COMMAND";
112 108

  
113 109
#define up_Proc_format \
114
	"%5d %-*.*s %3d %3d%7s %6s %-6.6s%.0d%7s %5.2f%% %5.2f%% %.*s"
110
	"%5d %-*.*s %3d %3d%7s %6s %-6.6s%.0d%7s %5.2f%% %.*s"
115 111

  
116 112

  
117 113

  
......
266 262
	return(-1);
267 263
    }
268 264

  
269
    /* this is used in calculating WCPU -- calculate it ahead of time */
270
    logcpu = log(loaddouble(ccpu));
271

  
272 265
    pbase = NULL;
273 266
    pref = NULL;
274 267
    nproc = 0;
......
646 639
	    status,
647 640
	    (int)(smpmode ? LP(pp, cpuid) : 0),
648 641
	    format_time(cputime),
649
	    100.0 * weighted_cpu(pct, pp),
650 642
	    100.0 * pct,
651 643
	    cmdlength,
652 644
	    printable(PP(pp, comm)));