sg_get_load_stats - Man Page

get system load

Synopsis

#include <statgrab.h>

sg_load_stats *sg_get_load_stats (size_t *entries);

sg_load_stats *sg_get_load_stats_r (size_t *entries);

sg_error sg_free_load_stats (sg_load_stats *data);

Description

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

API Shortcut

functionreturnsdata owner
sg_get_load_statssg_load_stats *libstatgrab (thread local)
sg_get_load_stats_rsg_load_stats *caller

The sg_load_stats buffer received from sg_get_load_stats_r() must be freed using sg_free_load_stats() when not needed any more. The caller is responsible for doing it.

On most systems this function is just a wrapper to the getloadavg system call.

Return Values

The structure returned is of type sg_load_stats.

typedef struct{
        double min1;
        double min5;
        double min15;
        time_t systime;
}sg_load_stats;
min1

The load average over 1 minute.

min5

The load average over 5 minutes.

min15

The load average over 15 minutes.

systime

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

See Also

statgrab(3)

Website

https://libstatgrab.org/

Referenced By

sg_intro(3), statgrab(3).

The man pages sg_free_load_stats(3) and sg_get_load_stats_r(3) are aliases of sg_get_load_stats(3).

2019-03-08 libstatgrab