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