darwin swap.page_{in,out} impl
This commit is contained in:
parent
ea1427b004
commit
93f4553c1e
@ -417,6 +417,8 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||||||
char swapfile[SSTRLEN(VM_DIR) + SSTRLEN("/") + SSTRLEN(SWAPFILE) + 12];
|
char swapfile[SSTRLEN(VM_DIR) + SSTRLEN("/") + SSTRLEN(SWAPFILE) + 12];
|
||||||
struct stat swapstat;
|
struct stat swapstat;
|
||||||
struct statfs vmfs;
|
struct statfs vmfs;
|
||||||
|
int status;
|
||||||
|
vm_statistics_data_t vmstat;
|
||||||
|
|
||||||
swap->used = swap->total = swap->free = 0;
|
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->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__)
|
#elif defined(__FreeBSD__)
|
||||||
struct kvm_swap kswap[1];
|
struct kvm_swap kswap[1];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user