1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
'\" t
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" SPDX-License-Identifier: BSD-3-Clause
.\"
.\" @(#)getloadavg.3 8.1 (Berkeley) 6/4/93
.\"
.\" 2007-12-08, mtk, Converted from mdoc to man macros
.\"
.TH getloadavg 3 2022-12-15 "Linux man-pages 6.03"
.SH NAME
getloadavg \- get system load averages
.SH LIBRARY
Standard C library
.RI ( libc ", " \-lc )
.SH SYNOPSIS
.nf
.B #include <stdlib.h>
.PP
.BI "int getloadavg(double " loadavg[] ", int " nelem );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.PP
.BR getloadavg ():
.nf
Since glibc 2.19:
_DEFAULT_SOURCE
In glibc up to and including 2.19:
_BSD_SOURCE
.fi
.SH DESCRIPTION
The
.BR getloadavg ()
function returns the number of processes in the system run queue
averaged over various periods of time.
Up to
.I nelem
samples are retrieved and assigned to successive elements of
.IR loadavg[] .
The system imposes a maximum of 3 samples, representing averages
over the last 1, 5, and 15 minutes, respectively.
.SH RETURN VALUE
If the load average was unobtainable, \-1 is returned; otherwise,
the number of samples actually retrieved is returned.
.\" .SH HISTORY
.\" The
.\" BR getloadavg ()
.\" function appeared in
.\" 4.3BSD Reno .
.SH VERSIONS
This function is available since glibc 2.2.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lbx lb lb
l l l.
Interface Attribute Value
T{
.BR getloadavg ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH STANDARDS
Not in POSIX.1.
Present on the BSDs and Solaris.
.\" mdoc seems to have a bug - there must be no newline here
.SH SEE ALSO
.BR uptime (1),
.BR proc (5)
|