Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pgpgin 726854
- pgpgout 1010677
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <sys/sysinfo.h>
- int main(int argc, char **argv)
- {
- struct sysinfo si;
- sysinfo (&si);
- const double xdt = 1024;
- float pagein,pageout, oldvalin = 0, oldvalout = 0, res;
- for(;;) {
- FILE *fp=fopen("/proc/vmstat","r");
- char tmp[256];
- char subbuff[256];
- while(fp!=NULL && fgets(tmp, sizeof(tmp),fp)!=NULL)
- {
- if (strstr(tmp, "pgpgin")) {
- memcpy( subbuff, &tmp[7], 40);
- subbuff[40] = '