top: CPU usage column width fixes -- thanks Tony Ernst

This commit is contained in:
albert 2006-06-17 05:20:01 +00:00
parent 6e91ded9ff
commit 89ed9ba210
2 changed files with 15 additions and 8 deletions

1
NEWS
View File

@ -2,6 +2,7 @@ procps-3.2.6 --> procps-3.2.7
top: document H option -- thanks Tony Ernst top: document H option -- thanks Tony Ernst
top: terabytes -- thanks Tony Ernst top: terabytes -- thanks Tony Ernst
top: CPU usage column width fixes -- thanks Tony Ernst
ps: SCHED_BATCH is B ps: SCHED_BATCH is B
ps: fix s format (signals) output with thread display ps: fix s format (signals) output with thread display
watch: avoid integer overflow for the time delay watch: avoid integer overflow for the time delay

22
top.c
View File

@ -1608,15 +1608,7 @@ static void before (char *me)
page_to_kb_shift++; 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; 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].head = " P";
Fieldstab[P_CPN].fmts = " %1u"; Fieldstab[P_CPN].fmts = " %1u";
@ -1775,6 +1767,12 @@ static void configs_read (void)
confighlp(Winstk[i].rc.fieldscur); 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 // lastly, establish the true runtime secure mode and delay time
if (!getuid()) Secure_mode = 0; if (!getuid()) Secure_mode = 0;
if (!Secure_mode) Rc.delay_time = delay; if (!Secure_mode) Rc.delay_time = delay;
@ -2607,6 +2605,14 @@ static void do_key (unsigned c)
Rc.mode_irixps = !Rc.mode_irixps; Rc.mode_irixps = !Rc.mode_irixps;
show_msg(fmtmk("Irix mode %s", Rc.mode_irixps ? "On" : "Off")); show_msg(fmtmk("Irix mode %s", Rc.mode_irixps ? "On" : "Off"));
#endif #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; break;
case 'k': case 'k':