From ba1d44fe17485ec1427f970957dccbc1baab8037 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 20 Jul 2007 18:02:21 +0000 Subject: [PATCH] [SIGAR-62] stub swap.page_{in,out} --- include/sigar.h | 4 +++- src/os/aix/aix_sigar.c | 2 ++ src/os/darwin/darwin_sigar.c | 3 +++ src/os/hpux/hpux_sigar.c | 4 +++- src/os/linux/linux_sigar.c | 2 ++ src/os/netware/netware_sigar.c | 1 + src/os/osf1/osf1_sigar.c | 2 ++ src/os/solaris/solaris_sigar.c | 2 ++ src/os/stub/stub_sigar.c | 2 ++ src/os/win32/win32_sigar.c | 2 ++ 10 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/sigar.h b/include/sigar.h index fdd732bf..7babe5c9 100644 --- a/include/sigar.h +++ b/include/sigar.h @@ -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); diff --git a/src/os/aix/aix_sigar.c b/src/os/aix/aix_sigar.c index 2ff8a9ef..a2c3ec53 100644 --- a/src/os/aix/aix_sigar.c +++ b/src/os/aix/aix_sigar.c @@ -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); diff --git a/src/os/darwin/darwin_sigar.c b/src/os/darwin/darwin_sigar.c index e8c48bac..7a98c005 100644 --- a/src/os/darwin/darwin_sigar.c +++ b/src/os/darwin/darwin_sigar.c @@ -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 diff --git a/src/os/hpux/hpux_sigar.c b/src/os/hpux/hpux_sigar.c index 2ddab16c..6fd44e75 100644 --- a/src/os/hpux/hpux_sigar.c +++ b/src/os/hpux/hpux_sigar.c @@ -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; } diff --git a/src/os/linux/linux_sigar.c b/src/os/linux/linux_sigar.c index 413aa8d1..467a2c3e 100644 --- a/src/os/linux/linux_sigar.c +++ b/src/os/linux/linux_sigar.c @@ -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; } diff --git a/src/os/netware/netware_sigar.c b/src/os/netware/netware_sigar.c index 48a2978c..bfbb3de2 100644 --- a/src/os/netware/netware_sigar.c +++ b/src/os/netware/netware_sigar.c @@ -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; } diff --git a/src/os/osf1/osf1_sigar.c b/src/os/osf1/osf1_sigar.c index f124f14a..9dcfc641 100644 --- a/src/os/osf1/osf1_sigar.c +++ b/src/os/osf1/osf1_sigar.c @@ -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; } diff --git a/src/os/solaris/solaris_sigar.c b/src/os/solaris/solaris_sigar.c index 9c576d3f..0ebeda6f 100644 --- a/src/os/solaris/solaris_sigar.c +++ b/src/os/solaris/solaris_sigar.c @@ -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; } diff --git a/src/os/stub/stub_sigar.c b/src/os/stub/stub_sigar.c index d45262f0..e9bfeaf2 100644 --- a/src/os/stub/stub_sigar.c +++ b/src/os/stub/stub_sigar.c @@ -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; } diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c index 7a58f7ea..23bb5e65 100644 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -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; }