diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-03-04 06:58:13 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-03-04 06:58:13 +0000 |
commit | fd9e124cb85a6b966dde003f7172928a15938332 (patch) | |
tree | 402e34b76c7706555c117a5ee949c21414b38d47 | |
parent | fd62d65e5f8853059be1e74a932d8ab0c43cb2ca (diff) |
Show the CPU state %'s on first display as well. "looks good" deraadt@
-rw-r--r-- | usr.bin/top/display.c | 30 | ||||
-rw-r--r-- | usr.bin/top/display.h | 3 | ||||
-rw-r--r-- | usr.bin/top/top.c | 16 |
3 files changed, 4 insertions, 45 deletions
diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c index 2214ba759fa..4877757e816 100644 --- a/usr.bin/top/display.c +++ b/usr.bin/top/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.22 2005/07/01 19:33:35 jaredy Exp $ */ +/* $OpenBSD: display.c,v 1.23 2006/03/04 06:58:11 otto Exp $ */ /* * Top users/processes display for Unix @@ -487,34 +487,6 @@ u_cpustates(int64_t *ostates) } } -void -z_cpustates(void) -{ - char **names, *thisname; - int cpu, i; - int64_t *lp; - - for (cpu = 0; cpu < ncpu; cpu++) { - /* show tag and bump lastline */ - printf("\n%s", cpustates_tag(cpu)); - lastline++; - - names = cpustate_names; - i = 0; - while ((thisname = *names++) != NULL) { - if (*thisname != '\0') - printf("%s %% %s", i++ == 0 ? "" : ", ", - thisname); - } - - /* fill the "last" array with all -1s, to ensure correct updating */ - lp = lcpustates[cpu]; - i = num_cpustates; - while (--i >= 0) - *lp++ = -1; - } -} - static char memory_buffer[MAX_COLS]; /* diff --git a/usr.bin/top/display.h b/usr.bin/top/display.h index 643efecc3e3..ffa9dc899da 100644 --- a/usr.bin/top/display.h +++ b/usr.bin/top/display.h @@ -1,4 +1,4 @@ -/* $OpenBSD: display.h,v 1.7 2005/06/08 22:36:43 millert Exp $ */ +/* $OpenBSD: display.h,v 1.8 2006/03/04 06:58:12 otto Exp $ */ /* * Top users/processes display for Unix @@ -42,7 +42,6 @@ extern void i_procstates(int, int *); extern void u_procstates(int, int *); extern void i_cpustates(int64_t *); extern void u_cpustates(int64_t *); -extern void z_cpustates(void); extern void i_memory(int *); extern void u_memory(int *); extern void i_message(void); diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index 3ebe661bba1..7bd0c49cbe3 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -1,4 +1,4 @@ -/* $OpenBSD: top.c,v 1.42 2006/03/04 06:54:18 otto Exp $ */ +/* $OpenBSD: top.c,v 1.43 2006/03/04 06:58:12 otto Exp $ */ /* * Top users/processes display for Unix @@ -89,7 +89,6 @@ void (*d_process)(int, char *) = i_process; int displays = 0; /* indicates unspecified */ char do_unames = Yes; struct process_select ps; -char dostates = No; char interactive = Maybe; char warnings = 0; double delay = Default_DELAY; @@ -428,18 +427,7 @@ restart: (*d_procstates)(system_info.p_total, system_info.procstates); /* display the cpu state percentage breakdown */ - if (dostates) { /* but not the first time */ - (*d_cpustates)(system_info.cpustates); - } else { - /* we'll do it next time */ - if (smart_terminal) - z_cpustates(); - else { - if (putchar('\n') == EOF) - exit(1); - } - dostates = Yes; - } + (*d_cpustates)(system_info.cpustates); /* display memory stats */ (*d_memory)(system_info.memory); |