fix %CPU max on 2..9 CPU SMP -- thanks Ga*tan LEURENT
authoralbert <>
Mon, 12 Sep 2005 01:27:59 +0000 (01:27 +0000)
committeralbert <>
Mon, 12 Sep 2005 01:27:59 +0000 (01:27 +0000)
NEWS
TODO
top.c

diff --git a/NEWS b/NEWS
index cd5d2775357044a85a99f799d2f92dacb7956eef..b0384d75829442d4b888143e3fd1a9ef8c7b5353 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ procps-3.2.5 --> procps-3.2.6
 top can do per-task display -- thanks John Blackwood     rh114012
 more MIPS crud  -- thanks Jim Gifford and Ryan Oliver
 begin prep for setuid
+top: fix %CPU max on 2..9 CPU SMP -- thanks Ga*tan LEURENT
 
 procps-3.2.4 --> procps-3.2.5
 
diff --git a/TODO b/TODO
index 9efae80c6e195a65297a539e3c65d067b311e7d4..0fd07c64d25f10cec6dae77b0f256c99f874f571 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,7 @@
 -------------------------- general ------------------------
 
+Consider using glibc obstacks for memory allocation.
+
 Implement /usr/proc/bin tools like Solaris has.
 The prstat command is interesting, like top in batch mode.
 SCO has a pstat command.
@@ -56,12 +58,6 @@ units: kB and pages, seconds and jiffies) in the proc_t struct.
 
 Share more stuff with ps.
 
-'H' command (shows threads)
-
-Adjust PID-like and PSR-like columns to fit the data.
-The normal PID limit is 5 digits; it can go up to 10.
-The normal CPU limit is 1 digit; it can go to 3 or 4.
-
 don't truncate long usernames
 
 have a --config option
diff --git a/top.c b/top.c
index de83c3dee508e4a87c0bb57defc57c39e7c73f9d..fb0a1f4308b24266e29b25b944cc53baa925eea7 100644 (file)
--- a/top.c
+++ b/top.c
@@ -1605,20 +1605,21 @@ static void before (char *me)
      page_to_kb_shift++;
    }
 
-   Fieldstab[P_CPU].head = " %CPU";
-   Fieldstab[P_CPU].fmts = " %#4.1f";
+// 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";
    if(smp_num_cpus>9){
       Fieldstab[P_CPN].head = "  P";
       Fieldstab[P_CPN].fmts = " %2u";
-      if(Rc.mode_irixps){
-         // this will do for up to 999; hopefully a 1024-node box
-         // will have at least 2.4% idle time
-         pcpu_max_value = 9999.0;
-         Fieldstab[P_CPU].fmts = " %4.0f";
-      }
    }
    if(smp_num_cpus>99){
       Fieldstab[P_CPN].head = "   P";