diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-08-11 16:17:11 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-08-11 16:17:11 +0200 |
commit | ac78f2ac96b3efd6551a08e7dc609efa1fb69481 (patch) | |
tree | 22f335ab03a19a134ce645cade80eabf9e575ebd | |
parent | 4f70a32f46f12af59b71e869348dc5db9d0bd930 (diff) | |
download | busybox-w32-ac78f2ac96b3efd6551a08e7dc609efa1fb69481.tar.gz busybox-w32-ac78f2ac96b3efd6551a08e7dc609efa1fb69481.tar.bz2 busybox-w32-ac78f2ac96b3efd6551a08e7dc609efa1fb69481.zip |
top: do not use previous colleced data wheh "h" toggles threads display
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.c | 5 |
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) | |||
979 | IF_FEATURE_TOPMEM(&& scan_mask != TOPMEM_MASK) | 979 | IF_FEATURE_TOPMEM(&& scan_mask != TOPMEM_MASK) |
980 | ) { | 980 | ) { |
981 | scan_mask ^= PSSCAN_TASKS; | 981 | scan_mask ^= PSSCAN_TASKS; |
982 | free(prev_hist); | ||
983 | prev_hist = NULL; | ||
984 | prev_hist_count = 0; | ||
982 | continue; | 985 | continue; |
983 | } | 986 | } |
984 | # endif | 987 | # endif |
@@ -1000,10 +1003,10 @@ static unsigned handle_input(unsigned scan_mask, duration_t interval) | |||
1000 | # if ENABLE_FEATURE_TOPMEM | 1003 | # if ENABLE_FEATURE_TOPMEM |
1001 | if (c == 's') { | 1004 | if (c == 's') { |
1002 | scan_mask = TOPMEM_MASK; | 1005 | scan_mask = TOPMEM_MASK; |
1006 | sort_field = (sort_field + 1) % NUM_SORT_FIELD; | ||
1003 | free(prev_hist); | 1007 | free(prev_hist); |
1004 | prev_hist = NULL; | 1008 | prev_hist = NULL; |
1005 | prev_hist_count = 0; | 1009 | prev_hist_count = 0; |
1006 | sort_field = (sort_field + 1) % NUM_SORT_FIELD; | ||
1007 | continue; | 1010 | continue; |
1008 | } | 1011 | } |
1009 | # endif | 1012 | # endif |