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

Comparing projects/libstatgrab/src/libstatgrab/swap_stats.c (file contents):
Revision 1.25 by tdb, Thu Jul 5 16:46:06 2007 UTC vs.
Revision 1.26 by tdb, Sun Oct 3 18:35:58 2010 UTC

# Line 59 | Line 59
59   #include <unistd.h>
60   #define SWAP_BATCH 5
61   #endif
62 + #ifdef AIX
63 + #include <unistd.h>
64 + #include <libperfstat.h>
65 + #endif
66   #ifdef WIN32
67   #include <windows.h>
68   #endif
# Line 95 | Line 99 | sg_swap_stats *sg_get_swap_stats(){
99   #if defined(NETBSD) || defined(OPENBSD)
100          struct uvmexp *uvm;
101   #endif
102 + #ifdef AIX
103 +        perfstat_memory_total_t mem;
104 +        long long pagesize;
105 + #endif
106   #ifdef WIN32
107          MEMORYSTATUSEX memstats;
108   #endif
# Line 135 | Line 143 | sg_swap_stats *sg_get_swap_stats(){
143                  }
144                  swapidx = pstat_swapinfo[num - 1].pss_idx + 1;
145          }
146 + #endif
147 + #ifdef AIX
148 +        if ((pagesize = sysconf(_SC_PAGESIZE)) == -1) {
149 +                sg_set_error_with_errno(SG_ERROR_SYSCONF, "_SC_PAGESIZE");
150 +                return NULL;
151 +        }
152 +
153 +        /* return code is number of structures returned */
154 +        if(perfstat_memory_total(NULL, &mem, sizeof(perfstat_memory_total_t), 1) != 1) {
155 +                sg_set_error_with_errno(SG_ERROR_SYSCTLBYNAME, "perfstat_memory_total");
156 +                return NULL;
157 +        }
158 +
159 +        swap_stat.total = ((long long)mem.pgsp_total) * pagesize;
160 +        swap_stat.free  = ((long long)mem.pgsp_free)  * pagesize;
161 +        swap_stat.used  = swap_stat.total - swap_stat.free;
162   #endif
163   #ifdef SOLARIS
164          if((pagesize=sysconf(_SC_PAGESIZE)) == -1){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines