1
2#ifndef _LINUX_SCHED_LOADAVG_H
3#define _LINUX_SCHED_LOADAVG_H
4
5
6
7
8
9
10
11
12
13
14
15extern unsigned long avenrun[];
16extern void get_avenrun(unsigned long *loads, unsigned long offset, int shift);
17
18#define FSHIFT 11
19#define FIXED_1 (1<<FSHIFT)
20#define LOAD_FREQ (5*HZ+1)
21#define EXP_1 1884
22#define EXP_5 2014
23#define EXP_15 2037
24
25
26
27
28static inline unsigned long
29calc_load(unsigned long load, unsigned long exp, unsigned long active)
30{
31 unsigned long newload;
32
33 newload = load * exp + active * (FIXED_1 - exp);
34 if (active >= load)
35 newload += FIXED_1-1;
36
37 return newload / FIXED_1;
38}
39
40extern unsigned long calc_load_n(unsigned long load, unsigned long exp,
41 unsigned long active, unsigned int n);
42
43#define LOAD_INT(x) ((x) >> FSHIFT)
44#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
45
46extern void calc_global_load(void);
47
48#endif
49