powerd - Fix load factor calculation bug for niced processes
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 18 Apr 2013 17:17:49 +0000 (10:17 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 18 Apr 2013 17:17:49 +0000 (10:17 -0700)
* A type-o in the load calculation code was not counting niced
  processes at all, so if you have a lot of niced processes
  (like ffmpeg's which nice themselves down), powerd can wind
  up restricting them all to a single cpu.  Doh!

usr.sbin/powerd/powerd.c

index 7822adc..0a48c3f 100644 (file)
@@ -248,7 +248,7 @@ getcputime(void)
                delta += (ncpu_time[cpu].cp_user + ncpu_time[cpu].cp_sys +
                          ncpu_time[cpu].cp_nice + ncpu_time[cpu].cp_intr) -
                         (ocpu_time[cpu].cp_user + ocpu_time[cpu].cp_sys +
-                         ncpu_time[cpu].cp_nice + ocpu_time[cpu].cp_intr);
+                         ocpu_time[cpu].cp_nice + ocpu_time[cpu].cp_intr);
        }
        return((double)delta / 1000000.0);
 }