Is there a way to get exact information on the number of pages swapped
out and/or swapped in (as part of paging behavior caused by the
application) at any given point in an application?
I have program that does repeated traversals over a
tree/directed-graph like structure, starting with a different root
every time (although there is probably some overlap in the nodes
visited). The data structure is larger than main memory size, and so
there is obviously paging as previously-unreferenced pages are swapped
in and others are swapped out to make room for the newly-loaded pages.
What I would like to do is measure the number of page-outs and
page-ins for each iteration of my traversal so that I have a measure
of the paging activity that goes on for that iteration. Is there
something I can get from the /proc filesystem or from the page daemons
or elsewhere? (I don't necessarily care about whether the pages
paged-out belong to this application or not, just that they were
necessary due to the allocationbehavior of this application.)
I know about major page faults from getrusage, but I am not sure if
that number is precise, and also whether it includes both page-outs
and page-ins. For example, if I fault on a page that is swapped in,
and say that another page had to be swapped out to make room for the
new page, does that count as one or two major page faults?
Also, where can I find more information about the page-out mechanisms
of Linux? I would guess that page-outs (writes) are cheaper than
page-ins (reads) because they can be grouped together (page-out
several pages at a time), and may take advantage of some write
buffering (on disk?) Any information, details, etc. about paging
mechanisms will be very much appreciated.
Thanks in advance,
Sheetal
--
----------------------------------------------------------------------
Sheetal V. Kakkad Department of Computer Sciences, UT-Austin