diff --git a/NEWS b/NEWS index eab85dd8..af34e580 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ procps-3.2.6 --> procps-3.2.7 top: document H option -- thanks Tony Ernst top: terabytes -- thanks Tony Ernst +top: CPU usage column width fixes -- thanks Tony Ernst ps: SCHED_BATCH is B ps: fix s format (signals) output with thread display watch: avoid integer overflow for the time delay diff --git a/top.c b/top.c index 86587f19..4846db93 100644 --- a/top.c +++ b/top.c @@ -1608,15 +1608,7 @@ static void before (char *me) page_to_kb_shift++; } -// commented out because it is redundant with the table content -// Fieldstab[P_CPU].head = " %CPU"; -// Fieldstab[P_CPU].fmts = " %#4.1f"; pcpu_max_value = 99.9; - if(Rc.mode_irixps && smp_num_cpus>1){ - // good for 100 CPUs per process - pcpu_max_value = 9999.0; - Fieldstab[P_CPU].fmts = " %4.0f"; - } Fieldstab[P_CPN].head = " P"; Fieldstab[P_CPN].fmts = " %1u"; @@ -1775,6 +1767,12 @@ static void configs_read (void) confighlp(Winstk[i].rc.fieldscur); } + if(Rc.mode_irixps && smp_num_cpus>1){ + // good for 100 CPUs per process + pcpu_max_value = 9999.0; + Fieldstab[P_CPU].fmts = " %4.0f"; + } + // lastly, establish the true runtime secure mode and delay time if (!getuid()) Secure_mode = 0; if (!Secure_mode) Rc.delay_time = delay; @@ -2607,6 +2605,14 @@ static void do_key (unsigned c) Rc.mode_irixps = !Rc.mode_irixps; show_msg(fmtmk("Irix mode %s", Rc.mode_irixps ? "On" : "Off")); #endif + if(Rc.mode_irixps && smp_num_cpus>1){ + // good for 100 CPUs per process + pcpu_max_value = 9999.0; + Fieldstab[P_CPU].fmts = " %4.0f"; + } else { + pcpu_max_value = 99.9; + Fieldstab[P_CPU].fmts = " %#4.1f"; + } break; case 'k':