sg_get_page_stats(3)

sg_get_page_stats3

Get paging statistics

Usage

FC#include <statgrab.h>F[0]

FCsg_page_stats *sg_get_page_statsF[0] FC(size_t *entries);F[0]

FCsg_page_stats *sg_get_page_stats_rF[0] FC(size_t *entries);F[0]

FCsg_page_stats *sg_get_page_stats_diffF[0] FC(size_t *entries);F[0]

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

FCsg_error sg_free_page_statsF[0] FC(sg_page_stats *data);F[0]

Overview

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_statsF[0]() and FCsg_get_page_stats_rF[0]() functions) or the difference between two measured statistics (by the FCsg_get_page_stats_diffF[0]() and FCsg_get_page_stats_diff_betweenF[0]() functions).

The FCsg_get_page_stats_diffF[0]() function calculates the difference between the last call to the function FCsg_get_page_statsF[0]() in this thread (the statistics of the earlier call are saved and FCsg_get_page_statsF[0]() is called immediately after this).

API Shortcut

functionreturnsdata owner
sg_get_page_statsFCsg_page_statsF[0] *libstatgrab (thread local)
sg_get_page_stats_rFCsg_page_statsF[0] *caller
sg_get_page_stats_diffFCsg_page_statsF[0] *libstatgrab (thread local)
sg_get_page_stats_diff_betweenFCsg_page_statsF[0] *caller

The FCsg_page_statsF[0] buffer received from FCsg_get_page_stats_rF[0]() and the FCsg_get_page_stats_diff_betweenF[0]() must be freed using FCsg_free_page_statsF[0]() 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[0]
FCpages_pageinF[0]

The number of pages swapped into memory.

FCpages_pageoutF[0]

The number of pages swapped out of memory (to swap).

FCsystimeF[0]

The timestamp when the above stats where collected in seconds since epoch or the time period over which FCpages_pageinF[0] and FCpages_pageoutF[0] were transferred.

Website

⟨https://libstatgrab.org/⟩

Releases

11 releases since Debian 4.0 (Etch); the text changed 4 times.

  1. 4.0–7
  2. 8–10
  3. 11
  4. 12–13
  5. Arch

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.

From libstatgrab 0.92.1-2 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.