| 1 |
tdb |
1.2 |
Page Statistics |
| 2 |
|
|
=============== |
| 3 |
|
|
|
| 4 |
|
|
$Id$ |
| 5 |
|
|
|
| 6 |
|
|
Data Structure |
| 7 |
|
|
-------------- |
| 8 |
pajs |
1.1 |
|
| 9 |
|
|
typedef struct{ |
| 10 |
|
|
long long pages_pagein; |
| 11 |
|
|
long long pages_pageout; |
| 12 |
|
|
time_t systime; |
| 13 |
|
|
}page_stat_t; |
| 14 |
|
|
|
| 15 |
tdb |
1.2 |
pages_pagein is the number of pages swapped in to memory |
| 16 |
|
|
pages_pageout is the number of pages swapped out of memory (to swap) |
| 17 |
pajs |
1.1 |
|
| 18 |
tdb |
1.2 |
Functions |
| 19 |
|
|
--------- |
| 20 |
pajs |
1.1 |
|
| 21 |
tdb |
1.2 |
page_stat_t *get_page_stats(); |
| 22 |
|
|
page_stat_t *get_page_stats_diff(); |
| 23 |
|
|
|
| 24 |
|
|
get_page_stats() and get_page_stats_diff() both return a pointer |
| 25 |
|
|
to a static buffer of type page_stat_t. |
| 26 |
|
|
|
| 27 |
|
|
get_page_stats() will return the number of pages the system has |
| 28 |
|
|
paged in and out since bootup. get_page_stats_diff() will return |
| 29 |
|
|
the difference since last time it was called. If it has not been |
| 30 |
|
|
called before, it will return get_page_stats(). |
| 31 |
|
|
|
| 32 |
|
|
Bugs |
| 33 |
|
|
---- |
| 34 |
pajs |
1.1 |
|
| 35 |
|
|
Solaris doesn't seem to report accurately. It reports the number |
| 36 |
tdb |
1.2 |
of pages swapped into memory, not necessarily from swap. This feature |
| 37 |
|
|
isn't deemed entirely reliable :) |
| 38 |
|
|
|
| 39 |
|
|
Example |
| 40 |
|
|
------- |
| 41 |
|
|
|
| 42 |
|
|
An example can be found in examples/page_stats.c |