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" |
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 |
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){ |