xref: /freebsd/usr.bin/top/loadavg.h (revision 4928135658a9d0eaee37003df6137ab363fcb0b4)
1 /*
2  *  Top - a top users display for Berkeley Unix
3  *
4  *  Defines required to access load average figures.
5  *
6  *  This include file sets up everything we need to access the load average
7  *  values in the kernel in a machine independent way.  First, it sets the
8  *  typedef "load_avg" to be either double or long (depending on what is
9  *  needed), then it defines these macros appropriately:
10  *
11  *	loaddouble(la) - convert load_avg to double.
12  *	intload(i)     - convert integer to load_avg.
13  *
14  *	$FreeBSD$
15  */
16 
17 #define FIXED_LOADAVG FSCALE
18 #define FIXED_PCTCPU FSCALE
19 
20 typedef long pctcpu;
21 #define pctdouble(p) ((double)(p) / FIXED_PCTCPU)
22 
23 typedef fixpt_t load_avg;
24 #define loaddouble(la) ((double)(la) / FIXED_LOADAVG)
25 #define intload(i) ((int)((i) * FIXED_LOADAVG))
26