Blame man3/getloadavg.3

Packit 7cfc04
.\" Copyright (c) 1989, 1991, 1993
Packit 7cfc04
.\"	The Regents of the University of California.  All rights reserved.
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(BSD_3_CLAUSE_UCB)
Packit 7cfc04
.\" Redistribution and use in source and binary forms, with or without
Packit 7cfc04
.\" modification, are permitted provided that the following conditions
Packit 7cfc04
.\" are met:
Packit 7cfc04
.\" 1. Redistributions of source code must retain the above copyright
Packit 7cfc04
.\"    notice, this list of conditions and the following disclaimer.
Packit 7cfc04
.\" 2. Redistributions in binary form must reproduce the above copyright
Packit 7cfc04
.\"    notice, this list of conditions and the following disclaimer in the
Packit 7cfc04
.\"    documentation and/or other materials provided with the distribution.
Packit 7cfc04
.\" 3. Neither the name of the University nor the names of its contributors
Packit 7cfc04
.\"    may be used to endorse or promote products derived from this software
Packit 7cfc04
.\"    without specific prior written permission.
Packit 7cfc04
.\"
Packit 7cfc04
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit 7cfc04
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 7cfc04
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 7cfc04
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit 7cfc04
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 7cfc04
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit 7cfc04
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit 7cfc04
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit 7cfc04
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit 7cfc04
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit 7cfc04
.\" SUCH DAMAGE.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\"     @(#)getloadavg.3	8.1 (Berkeley) 6/4/93
Packit 7cfc04
.\"
Packit 7cfc04
.\" 2007-12-08, mtk, Converted from mdoc to man macros
Packit 7cfc04
.\"
Packit 7cfc04
.TH GETLOADAVG 3 2016-03-15 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
getloadavg \- get system load averages
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <stdlib.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int getloadavg(double " loadavg[] ", int " nelem );
Packit 7cfc04
.fi
Packit 7cfc04
.PP
Packit 7cfc04
.in -4n
Packit 7cfc04
Feature Test Macro Requirements for glibc (see
Packit 7cfc04
.BR feature_test_macros (7)):
Packit 7cfc04
.in
Packit 7cfc04
.PP
Packit 7cfc04
.BR getloadavg ():
Packit 7cfc04
.nf
Packit 7cfc04
    Since glibc 2.19:
Packit 7cfc04
        _DEFAULT_SOURCE
Packit 7cfc04
    In glibc up to and including 2.19:
Packit 7cfc04
        _BSD_SOURCE
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The
Packit 7cfc04
.BR getloadavg ()
Packit 7cfc04
function returns the number of processes in the system run queue
Packit 7cfc04
averaged over various periods of time.
Packit 7cfc04
Up to
Packit 7cfc04
.I nelem
Packit 7cfc04
samples are retrieved and assigned to successive elements of
Packit 7cfc04
.IR loadavg [].
Packit 7cfc04
The system imposes a maximum of 3 samples, representing averages
Packit 7cfc04
over the last 1, 5, and 15 minutes, respectively.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
If the load average was unobtainable, \-1 is returned; otherwise,
Packit 7cfc04
the number of samples actually retrieved is returned.
Packit 7cfc04
.\" .SH HISTORY
Packit 7cfc04
.\" The
Packit 7cfc04
.\" BR getloadavg ()
Packit 7cfc04
.\" function appeared in
Packit 7cfc04
.\" 4.3BSD Reno .
Packit 7cfc04
.SH VERSIONS
Packit 7cfc04
This function is available in glibc since version 2.2.
Packit 7cfc04
.SH ATTRIBUTES
Packit 7cfc04
For an explanation of the terms used in this section, see
Packit 7cfc04
.BR attributes (7).
Packit 7cfc04
.TS
Packit 7cfc04
allbox;
Packit 7cfc04
lb lb lb
Packit 7cfc04
l l l.
Packit 7cfc04
Interface	Attribute	Value
Packit 7cfc04
T{
Packit 7cfc04
.BR getloadavg ()
Packit 7cfc04
T}	Thread safety	MT-Safe
Packit 7cfc04
.TE
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
Not in POSIX.1.
Packit 7cfc04
Present on the BSDs and Solaris.
Packit 7cfc04
.\" mdoc seems to have a bug - there must be no newline here
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR uptime (1),
Packit 7cfc04
.BR proc (5)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.