getloadavg(3)

getloadavg3

Get system load averages

Usage

#include <stdlib.h>

int

getloadavg(double loadavg[], int nelem);

Library

Standard C Library (libc, -lc)

Overview

The getloadavg() function returns the number of processes in the system run queue averaged over various periods of time. Up to nelem samples are retrieved and assigned to successive elements of loadavg[]. The system imposes a maximum of 3 samples, representing averages over the last 1, 5, and 15 minutes, respectively.

Diagnostics

If the load average was unobtainable, -1 is returned; otherwise, the number of samples actually retrieved is returned.

Releases

163 releases since Mac OS X 10.0; the text changed 1 time.

  1. 10.0–10.1.5
  2. 10.2–26.5

History

The getloadavg() function appeared in 4.3BSD-Reno.

From Libc 1752.120.2 in macOS 26.5. Parsed by carta from the page's mdoc source.