sg_get_page_stats(3)

NAME
sg_get_page_stats, sg_get_page_stats_r, sg_get_page_stats_diff, sg_get_page_stats_diff_between, sg_free_page_stats - get paging statistics

SYNOPSIS
\FC#include <statgrab.h>\F[]

\FCsg_page_stats *sg_get_page_stats\F[]
\FC(size_t *entries);\F[]

\FCsg_page_stats *sg_get_page_stats_r\F[]
\FC(size_t *entries);\F[]

\FCsg_page_stats *sg_get_page_stats_diff\F[]
\FC(size_t *entries);\F[]

\FCsg_page_stats *sg_get_page_stats_diff_between\F[]
\FC(const sg_page_stats *cur, const sg_page_stats *last, size_t *entries);\F[]

\FCsg_error sg_free_page_stats\F[]
\FC(sg_page_stats *data);\F[]

DESCRIPTION
The page stats module deliver the number of pages swapped in and out, either since the machine has been booted (by the \FCsg_get_page_stats\F[]() and \FCsg_get_page_stats_r\F[]() functions) or the difference between two measured statistics (by the \FCsg_get_page_stats_diff\F[]() and \FCsg_get_page_stats_diff_between\F[]() functions).

The \FCsg_get_page_stats_diff\F[]() function calculates the difference between the last call to the function \FCsg_get_page_stats\F[]() in this thread (the statistics of the earlier call are saved and \FCsg_get_page_stats\F[]() is called immediately after this).

API Shortcut
function | returns | data owner
sg_get_page_stats | \FCsg_page_stats\F[] * | libstatgrab (thread local)
sg_get_page_stats_r | \FCsg_page_stats\F[] * | caller
sg_get_page_stats_diff | \FCsg_page_stats\F[] * | libstatgrab (thread local)
sg_get_page_stats_diff_between | \FCsg_page_stats\F[] * | caller

The \FCsg_page_stats\F[] buffer received from \FCsg_get_page_stats_r\F[]() and the \FCsg_get_page_stats_diff_between\F[]() must be freed using \FCsg_free_page_stats\F[]() when not needed any more. The caller is responsible for doing it.

RETURN VALUES
\FC
typedef struct{
        unsigned long long pages_pagein;
        unsigned long long pages_pageout;
        time_t systime;
}sg_page_stats;
    \F[]

\FCpages_pagein\F[]
    The number of pages swapped into memory.

\FCpages_pageout\F[]
    The number of pages swapped out of memory (to swap).

\FCsystime\F[]
    The timestamp when the above stats where collected in seconds since epoch or the time period over which \FCpages_pagein\F[] and \FCpages_pageout\F[] were transferred.

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

SEE ALSO
statgrab(3)

WEBSITE
⟨https://libstatgrab.org/⟩