OpenBSD sigar_swap_get impl

This commit is contained in:
Doug MacEachern 2008-02-18 00:03:22 +00:00
parent 34c19b60b9
commit 06059b41fe
1 changed files with 11 additions and 2 deletions

View File

@ -574,8 +574,17 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
else {
swap->page_in = swap->page_out = -1;
}
#else
/*XXX OpenBSD*/
#elif defined(__OpenBSD__)
struct uvmexp vmstat;
if ((status = sigar_vmstat(sigar, &vmstat)) != SIGAR_OK) {
return status;
}
swap->total = vmstat.swpages * sigar->pagesize;
swap->used = vmstat.swpginuse * sigar->pagesize;
swap->free = swap->total - swap->used;
swap->page_in = vmstat.pageins;
swap->page_out = vmstat.pdpageouts;
#endif
return SIGAR_OK;