Load (computing) - Reckoning CPU Load

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. (Hz variable is the pulse rate of particular Linux kernel activity. 1Hz is equal to one clock tick; 10ms by default.) Although the Hz value can be configured in some versions of the kernel, it is normally set to 100. The calculation code uses the Hz value to determine the CPU Load calculation frequency. Specifically, the timer.c::calc_load function will run the algorithm every 5 * Hz, or roughly every five seconds. Following is that function in its entirety:

unsigned long avenrun; static inline void calc_load(unsigned long ticks) { unsigned long active_tasks; /* fixed-point */ static int count = LOAD_FREQ; count -= ticks; if (count < 0) { count += LOAD_FREQ; active_tasks = count_active_tasks; CALC_LOAD(avenrun, EXP_1, active_tasks); CALC_LOAD(avenrun, EXP_5, active_tasks); CALC_LOAD(avenrun, EXP_15, active_tasks); } }

The avenrun array contains 1-minute, 5-minute and 15-minute average. The CALC_LOAD macro and its associated values are defined in sched.h :

#define FSHIFT 11 /* nr of bits of precision */ #define FIXED_1 (1<>= FSHIFT;

Read more about this topic:  Load (computing)

Famous quotes containing the words reckoning and/or load:

    He wasn’t off a mere degree;
    His reckoning was off a sea.
    Robert Frost (1874–1963)

    Rich are the sea-gods:Mwho gives gifts but they?
    They grope the sea for pearls, but more than pearls:
    They pluck Force thence, and give it to the wise.
    Every wave is wealth to Daedalus,
    Wealth to the cunning artist who can work
    This matchless strength. Where shall he find, O waves!
    A load your Atlas shoulders cannot lift?
    Ralph Waldo Emerson (1803–1882)