2 * Top - a top users display for Berkeley Unix
4 * Defines required to access load average figures.
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:
11 * loaddouble(la) - convert load_avg to double.
12 * intload(i) - convert integer to load_avg.
16 * We assume that if FSCALE is defined, then avenrun and ccpu are type long.
17 * If your machine is an exception (mips, perhaps?) then make adjustments
20 * Defined types: load_avg for load averages, pctcpu for cpu percentages.
22 #if defined(mips) && !defined(NetBSD)
23 # include <sys/fixpoint.h>
24 # if defined(FBITS) && !defined(FSCALE)
25 # define FSCALE (1 << FBITS) /* mips */
30 # define FIXED_LOADAVG FSCALE
31 # define FIXED_PCTCPU FSCALE
37 # define FIXED_PCTCPU PCT_SCALE
43 # define pctdouble(p) ((double)(p) / FIXED_PCTCPU)
45 typedef double pctcpu;
46 # define pctdouble(p) (p)
50 typedef fixpt_t load_avg;
51 # define loaddouble(la) ((double)(la) / FIXED_LOADAVG)
52 # define intload(i) ((int)((i) * FIXED_LOADAVG))
54 typedef double load_avg;
55 # define loaddouble(la) (la)
56 # define intload(i) ((double)(i))