diff options
author | jhb <jhb@FreeBSD.org> | 2011-07-11 16:48:52 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2011-07-11 16:48:52 +0000 |
commit | 67900f72b1f7180ab693e92eae0c8c4381f5dabc (patch) | |
tree | 24dbd2ed39f324b805699359b163b92f96dd4012 /contrib/top/display.c | |
parent | cf995996ab105668883720bd5e270c8494278403 (diff) | |
download | FreeBSD-src-67900f72b1f7180ab693e92eae0c8c4381f5dabc.zip FreeBSD-src-67900f72b1f7180ab693e92eae0c8c4381f5dabc.tar.gz |
Allow per-CPU statistics to be toggled at runtime via the 'P' key.
While here, make -P a toggle similar to other options such as -I.
Reviewed by: arundel
MFC after: 1 week
Diffstat (limited to 'contrib/top/display.c')
-rw-r--r-- | contrib/top/display.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/contrib/top/display.c b/contrib/top/display.c index 8d89d82..a5a4e9e 100644 --- a/contrib/top/display.c +++ b/contrib/top/display.c @@ -151,16 +151,14 @@ int display_resize() return(smart_terminal ? lines : Largest); } -int display_init(statics) +int display_updatecpus(statics) struct statics *statics; { register int lines; - register char **pp; - register int *ip; register int i; - + /* call resize to do the dirty work */ lines = display_resize(); num_cpus = statics->ncpus; @@ -170,6 +168,21 @@ struct statics *statics; for (i = num_cpus; i > 9; i /= 10) cpustates_column++; + return(lines); +} + +int display_init(statics) + +struct statics *statics; + +{ + register int lines; + register char **pp; + register int *ip; + register int i; + + lines = display_updatecpus(statics); + /* only do the rest if we need to */ if (lines > -1) { |