[users at i-scream] libstatgrab on Linux: page stats are incorrect

Jens Rehsack sno at NetBSD.org
Mon Jan 5 14:28:55 GMT 2015


Am 05.01.2015 um 15:05 schrieb Anderson Carlos Trindade <anderson.trindade at optimode.com.br>:

> Hi List,

Hi Anderson Carlos,

> I’m using libstagrab, function sg_get_page_stats_diff() to get the number of pages paged in and out from/to swap area in a Linux box, but the statistics returned by this function are very different from output from vmstat command.
> 
> In my test server, the swap is not being used as we can se from /proc/vmstat below: 
> 
> $cat vmstat | grep -e pg -e swp
> pgpgin 328668
> pgpgout 94306
> pswpin 0
> pswpout 0
> pgalloc_dma 1
> pgalloc_dma32 596309
> pgalloc_normal 0
> pgalloc_movable 0
> pgfree 895803
> pgactivate 25792
> pgdeactivate 0
> pgfault 870500
> pgmajfault 738
> pgrefill_dma 0
> pgrefill_dma32 0
> pgrefill_normal 0
> pgrefill_movable 0
> pgsteal_dma 0
> pgsteal_dma32 0
> pgsteal_normal 0
> pgsteal_movable 0
> pgscan_kswapd_dma 0
> pgscan_kswapd_dma32 0
> pgscan_kswapd_normal 0
> pgscan_kswapd_movable 0
> pgscan_direct_dma 0
> pgscan_direct_dma32 0
> pgscan_direct_normal 0
> pgscan_direct_movable 0
> pginodesteal 0
> pgrotated 1
> unevictable_pgs_culled 715
> unevictable_pgs_scanned 0
> unevictable_pgs_rescued 0
> unevictable_pgs_mlocked 1961
> unevictable_pgs_munlocked 0
> unevictable_pgs_cleared 0
> unevictable_pgs_stranded 0
> unevictable_pgs_mlockfreed 0
> 
> It seems the function sg_get_page_stats_diff() is returning values from pgpin/pgpout instead of pswpin/pswpout. Is this a bug or an expected behavior for this function?

From sg_get_page_stats_diff(3):

The page stats module deliver the number of pages swapped in and out, either since the machine has been booted (by the sg_get_page_stats() and sg_get_page_stats_r() functions) or the difference between two measured statistics (by the sg_get_page_stats_diff() and sg_get_page_stats_diff_between() functions).

http://www.linuxinsight.com/proc_vmstat.html is not very enlightening regarding the difference of pgpin/pgpout vs. pswpin/pswpout - http://superuser.com/questions/785447/what-is-the-exact-difference-between-the-parameters-pgpgin-pswpin-and-pswpou might be more helpful.

But back to http://www.linuxinsight.com/proc_vmstat.html - it exactly describes pgpin/pgpout as "Number of pageins and pageouts (since the last boot)".

Hope that helps a bit ;)

Cheers
-- 
Jens Rehsack
rehsack at gmail.com




More information about the users mailing list