procps/procps-ng-3.3.10-large_pcpu.patch

40 lines
1.4 KiB
Diff
Raw Normal View History

--- top/top.c
+++ top/top.c 2015-01-27 15:25:34.329519296 +0000
@@ -2302,8 +2302,15 @@ static void zap_fieldstab (void) {
Fieldstab[EU_CPU].width = 5;
if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus;
- if (smp_num_cpus > 10) {
+ if (smp_num_cpus > 1000) {
+ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
+ Fieldstab[EU_CPU].width = 8;
+ } else if (smp_num_cpus > 100) {
+ if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0;
+ Fieldstab[EU_CPU].width = 7;
+ } else if (smp_num_cpus > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
+ Fieldstab[EU_CPU].width = 6;
} else {
if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;
}
@@ -2313,12 +2320,18 @@ static void zap_fieldstab (void) {
Fieldstab[EU_CPU].width = 4;
if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus;
+ if (smp_num_cpus > 1000) {
+ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
+ Fieldstab[EU_CPU].width = 7;
+ } else if (smp_num_cpus > 100) {
+ if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0;
+ Fieldstab[EU_CPU].width = 6;
if (smp_num_cpus > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
+ Fieldstab[EU_CPU].width = 5;
} else {
if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;
}
- Fieldstab[EU_CPU].width = 5;
}
#endif