[SIGAR-38] Change win32 swap_get to use GlobalMemoryStatusEx
This commit is contained in:
parent
8802b3929b
commit
db6cc45f1c
|
@ -1,3 +1,7 @@
|
|||
2007-01-29 Doug MacEachern <dougm@hyperic.com>
|
||||
|
||||
* [SIGAR-38] Change win32 swap_get to use GlobalMemoryStatusEx
|
||||
|
||||
2007-01-24 Doug MacEachern <dougm@hyperic.com>
|
||||
|
||||
* Add proper thread_cpu impl for OS X
|
||||
|
|
|
@ -521,12 +521,27 @@ SIGAR_DECLARE(int) sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
|
|||
|
||||
SIGAR_DECLARE(int) sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
||||
{
|
||||
DLLMOD_INIT(kernel, TRUE);
|
||||
|
||||
if (sigar_GlobalMemoryStatusEx) {
|
||||
MEMORYSTATUSEX memstat;
|
||||
|
||||
memstat.dwLength = sizeof(memstat);
|
||||
|
||||
if (!sigar_GlobalMemoryStatusEx(&memstat)) {
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
swap->total = memstat.ullTotalPageFile;
|
||||
swap->free = memstat.ullAvailPageFile;
|
||||
}
|
||||
else {
|
||||
MEMORYSTATUS memstat;
|
||||
|
||||
GlobalMemoryStatus(&memstat);
|
||||
|
||||
swap->total = memstat.dwTotalPageFile;
|
||||
swap->free = memstat.dwAvailPageFile;
|
||||
}
|
||||
|
||||
swap->used = swap->total - swap->free;
|
||||
|
||||
return SIGAR_OK;
|
||||
|
|
Loading…
Reference in New Issue