sg_get_load_stats(3)

sg_get_load_stats3

Get system load

Usage

FC#include <statgrab.h>F[0]

FCsg_load_stats *sg_get_load_statsF[0] FC(size_t *entries);F[0]

FCsg_load_stats *sg_get_load_stats_rF[0] FC(size_t *entries);F[0]

FCsg_error sg_free_load_statsF[0] FC(sg_load_stats *data);F[0]

Overview

These calls returns a pointer to a buffer containing information about cumulated machine load.

API Shortcut

functionreturnsdata owner
sg_get_load_statsFCsg_load_statsF[0] *libstatgrab (thread local)
sg_get_load_stats_rFCsg_load_statsF[0] *caller

The FCsg_load_statsF[0] buffer received from FCsg_get_load_stats_rF[0]() must be freed using FCsg_free_load_statsF[0]() when not needed any more. The caller is responsible for doing it.

On most systems this function is just a wrapper to the FCgetloadavgF[0] system call.

Return values

The structure returned is of type FCsg_load_statsF[0].

FC
typedef struct{
        double min1;
        double min5;
        double min15;
        time_t systime;
}sg_load_stats;
    F[0]
FCmin1F[0]

The load average over 1 minute.

FCmin5F[0]

The load average over 5 minutes.

FCmin15F[0]

The load average over 15 minutes.

FCsystimeF[0]

The timestamp when the above stats where collected in seconds since epoch

Website

⟨https://libstatgrab.org/⟩

Releases

11 releases since Debian 4.0 (Etch); the text changed 4 times.

  1. 4.0–7
  2. 8–10
  3. 11
  4. 12–13
  5. Arch

From libstatgrab 0.92.1-2 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.