top: CPU usage column width fixes -- thanks Tony Ernst
authoralbert <>
Sat, 17 Jun 2006 05:20:01 +0000 (05:20 +0000)
committeralbert <>
Sat, 17 Jun 2006 05:20:01 +0000 (05:20 +0000)
NEWS
top.c

diff --git a/NEWS b/NEWS
index eab85dd88ad2e4045860ab841c45e8249d3aa895..af34e58098cc497acb32f2b5f6d3654d6619df36 100644 (file)
--- 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 86587f19de33d21d7c5bf0bcda5da6897481affa..4846db938d3490ada8554dc3588d23cb803b3304 100644 (file)
--- 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':