1sg_get_load_stats(3) sg_get_load_stats(3)
2
3
4
6 sg_get_load_stats, sg_get_load_stats_r, sg_free_load_stats - get system
7 load
8
10 #include <statgrab.h>
11
12
13 sg_load_stats *sg_get_load_stats (size_t *entries);
14
15 sg_load_stats *sg_get_load_stats_r (size_t *entries);
16
17 sg_error sg_free_load_stats (sg_load_stats *data);
18
20 These calls returns a pointer to a buffer containing information about
21 cumulated machine load.
22
23 API Shortcut
24
25 ┌────────────────────┬─────────────────┬─────────────────────┐
26 │function │ returns │ data owner │
27 ├────────────────────┼─────────────────┼─────────────────────┤
28 │sg_get_load_stats │ sg_load_stats * │ libstatgrab (thread │
29 │ │ │ local) │
30 ├────────────────────┼─────────────────┼─────────────────────┤
31 │sg_get_load_stats_r │ sg_load_stats * │ caller │
32 └────────────────────┴─────────────────┴─────────────────────┘
33 The sg_load_stats buffer received from sg_get_load_stats_r() must be
34 freed using sg_free_load_stats() when not needed any more. The caller
35 is responsible for doing it.
36
37 On most systems this function is just a wrapper to the getloadavg sys‐
38 tem call.
39
41 The structure returned is of type sg_load_stats.
42
43 typedef struct{
44 double min1;
45 double min5;
46 double min15;
47 time_t systime;
48 }sg_load_stats;
49
50
51 min1 The load average over 1 minute.
52
53 min5 The load average over 5 minutes.
54
55 min15 The load average over 15 minutes.
56
57 systime
58 The timestamp when the above stats where collected in seconds
59 since epoch
60
62 statgrab(3)
63
65 ⟨http://www.i-scream.org/libstatgrab/⟩
66
67
68
69i-scream 2013-06-17 sg_get_load_stats(3)