1sg_get_page_stats(3)                                      sg_get_page_stats(3)
2
3
4

NAME

6       sg_get_page_stats,     sg_get_page_stats_r,     sg_get_page_stats_diff,
7       sg_get_page_stats_diff_between, sg_free_page_stats - get paging statis‐
8       tics
9

SYNOPSIS

11       #include <statgrab.h>
12
13
14       sg_page_stats *sg_get_page_stats (size_t *entries);
15
16       sg_page_stats *sg_get_page_stats_r (size_t *entries);
17
18       sg_page_stats *sg_get_page_stats_diff (size_t *entries);
19
20       sg_page_stats *sg_get_page_stats_diff_between (const sg_page_stats
21                       *cur, const sg_page_stats *last, size_t *entries);
22
23       sg_error sg_free_page_stats (sg_page_stats *data);
24

DESCRIPTION

26       The page stats module deliver the number of pages swapped in  and  out,
27       either  since  the  machine has been booted (by the sg_get_page_stats()
28       and sg_get_page_stats_r() functions) or the difference between two mea‐
29       sured     statistics     (by     the    sg_get_page_stats_diff()    and
30       sg_get_page_stats_diff_between() functions).
31
32       The sg_get_page_stats_diff() function calculates the difference between
33       the  last  call to the function sg_get_page_stats() in this thread (the
34       statistics of the earlier call are  saved  and  sg_get_page_stats()  is
35       called immediately after this).
36
37       API Shortcut
38
39       ┌───────────────────────────┬─────────────────┬─────────────────────┐
40       │function                   │ returns         │ data owner          │
41       ├───────────────────────────┼─────────────────┼─────────────────────┤
42       │sg_get_page_stats          │ sg_page_stats * │ libstatgrab (thread │
43       │                           │                 │ local)              │
44       ├───────────────────────────┼─────────────────┼─────────────────────┤
45       │sg_get_page_stats_r        │ sg_page_stats * │ caller              │
46       ├───────────────────────────┼─────────────────┼─────────────────────┤
47       │sg_get_page_stats_diff     │ sg_page_stats * │ libstatgrab (thread │
48       │                           │                 │ local)              │
49       ├───────────────────────────┼─────────────────┼─────────────────────┤
50       │sg_get_page_stats_diff_be‐ │ sg_page_stats * │ caller              │
51       │tween                      │                 │                     │
52       └───────────────────────────┴─────────────────┴─────────────────────┘
53       The  sg_page_stats  buffer  received from sg_get_page_stats_r() and the
54       sg_get_page_stats_diff_between()     must      be      freed      using
55       sg_free_page_stats()  when not needed any more. The caller is responsi‐
56       ble for doing it.
57

RETURN VALUES

59       typedef struct{
60               unsigned long long pages_pagein;
61               unsigned long long pages_pageout;
62               time_t systime;
63       }sg_page_stats;
64
65
66       pages_pagein
67              The number of pages swapped into memory.
68
69       pages_pageout
70              The number of pages swapped out of memory (to swap).
71
72       systime
73              The timestamp when the above stats where  collected  in  seconds
74              since  epoch  or  the  time  period  over which pages_pagein and
75              pages_pageout were transferred.
76

BUGS

78       Solaris doesn't seem to report accurately. It  reports  the  number  of
79       pages  swapped  into  memory,  not  necessarily from swap. This feature
80       isn't deemed entirely reliable.
81

SEE ALSO

83       statgrab(3)
84

WEBSITE

86https://libstatgrab.org/
87
88
89
90libstatgrab                       2019-03-08              sg_get_page_stats(3)
Impressum