Content deleted Content added
Artoria2e5 (talk | contribs) |
Artoria2e5 (talk | contribs) |
||
Line 35:
== Reckoning CPU load ==
On Linux systems, the load-average is not calculated on each clock tick, but driven by a variable value that is based on the HZ frequency setting and tested on each clock tick.
<source lang="c">
Line 55:
}
</source>
The avenrun array contains 1-minute, 5-minute and 15-minute average. The {{code|CALC_LOAD}} macro and its associated values are defined in sched.h:
Line 69 ⟶ 61:
#define FSHIFT 11 /* nr of bits of precision */
#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
#define LOAD_FREQ (5*HZ+1) /* 5 sec intervals */
#define EXP_1 1884 /* 1/exp(5sec/1min) as fixed-point */
#define EXP_5 2014 /* 1/exp(5sec/5min) */
Line 79 ⟶ 71:
load >>= FSHIFT;
</source>
The "sampled" calculation of load averages is a somewhat common behavior; FreeBSD, too, only refereshes the value every five seconds. The interval is usually taken to not be exact so that they do not collect processes that are scheduled to fire at a certain moment.<ref>{{cite web |title=How is load average calculated on FreeBSD? |url=https://unix.stackexchange.com/a/342778 |website=Unix & Linux Stack Exchange}}</ref> A post on the Linux mailing list considers the {{tt|+1}} tick insufficient to avoid such collection, and suggests an interval of 4.61 seconds instead.<ref>{{cite web |last1=Ripke |first1=Klaus |title=Linux-Kernel Archive: LOAD_FREQ (4*HZ+61) avoids loadavg Moire |url=http://lkml.iu.edu/hypermail/linux/kernel/1111.1/02446.html |website=lkml.iu.edu |date=2011}}</ref>
==Other system performance commands==
|