Back out last change. It was not a format string cleanup at all,
but rather a piece of SMP development code not ready for committing.
This commit is contained in:
parent
e31647affd
commit
ef3b320608
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: m_netbsd15.c,v 1.8 2000/10/11 14:46:20 is Exp $ */
|
/* $NetBSD: m_netbsd15.c,v 1.9 2000/10/11 19:10:19 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* top - a top users display for Unix
|
* top - a top users display for Unix
|
||||||
@ -34,7 +34,7 @@
|
|||||||
* Simon Burge <simonb@netbsd.org>
|
* Simon Burge <simonb@netbsd.org>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id: m_netbsd15.c,v 1.8 2000/10/11 14:46:20 is Exp $
|
* $Id: m_netbsd15.c,v 1.9 2000/10/11 19:10:19 thorpej Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -93,12 +93,13 @@ static char header[] =
|
|||||||
"%5d %-8.8s %3d %4d%7s %5s %-7s%7s %5.2f%% %5.2f%% %.12s"
|
"%5d %-8.8s %3d %4d%7s %5s %-7s%7s %5.2f%% %5.2f%% %.12s"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Process state names for the "STATE" column of the display.
|
||||||
* Process state names for the "STATE" column of the display.
|
* The extra nulls in the string "run" are for adding a slash and
|
||||||
|
* the processor number when needed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *state_abbrev[] = {
|
char *state_abbrev[] = {
|
||||||
"", "start", "run", "sleep", "stop", "zomb", "dead", "cpu"
|
"", "start", "run\0\0\0", "sleep", "stop", "zomb", "dead", "onproc"
|
||||||
};
|
};
|
||||||
|
|
||||||
static kvm_t *kd;
|
static kvm_t *kd;
|
||||||
@ -447,7 +448,6 @@ format_next_process(handle, get_userid)
|
|||||||
long cputime;
|
long cputime;
|
||||||
double pct;
|
double pct;
|
||||||
struct handle *hp;
|
struct handle *hp;
|
||||||
char *statep, state[10];
|
|
||||||
static char fmt[128]; /* static area where result is built */
|
static char fmt[128]; /* static area where result is built */
|
||||||
|
|
||||||
/* find and remember the next proc structure */
|
/* find and remember the next proc structure */
|
||||||
@ -481,19 +481,6 @@ format_next_process(handle, get_userid)
|
|||||||
/* calculate the base for cpu percentages */
|
/* calculate the base for cpu percentages */
|
||||||
pct = pctdouble(pp->p_pctcpu);
|
pct = pctdouble(pp->p_pctcpu);
|
||||||
|
|
||||||
statep = state_abbrev[(unsigned)pp->p_stat];
|
|
||||||
|
|
||||||
/* Add cpu number if appropriate */
|
|
||||||
if (pp->p_cpuid != ~(uint64_t)0) {
|
|
||||||
switch (pp->p_stat) {
|
|
||||||
case SONPROC:
|
|
||||||
case SRUN:
|
|
||||||
snprintf(state, sizeof(state), "%s/%lld",
|
|
||||||
statep, (long long)pp->p_cpuid);
|
|
||||||
statep = state;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* format this entry */
|
/* format this entry */
|
||||||
sprintf(fmt,
|
sprintf(fmt,
|
||||||
Proc_format,
|
Proc_format,
|
||||||
@ -503,7 +490,7 @@ format_next_process(handle, get_userid)
|
|||||||
pp->p_nice - NZERO,
|
pp->p_nice - NZERO,
|
||||||
format_k(pagetok(PROCSIZE(pp))),
|
format_k(pagetok(PROCSIZE(pp))),
|
||||||
format_k(pagetok(pp->p_vm_rssize)),
|
format_k(pagetok(pp->p_vm_rssize)),
|
||||||
statep,
|
state_abbrev[(unsigned char) pp->p_stat],
|
||||||
format_time(cputime),
|
format_time(cputime),
|
||||||
100.0 * weighted_cpu(pct, pp),
|
100.0 * weighted_cpu(pct, pp),
|
||||||
100.0 * pct,
|
100.0 * pct,
|
||||||
|
Loading…
Reference in New Issue
Block a user