Reference

sg_free_load_stats(3)

get system load

NAME

sg_get_load_stats, sg_get_load_stats_r, sg_free_load_stats - get system load

SYNOPSIS

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]

DESCRIPTION

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

SEE ALSO

statgrab(3)

WEBSITE

⟨https://libstatgrab.org/⟩

History