aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-01-25 12:48:47 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-01-25 12:48:47 +0100
commit9aa599dc9dc076f6fa6e4312e4750a703cf16450 (patch)
treee5eba850b0f6cb53dc7077237ee640be98160cce /procps
parent9b3b9790b32d440eb89af5edda70a66b1829e861 (diff)
downloadbusybox-w32-9aa599dc9dc076f6fa6e4312e4750a703cf16450.tar.gz
busybox-w32-9aa599dc9dc076f6fa6e4312e4750a703cf16450.tar.bz2
busybox-w32-9aa599dc9dc076f6fa6e4312e4750a703cf16450.zip
top: replace %MEM with %VSZ in header text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/top.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/procps/top.c b/procps/top.c
index d7cc9af1b..ee6555188 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -19,9 +19,9 @@
19 * 19 *
20 * Sept 2008: Vineet Gupta <vineet.gupta@arc.com> 20 * Sept 2008: Vineet Gupta <vineet.gupta@arc.com>
21 * Added Support for reporting SMP Information 21 * Added Support for reporting SMP Information
22 * - CPU where Process was last seen running 22 * - CPU where process was last seen running
23 * (to see effect of sched_setaffinity() etc) 23 * (to see effect of sched_setaffinity() etc)
24 * - CPU Time Split (idle/IO/wait etc) PER CPU 24 * - CPU time split (idle/IO/wait etc) per CPU
25 * 25 *
26 * Copyright (c) 1992 Branko Lankester 26 * Copyright (c) 1992 Branko Lankester
27 * Copyright (c) 1992 Roger Binns 27 * Copyright (c) 1992 Roger Binns
@@ -30,14 +30,24 @@
30 * 30 *
31 * Licensed under GPLv2, see file LICENSE in this source tree. 31 * Licensed under GPLv2, see file LICENSE in this source tree.
32 */ 32 */
33/* Howto snapshot /proc for debugging top problems: 33/* How to snapshot /proc for debugging top problems:
34 * for f in /proc/[0-9]*""/stat; do 34 * for f in /proc/[0-9]*""/stat; do
35 * n=${f#/proc/} 35 * n=${f#/proc/}
36 * n=${n%/stat}_stat 36 * n=${n%/stat}_stat
37 * cp $f $n 37 * cp $f $n
38 * done 38 * done
39 * cp /proc/stat /proc/meminfo . 39 * cp /proc/stat /proc/meminfo /proc/loadavg .
40 * top -bn1 >top.out 40 * top -bn1 >top.out
41 *
42 * ...and how to run top on it on another machine:
43 * rm -rf proc; mkdir proc
44 * for f in [0-9]*_stat; do
45 * p=${f%_stat}
46 * mkdir -p proc/$p
47 * cp $f proc/$p/stat
48 * done
49 * cp stat meminfo loadavg proc
50 * chroot . ./top -bn1 >top1.out
41 */ 51 */
42 52
43#include "libbb.h" 53#include "libbb.h"
@@ -528,7 +538,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
528 538
529 /* what info of the processes is shown */ 539 /* what info of the processes is shown */
530 printf(OPT_BATCH_MODE ? "%.*s" : "\033[7m%.*s\033[0m", scr_width, 540 printf(OPT_BATCH_MODE ? "%.*s" : "\033[7m%.*s\033[0m", scr_width,
531 " PID PPID USER STAT VSZ %MEM" 541 " PID PPID USER STAT VSZ %VSZ"
532 IF_FEATURE_TOP_SMP_PROCESS(" CPU") 542 IF_FEATURE_TOP_SMP_PROCESS(" CPU")
533 IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU") 543 IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU")
534 " COMMAND"); 544 " COMMAND");
@@ -546,7 +556,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
546# define FMT "%4u%%" 556# define FMT "%4u%%"
547#endif 557#endif
548 /* 558 /*
549 * MEM% = s->vsz/MemTotal 559 * %VSZ = s->vsz/MemTotal
550 */ 560 */
551 pmem_shift = BITS_PER_INT-11; 561 pmem_shift = BITS_PER_INT-11;
552 pmem_scale = UPSCALE*(1U<<(BITS_PER_INT-11)) / total_memory; 562 pmem_scale = UPSCALE*(1U<<(BITS_PER_INT-11)) / total_memory;
@@ -606,7 +616,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
606 sprintf(vsz_str_buf, "%6ldm", s->vsz/1024); 616 sprintf(vsz_str_buf, "%6ldm", s->vsz/1024);
607 else 617 else
608 sprintf(vsz_str_buf, "%7ld", s->vsz); 618 sprintf(vsz_str_buf, "%7ld", s->vsz);
609 /* PID PPID USER STAT VSZ %MEM [%CPU] COMMAND */ 619 /* PID PPID USER STAT VSZ %VSZ [%CPU] COMMAND */
610 col = snprintf(line_buf, scr_width, 620 col = snprintf(line_buf, scr_width,
611 "\n" "%5u%6u %-8.8s %s%s" FMT 621 "\n" "%5u%6u %-8.8s %s%s" FMT
612 IF_FEATURE_TOP_SMP_PROCESS(" %3d") 622 IF_FEATURE_TOP_SMP_PROCESS(" %3d")