aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Denys Vlasenko <vda.linux@googlemail.com>2019-08-11 16:17:11 +0200
committerGravatar Denys Vlasenko <vda.linux@googlemail.com>2019-08-11 16:17:11 +0200
commitac78f2ac96b3efd6551a08e7dc609efa1fb69481 (patch)
tree22f335ab03a19a134ce645cade80eabf9e575ebd
parent4f70a32f46f12af59b71e869348dc5db9d0bd930 (diff)
downloadbusybox-ac78f2ac96b3efd6551a08e7dc609efa1fb69481.tar.gz
busybox-ac78f2ac96b3efd6551a08e7dc609efa1fb69481.tar.bz2
top: do not use previous colleced data wheh "h" toggles threads displayHEADmaster
This prevents first update from showing incorrect CPU usage data function old new delta handle_input 620 643 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--procps/top.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/procps/top.c b/procps/top.c
index 8fe53324f..5c41e8e10 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -979,6 +979,9 @@ static unsigned handle_input(unsigned scan_mask, duration_t interval)
IF_FEATURE_TOPMEM(&& scan_mask != TOPMEM_MASK)
) {
scan_mask ^= PSSCAN_TASKS;
+ free(prev_hist);
+ prev_hist = NULL;
+ prev_hist_count = 0;
continue;
}
# endif
@@ -1000,10 +1003,10 @@ static unsigned handle_input(unsigned scan_mask, duration_t interval)
# if ENABLE_FEATURE_TOPMEM
if (c == 's') {
scan_mask = TOPMEM_MASK;
+ sort_field = (sort_field + 1) % NUM_SORT_FIELD;
free(prev_hist);
prev_hist = NULL;
prev_hist_count = 0;
- sort_field = (sort_field + 1) % NUM_SORT_FIELD;
continue;
}
# endif