Linux‎ > ‎

how to know a file or a process buffered in OS cache

Thank you for visiting this page, this page has been update in another link How to know a file or a process bufferred in OS cache
Noticed it when I was looking into postgreSQL buffering
https://sites.google.com/site/itmyshare/database-tips-and-examples/postgresql-buffering.

Fincore is David Plonka's work, available at
http://net.doit.wisc.edu/~plonka/fincore/
It's a utility to tell you how much a file cached in the kernel's buffer. It was a C code, but implemented in perl INLINE module.
I improved it a bit more, now it's able to tell you that how much data buffered in cache by a or more processes. More easier to check memory taken by processes which open uncertain files.

Here is its usage
Usage:
    fincore [options] <-stdin | file [...]>

     Options:
      -help - brief help message
      -man - full documentation
      -summary - report summary statistics for the files
      -justsummarize - just report summary statistics for the files
      -process - report summary statistics for the files opened by processes
      -verbose - verbose output
      -stdin - read file names from standard input

Here is an example of my desktop's firefox memory status in OS.

./fincore -process 10213 18658
page size: 4096 bytes
processing pid:'10213'
processing pid:'18658'
49495 pages, 193.3 Mbytes in core for 411 files; 120.43 pages, 481.7 kbytes per file. Total filesize 521.72 Mbytes


For a single file
./fincore /usr/lib64/firefox/firefox -summary
page size: 4096 bytes
23 pages, 92.0 kbytes in core for 1 file; 23.00 pages, 92.0 kbytes per file. Total filesize 104.96 kbytes


Attached is the file that I improved.



ċ
fincore.gz
(4k)
Xinli Liu,
Aug 4, 2013, 11:34 PM
Comments