Sys::PageCache - handling page cache related on files
use Sys::PageCache; # determine whether pages are redident in memory $r = fincore "/path/to/file"; printf("cached/total_size=%llu/%llu cached/total_pages=%llu/%llu\n", $r->{cached_size}, $r->{file_size}, $r->{cached_pages}, $r->{total_pages}, ); # free cached pages on a file $r = fadvise "/path/to/file", 0, 0, POSIX_FADV_DONTNEED;
Sys::PageCache is for handling page cache related on files.
Determine whether pages are redident in memory. $offset and $length are optional.
$offset
$length
fincore returns a following hash ref.
fincore
{ cached_pages => Int, # number of cached pages cached_size => Int, # size of cached pages total_pages => Int, # number of pages if cached whole file file_size => Int, # size of file page_size => Int, # page size on your system }
Call posix_fadvise(2).
fadvise returns 1 if success.
fadvise
HIROSE Masaaki <hirose31 _at_ gmail.com>
https://github.com/hirose31/Sys-PageCache
git clone git://github.com/hirose31/Sys-PageCache.git
patches and collaborators are welcome.
mincore(2), posix_fadvise(2), https://code.google.com/p/linux-ftools/, https://github.com/nhayashi/pagecache-tool
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Sys::PageCache, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sys::PageCache
CPAN shell
perl -MCPAN -e shell install Sys::PageCache
For more information on module installation, please visit the detailed CPAN module installation guide.