do not expand cpu percentages, only compress them
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 14 Aug 1985 02:08:24 +0000 (18:08 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 14 Aug 1985 02:08:24 +0000 (18:08 -0800)
SCCS-vsn: usr.bin/systat/pigs.c 5.3

usr/src/usr.bin/systat/pigs.c

index cbee767..df4450f 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)pigs.c     5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)pigs.c     5.3 (Berkeley) %G%";
 #endif not lint
 
 /*
 #endif not lint
 
 /*
@@ -73,12 +73,14 @@ showpigs()
                 ptptr++;
         }
 
                 ptptr++;
         }
 
-        pt[numprocs].pt_pctcpu = total / (1.0 - idle) * idle;
-       total += pt[numprocs].pt_pctcpu;
+        pt[numprocs].pt_pctcpu = idle;
+       total += idle;
         pt[numprocs].pt_uid = -1;
         pt[numprocs].pt_pid = -1;
         pt[numprocs].pt_pp = NULL;
 
         pt[numprocs].pt_uid = -1;
         pt[numprocs].pt_pid = -1;
         pt[numprocs].pt_pp = NULL;
 
+       if (total < 1.0)
+               total = 1.0;
         factor = 50.0/total;
 
         /* Find the top few by executing a "bubble pass" ten times. */
         factor = 50.0/total;
 
         /* Find the top few by executing a "bubble pass" ten times. */