aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-01-25 01:57:31 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-01-25 01:57:31 +0100
commit444ff284c4097081108e0eded4711247aacda740 (patch)
treec55401fc09172ff24a53718c45dc34033ac0b4bc
parent975c7141831aa6bf8d9abcafd1e5a9e108a910fc (diff)
downloadbusybox-w32-444ff284c4097081108e0eded4711247aacda740.tar.gz
busybox-w32-444ff284c4097081108e0eded4711247aacda740.tar.bz2
busybox-w32-444ff284c4097081108e0eded4711247aacda740.zip
top: document a debugging script
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--procps/top.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/procps/top.c b/procps/top.c
index 1eb33dc5d..d7cc9af1b 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -30,6 +30,15 @@
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:
34 * for f in /proc/[0-9]*""/stat; do
35 * n=${f#/proc/}
36 * n=${n%/stat}_stat
37 * cp $f $n
38 * done
39 * cp /proc/stat /proc/meminfo .
40 * top -bn1 >top.out
41 */
33 42
34#include "libbb.h" 43#include "libbb.h"
35 44
@@ -546,7 +555,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
546 pmem_scale /= 4; 555 pmem_scale /= 4;
547 pmem_shift -= 2; 556 pmem_shift -= 2;
548 } 557 }
549 pmem_half = (1U << pmem_shift) / (ENABLE_FEATURE_TOP_DECIMALS? 20 : 2); 558 pmem_half = (1U << pmem_shift) / (ENABLE_FEATURE_TOP_DECIMALS ? 20 : 2);
550#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE 559#if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
551 busy_jifs = cur_jif.busy - prev_jif.busy; 560 busy_jifs = cur_jif.busy - prev_jif.busy;
552 /* This happens if there were lots of short-lived processes 561 /* This happens if there were lots of short-lived processes
@@ -577,7 +586,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
577 pcpu_scale /= 4; 586 pcpu_scale /= 4;
578 pcpu_shift -= 2; 587 pcpu_shift -= 2;
579 } 588 }
580 pcpu_half = (1U << pcpu_shift) / (ENABLE_FEATURE_TOP_DECIMALS? 20 : 2); 589 pcpu_half = (1U << pcpu_shift) / (ENABLE_FEATURE_TOP_DECIMALS ? 20 : 2);
581 /* printf(" pmem_scale=%u pcpu_scale=%u ", pmem_scale, pcpu_scale); */ 590 /* printf(" pmem_scale=%u pcpu_scale=%u ", pmem_scale, pcpu_scale); */
582#endif 591#endif
583 592