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

Comparing projects/libstatgrab/src/libstatgrab/memory_stats.c (file contents):
Revision 1.35 by tdb, Mon Jun 18 20:56:22 2007 UTC vs.
Revision 1.37 by tdb, Sun Oct 3 18:35:57 2010 UTC

# Line 56 | Line 56
56   #include <sys/pstat.h>
57   #include <unistd.h>
58   #endif
59 + #ifdef AIX
60 + #include <unistd.h>
61 + #include <libperfstat.h>
62 + #endif
63   #ifdef WIN32
64   #include <windows.h>
65   #include "win32.h"
# Line 86 | Line 90 | sg_mem_stats *sg_get_mem_stats(){
90          int mib[2];
91          u_long physmem;
92          size_t size;
93 <        u_int free_count;
94 <        u_int cache_count;
95 <        u_int inactive_count;
93 >        u_long free_count;
94 >        u_long cache_count;
95 >        u_long inactive_count;
96          int pagesize;
97   #endif
98   #if defined(NETBSD)
# Line 100 | Line 104 | sg_mem_stats *sg_get_mem_stats(){
104          size_t size;
105          int pagesize, page_multiplier;
106   #endif
107 + #ifdef AIX
108 +        perfstat_memory_total_t mem;
109 +        long long pagesize;
110 + #endif
111   #ifdef WIN32
112          MEMORYSTATUSEX memstats;
113   #endif
# Line 123 | Line 131 | sg_mem_stats *sg_get_mem_stats(){
131          mem_stat.total = ((long long) pstat_static->physical_memory) * pagesize;
132          mem_stat.free = ((long long) pstat_dynamic.psd_free) * pagesize;
133          mem_stat.used = mem_stat.total - mem_stat.free;
134 + #endif
135 + #ifdef AIX
136 +        if((pagesize=sysconf(_SC_PAGESIZE)) == -1){
137 +                sg_set_error_with_errno(SG_ERROR_SYSCONF, "_SC_PAGESIZE");
138 +                return NULL;
139 +        }
140 +
141 +        /* return code is number of structures returned */
142 +        if(perfstat_memory_total(NULL, &mem, sizeof(perfstat_memory_total_t), 1) != 1) {
143 +                sg_set_error_with_errno(SG_ERROR_SYSCTLBYNAME, "perfstat_memory_total");
144 +                return NULL;
145 +        }
146 +
147 +        mem_stat.total = ((long long) mem.real_total) * pagesize;
148 +        mem_stat.free  = ((long long) mem.real_free)  * pagesize;
149 +        mem_stat.used  = ((long long) mem.real_inuse) * pagesize;
150 +        mem_stat.cache = ((long long) mem.numperm)    * pagesize;
151   #endif
152   #ifdef SOLARIS
153          if((pagesize=sysconf(_SC_PAGESIZE)) == -1){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines