MCPcopy Create free account
hub / github.com/F-Stack/f-stack / loadav

Function loadav

freebsd/kern/kern_synch.c:608–629  ·  view source on GitHub ↗

* Compute a tenex style load average of a quantity on * 1, 5 and 15 minute intervals. */

Source from the content-addressed store, hash-verified

606 * 1, 5 and 15 minute intervals.
607 */
608static void
609loadav(void *arg)
610{
611 int i, nrun;
612 struct loadavg *avg;
613
614 nrun = sched_load();
615 avg = &averunnable;
616
617 for (i = 0; i < 3; i++)
618 avg->ldavg[i] = (cexp[i] * avg->ldavg[i] +
619 nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT;
620
621 /*
622 * Schedule the next update to occur after 5 seconds, but add a
623 * random variation to avoid synchronisation with processes that
624 * run at regular intervals.
625 */
626 callout_reset_sbt(&loadav_callout,
627 SBT_1US * (4000000 + (int)(random() % 2000001)), SBT_1US,
628 loadav, NULL, C_DIRECT_EXEC | C_PREL(32));
629}
630
631/* ARGSUSED */
632static void

Callers 1

synch_setupFunction · 0.85

Calls 2

sched_loadFunction · 0.70
randomFunction · 0.50

Tested by

no test coverage detected