diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-03 11:55:31 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-03 11:55:31 +0000 |
commit | 7886275c982286e69fef12236d119ca39b831cec (patch) | |
tree | e226f3e0c7a55166d4eb5d5782cd146964416246 | |
parent | 7e0c243ad53c8e6a56250ebf9d43edd6683ae1ac (diff) | |
download | busybox-w32-7886275c982286e69fef12236d119ca39b831cec.tar.gz busybox-w32-7886275c982286e69fef12236d119ca39b831cec.tar.bz2 busybox-w32-7886275c982286e69fef12236d119ca39b831cec.zip |
top: make it work again on 2.4 kernels (closes bug 125)
-rw-r--r-- | procps/top.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/procps/top.c b/procps/top.c index 8c58b909d..b5951422b 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -50,7 +50,9 @@ typedef struct top_status_t { | |||
50 | } top_status_t; | 50 | } top_status_t; |
51 | 51 | ||
52 | typedef struct jiffy_counts_t { | 52 | typedef struct jiffy_counts_t { |
53 | unsigned long long usr,nic,sys,idle,iowait,irq,softirq,steal; | 53 | /* Linux 2.4.x has only first four */ |
54 | unsigned long long usr, nic, sys, idle; | ||
55 | unsigned long long iowait, irq, softirq, steal; | ||
54 | unsigned long long total; | 56 | unsigned long long total; |
55 | unsigned long long busy; | 57 | unsigned long long busy; |
56 | } jiffy_counts_t; | 58 | } jiffy_counts_t; |
@@ -179,15 +181,12 @@ static int mult_lvl_cmp(void* a, void* b) | |||
179 | return 0; | 181 | return 0; |
180 | } | 182 | } |
181 | 183 | ||
182 | /* NOINLINE so that complier doesn't unfold the call | ||
183 | * causing multiple copies of the arithmatic instrns | ||
184 | */ | ||
185 | static NOINLINE int read_cpu_jiffy(FILE *fp, jiffy_counts_t *p_jif) | 184 | static NOINLINE int read_cpu_jiffy(FILE *fp, jiffy_counts_t *p_jif) |
186 | { | 185 | { |
187 | #if !ENABLE_FEATURE_TOP_SMP_CPU | 186 | #if !ENABLE_FEATURE_TOP_SMP_CPU |
188 | static const char fmt[] = "cpu %lld %lld %lld %lld %lld %lld %lld %lld"; | 187 | static const char fmt[] = "cpu %llu %llu %llu %llu %llu %llu %llu %llu"; |
189 | #else | 188 | #else |
190 | static const char fmt[] = "cp%*s %lld %lld %lld %lld %lld %lld %lld %lld"; | 189 | static const char fmt[] = "cp%*s %llu %llu %llu %llu %llu %llu %llu %llu"; |
191 | #endif | 190 | #endif |
192 | int ret; | 191 | int ret; |
193 | 192 | ||
@@ -197,7 +196,7 @@ static NOINLINE int read_cpu_jiffy(FILE *fp, jiffy_counts_t *p_jif) | |||
197 | &p_jif->usr, &p_jif->nic, &p_jif->sys, &p_jif->idle, | 196 | &p_jif->usr, &p_jif->nic, &p_jif->sys, &p_jif->idle, |
198 | &p_jif->iowait, &p_jif->irq, &p_jif->softirq, | 197 | &p_jif->iowait, &p_jif->irq, &p_jif->softirq, |
199 | &p_jif->steal); | 198 | &p_jif->steal); |
200 | if (ret > 4) { | 199 | if (ret >= 4) { |
201 | p_jif->total = p_jif->usr + p_jif->nic + p_jif->sys + p_jif->idle | 200 | p_jif->total = p_jif->usr + p_jif->nic + p_jif->sys + p_jif->idle |
202 | + p_jif->iowait + p_jif->irq + p_jif->softirq + p_jif->steal; | 201 | + p_jif->iowait + p_jif->irq + p_jif->softirq + p_jif->steal; |
203 | /* procps 2.x does not count iowait as busy time */ | 202 | /* procps 2.x does not count iowait as busy time */ |