+struct loadavg averunnable =
+ { {0, 0, 0}, FSCALE }; /* load average, of runnable procs */
+/*
+ * Constants for averages over 1, 5, and 15 minutes
+ * when sampling at 5 second intervals.
+ */
+static fixpt_t cexp[3] = {
+ (fixpt_t)(0.9200444146293232 * FSCALE), /* exp(-1/12) */
+ (fixpt_t)(0.9834714538216174 * FSCALE), /* exp(-1/60) */
+ (fixpt_t)(0.9944598480048967 * FSCALE), /* exp(-1/180) */
+};
+
+void
+compute_averunnable(
+ register int nrun)
+{
+ register int i;
+ struct loadavg *avg = &averunnable;
+
+ for (i = 0; i < 3; i++)
+ avg->ldavg[i] = (cexp[i] * avg->ldavg[i] +
+ nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT;
+}