* Compute a tenex style load average of a quantity on * 1, 5 and 15 minute intervals. */
| 606 | * 1, 5 and 15 minute intervals. |
| 607 | */ |
| 608 | static void |
| 609 | loadav(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 */ |
| 632 | static void |
no test coverage detected