1getloadavg(3C) Standard C Library Functions getloadavg(3C)
2
3
4
6 getloadavg - get system load averages
7
9 #include <sys/loadavg.h>
10
11 int getloadavg(double loadavg[], int nelem);
12
13
15 The getloadavg() function returns the number of processes in the system
16 run queue averaged over various periods of time. Up to nelem samples
17 are retrieved and assigned to successive elements of loadavg[]. The
18 system imposes a maximum of 3 samples, representing averages over the
19 last 1, 5, and 15 minutes, respectively. The LOADAVG_1MIN, LOAD‐
20 AVG_5MIN, and LOADAVG_15MIN indices, defined in <sys/loadavg.h>, can be
21 used to extract the data from the appropriate element of the loadavg[]
22 array.
23
25 Upon successful completion, the number of samples actually retrieved is
26 returned. If the load average was unobtainable, −1 is returned and
27 errno is set to indicate the error.
28
30 The getloadavg() function will fail if:
31
32 EINVAL The number of elements specified is less than 0.
33
34
36 If the caller is in a non-global zone and the pools facility is active,
37 the behavior of getloadavg() is equivalent to that of pset_getload‐
38 avg(3C) called with psetid set to PS_MYID.
39
41 See attributes(5) for descriptions of the following attributes:
42
43
44
45
46 ┌─────────────────────────────┬─────────────────────────────┐
47 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
48 ├─────────────────────────────┼─────────────────────────────┤
49 │MT-Level │Async-Signal-Safe │
50 └─────────────────────────────┴─────────────────────────────┘
51
53 uptime(1), w(1), pooladm(1M), Kstat(3PERL), pset_getloadavg(3C), stan‐
54 dards(5)
55
56
57
58SunOS 5.11 28 Jun 2004 getloadavg(3C)