sg_get_load_stats(3)
okay bestie, this is the sg_get_load_stats(3) page from the libstatgrab manual β manual name folded right in near the top so we donβt have to copy the header line like an NPC. π
β¨
π NAME π
sg_get_load_stats, sg_get_load_stats_r, sg_free_load_stats β get system load. thatβs the whole assignment, bestie. π
π 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 hand you back a pointer to a buffer thatβs full of info about cumulated machine load. lowkey iconic for checking how busy your machine is. β¨
β‘ API Shortcut β‘
sg_get_load_statsβ returnssg_load_stats *; data owner islibstatgrab(thread local).sg_get_load_stats_rβ returnssg_load_stats *; data owner is the caller.
so, real talk: the sg_load_stats buffer you get from sg_get_load_stats_r() must be freed using sg_free_load_stats() when itβs not needed any more. The caller is responsible for doing it. that means you, bestie β no ghosting your memory. ππ
On most systems this function is just a wrapper to the getloadavg system call. fr fr.
π 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 were collected, in seconds since epoch.
π«Ά SEE ALSO π«Ά
statgrab(3)β the friend you should also check out, iykyk.
π WEBSITE π
- β¨https://libstatgrab.org/β© β official site, go touch grass after reading docs maybe. πΈ
k bye bestie π this oneβs from libstatgrab, dated 2019-03-08, and itβs the sg_get_load_stats(3) manual page. mwah π
π¦ where this page comes from
- alpine 3.24: libstatgrab-doc 0.92.1-r1 Β· LGPL-2.0-or-later
- arch rolling: libstatgrab 0.92.1-2 Β· LGPL AND GPL
- fedora 43: libstatgrab-devel 1:0.92.1-14.fc43 Β· LGPL-2.1-or-later
- fedora 43: libstatgrab-devel 1:0.92.1-14.fc43 Β· LGPL-2.1-or-later
- fedora 44: libstatgrab-devel 1:0.92.1-15.fc44 Β· LGPL-2.1-or-later
- fedora 44: libstatgrab-devel 1:0.92.1-15.fc44 Β· LGPL-2.1-or-later
- nixos 26.05: libstatgrab 0.92.1
- nixpkgs unstable: libstatgrab 0.92.1
- opensuse-leap 16.0: libstatgrab-devel 0.92.1-bp160.1.14 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libstatgrab-devel 0.92.1-bp160.1.14 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libstatgrab-devel 0.92.1-bp160.1.14 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libstatgrab-devel 0.92.1-bp160.1.14 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms