ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/page_stats.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/page_stats.c (file contents):
Revision 1.4 by pajs, Fri Mar 7 14:44:38 2003 UTC vs.
Revision 1.8 by ats, Sat Oct 18 23:04:23 2003 UTC

# Line 1 | Line 1
1   /*
2   * i-scream central monitoring system
3 < * http://www.i-scream.org.uk
4 < * Copyright (C) 2000-2002 i-scream
3 > * http://www.i-scream.org
4 > * Copyright (C) 2000-2003 i-scream
5   *
6   * This program is free software; you can redistribute it and/or
7   * modify it under the terms of the GNU General Public License
# Line 33 | Line 33
33   #include <stdio.h>
34   #include "tools.h"
35   #endif
36 + #ifdef FREEBSD
37 + #include <sys/types.h>
38 + #include <sys/sysctl.h>
39 + #endif
40  
37
41   static page_stat_t page_stats;
42   static int page_stats_uninit=1;
43  
# Line 48 | Line 51 | page_stat_t *get_page_stats(){
51          FILE *f;
52          char *line_ptr;
53   #endif
54 + #ifdef FREEBSD
55 +        size_t size;
56 + #endif
57  
58          page_stats.pages_pagein=0;
59          page_stats.pages_pageout=0;
# Line 83 | Line 89 | page_stat_t *get_page_stats(){
89          }
90          page_stats.systime=time(NULL);
91          fclose(f);
92 +
93 + #endif
94 + #ifdef FREEBSD
95 +        size = sizeof page_stats.pages_pagein;
96 +        if (sysctlbyname("vm.stats.vm.v_swappgsin", &page_stats.pages_pagein, &size, NULL, 0) < 0){
97 +                return NULL;
98 +        }
99 +        size = sizeof page_stats.pages_pageout;
100 +        if (sysctlbyname("vm.stats.vm.v_swappgsout", &page_stats.pages_pageout, &size, NULL, 0) < 0){
101 +                return NULL;
102 +        }
103  
104   #endif
105  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines