LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mismatch in Pagefault and vmstat values in Ubuntu (https://www.linuxquestions.org/questions/linux-newbie-8/mismatch-in-pagefault-and-vmstat-values-in-ubuntu-4175553325/)

newbee15 09-12-2015 02:02 PM

Mismatch in Pagefault and vmstat values in Ubuntu
 
I want to capture the Pagefault values in Ubuntu.

Below is my code logic to capture Pagefaults :

"(vm_event_states.event[PGFAULT])"

But when I run the following commands there is a huge difference in the values :

db@ubuntu:~/pgfault$ grep pgfault /proc/vmstat
pgfault 4648883
db@ubuntu:~/pgfault$ cat /proc/pgfault
2358120
db@ubuntu:~/pgfault$ grep pgfault /proc/vmstat
pgfault 4649312
db@ubuntu:~/pgfault$ grep pgfault /proc/vmstat
pgfault 4649663
db@ubuntu:~/pgfault$ cat /proc/pgfault
2291317
student@ubuntu:~/pgfault$ grep pgfault /proc/vmstat
pgfault 4650279

Can someone please help me to understand why there is such a huge difference in the values of pagefaults? Or is there something I missed in the logic of calculation.

I also tried for the "major fault" and the "minor fault" but it didn't work.

Please suggest.

syg00 09-12-2015 09:48 PM

Quote:

Originally Posted by newbee15 (Post 5419468)
Or is there something I missed in the logic of calculation.

Certainly looks like it.
Have you read vmstat.h ?. Have you ascertained the (rough) ratio of your numbers to those reported in /proc/vmstat ?.


All times are GMT -5. The time now is 03:20 AM.