[SIGAR-62] stub swap.page_{in,out}
This commit is contained in:
parent
db2eb59a4c
commit
ba1d44fe17
|
@ -134,7 +134,9 @@ typedef struct {
|
|||
sigar_uint64_t
|
||||
total,
|
||||
used,
|
||||
free;
|
||||
free,
|
||||
page_in,
|
||||
page_out;
|
||||
} sigar_swap_t;
|
||||
|
||||
SIGAR_DECLARE(int) sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap);
|
||||
|
|
|
@ -684,6 +684,8 @@ static int sigar_swap_get_perfstat(sigar_t *sigar, sigar_swap_t *swap)
|
|||
|
||||
int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
||||
{
|
||||
swap->page_in = swap->page_out = -1;
|
||||
|
||||
if (sigar_perfstat_init(sigar) == SIGAR_OK) {
|
||||
sigar_log(sigar, SIGAR_LOG_DEBUG, "[swap] using libperfstat");
|
||||
return sigar_swap_get_perfstat(sigar, swap);
|
||||
|
|
|
@ -450,6 +450,7 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||
|
||||
swap->free = swap->total - swap->used;
|
||||
|
||||
swap->page_in = swap->page_out = -1;
|
||||
#elif defined(__FreeBSD__)
|
||||
struct kvm_swap kswap[1];
|
||||
|
||||
|
@ -473,6 +474,8 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||
swap->total = kswap[0].ksw_total * sigar->pagesize;
|
||||
swap->used = kswap[0].ksw_used * sigar->pagesize;
|
||||
swap->free = swap->total - swap->used;
|
||||
|
||||
swap->page_in = swap->page_out = -1;
|
||||
#else
|
||||
/*XXX OpenBSD*/
|
||||
#endif
|
||||
|
|
|
@ -116,7 +116,9 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||
}
|
||||
|
||||
swap->used = swap->total - swap->free;
|
||||
|
||||
|
||||
swap->page_in = swap->page_out = -1;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -438,6 +438,8 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||
swap->free = sigar_meminfo(buffer, MEMINFO_PARAM("SwapFree"));
|
||||
swap->used = swap->total - swap->free;
|
||||
|
||||
swap->page_in = swap->page_out = -1;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||
swap->used = info.SwapPageCount * PAGESIZE;
|
||||
swap->free = info.SwapFreeCount * PAGESIZE;
|
||||
swap->total = swap->used + swap->free;
|
||||
swap->page_in = swap->page_out = -1;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
|
|
@ -86,6 +86,8 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||
|
||||
swap->used = swap->total - swap->free;
|
||||
|
||||
swap->page_in = swap->page_out = -1;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -246,6 +246,8 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||
swap->free <<= sigar->pagesize;
|
||||
swap->used <<= sigar->pagesize;
|
||||
|
||||
swap->page_in = swap->page_out = -1;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||
swap->total = -1;
|
||||
swap->used = -1;
|
||||
swap->free = -1;
|
||||
swap->page_in = -1;
|
||||
swap->page_out = -1;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
|
|
@ -545,6 +545,8 @@ SIGAR_DECLARE(int) sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
|
|||
|
||||
swap->used = swap->total - swap->free;
|
||||
|
||||
swap->page_in = swap->page_out = -1;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue