I'm trying to write a mac os program to monitor the system (something similar to the activity monitor). I have looked at the function vm_stat and when I run it I got this:
Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free: 438386.
Pages active: 236438.
Pages inactive: 113750.
Pages speculative: 34293.
Pages wired down: 225027.
"Translation faults": 11132566.
Pages copy-on-write: 319385.
Pages zero filled: 6618647.
Pages reactivated: 23071.
Pageins: 421804.
Pageouts: 153240.
Object cache: 14 hits of 24183 lookups (0% hit rate)
However when I run the activity monitor, I got something like:
Page Ins: 1.61gb (8.00kb/sec)
Page outs: 598.6 MB
I have a question regarding this: how come the pages free in vmstat is so small (comparing to activity monitor)