| 1 |
'\" t |
| 2 |
.\" Copyright 1989-1993, The Regents of the University of California. |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: BSD-3-Clause |
| 6 |
.\" |
| 7 |
.TH getloadavg 3 2025-09-21 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
getloadavg \- get system load averages |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <stdlib.h> |
| 16 |
.P |
| 17 |
.BI "int getloadavg(double " loadavg[] ", int " n ); |
| 18 |
.fi |
| 19 |
.P |
| 20 |
.RS -4 |
| 21 |
Feature Test Macro Requirements for glibc (see |
| 22 |
.BR feature_test_macros (7)): |
| 23 |
.RE |
| 24 |
.P |
| 25 |
.BR getloadavg (): |
| 26 |
.nf |
| 27 |
Since glibc 2.19: |
| 28 |
_DEFAULT_SOURCE |
| 29 |
In glibc up to and including 2.19: |
| 30 |
_BSD_SOURCE |
| 31 |
.fi |
| 32 |
.SH DESCRIPTION |
| 33 |
The |
| 34 |
.BR getloadavg () |
| 35 |
function returns the number of processes in the system run queue |
| 36 |
averaged over various periods of time. |
| 37 |
Up to |
| 38 |
.I n |
| 39 |
samples are retrieved and assigned to successive elements of |
| 40 |
.IR loadavg[] . |
| 41 |
The system imposes a maximum of 3 samples, representing averages |
| 42 |
over the last 1, 5, and 15 minutes, respectively. |
| 43 |
.SH RETURN VALUE |
| 44 |
If the load average was unobtainable, |
| 45 |
\-1 is returned; |
| 46 |
otherwise, |
| 47 |
the number of samples actually retrieved is returned. |
| 48 |
.SH ATTRIBUTES |
| 49 |
For an explanation of the terms used in this section, see |
| 50 |
.BR attributes (7). |
| 51 |
.TS |
| 52 |
allbox; |
| 53 |
lbx lb lb |
| 54 |
l l l. |
| 55 |
Interface Attribute Value |
| 56 |
T{ |
| 57 |
.na |
| 58 |
.nh |
| 59 |
.BR getloadavg () |
| 60 |
T} Thread safety MT-Safe |
| 61 |
.TE |
| 62 |
.SH STANDARDS |
| 63 |
BSD. |
| 64 |
.SH HISTORY |
| 65 |
4.3BSD-Reno, Solaris. |
| 66 |
glibc 2.2. |
| 67 |
.SH SEE ALSO |
| 68 |
.BR uptime (1), |
| 69 |
.BR proc (5) |