source: trunk/third/top/loadavg.h @ 9084

Revision 9084, 1.5 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r9083, which included commits to RCS files with non-trunk default branches.
Line 
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
15/*
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
18 * here.
19 *
20 * Defined types:  load_avg for load averages, pctcpu for cpu percentages.
21 */
22#if defined(mips) && !defined(NetBSD)
23# include <sys/fixpoint.h>
24# if defined(FBITS) && !defined(FSCALE)
25#  define FSCALE (1 << FBITS)   /* mips */
26# endif
27#endif
28
29#ifdef FSCALE
30# define FIXED_LOADAVG FSCALE
31# define FIXED_PCTCPU FSCALE
32#endif
33
34#ifdef ibm032
35# undef FIXED_LOADAVG
36# undef FIXED_PCTCPU
37# define FIXED_PCTCPU PCT_SCALE
38#endif
39
40
41#ifdef FIXED_PCTCPU
42  typedef long pctcpu;
43# define pctdouble(p) ((double)(p) / FIXED_PCTCPU)
44#else
45typedef double pctcpu;
46# define pctdouble(p) (p)
47#endif
48
49#ifdef FIXED_LOADAVG
50  typedef long load_avg;
51# define loaddouble(la) ((double)(la) / FIXED_LOADAVG)
52# define intload(i) ((int)((i) * FIXED_LOADAVG))
53#else
54  typedef double load_avg;
55# define loaddouble(la) (la)
56# define intload(i) ((double)(i))
57#endif
Note: See TracBrowser for help on using the repository browser.