diff --git a/src/os/darwin/darwin_sigar.c b/src/os/darwin/darwin_sigar.c index f5f7f73c..2aa4d3f7 100644 --- a/src/os/darwin/darwin_sigar.c +++ b/src/os/darwin/darwin_sigar.c @@ -417,6 +417,8 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap) char swapfile[SSTRLEN(VM_DIR) + SSTRLEN("/") + SSTRLEN(SWAPFILE) + 12]; struct stat swapstat; struct statfs vmfs; + int status; + vm_statistics_data_t vmstat; swap->used = swap->total = swap->free = 0; @@ -464,7 +466,11 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap) swap->free = swap->total - swap->used; - swap->page_in = swap->page_out = -1; + if ((status = sigar_vmstat(sigar, &vmstat)) != SIGAR_OK) { + return status; + } + swap->page_in = vmstat.pageins; + swap->page_out = vmstat.pageouts; #elif defined(__FreeBSD__) struct kvm_swap kswap[1];