skip swap device if not active

This commit is contained in:
Doug MacEachern 2004-07-20 15:42:05 +00:00
parent 1df568b4ef
commit d87f4e50d8
1 changed files with 8 additions and 2 deletions

View File

@ -534,8 +534,14 @@ static int sigar_swap_get_perfstat(sigar_t *sigar, sigar_swap_t *swap)
} }
if (SIGAR_LOG_IS_DEBUG(sigar)) { if (SIGAR_LOG_IS_DEBUG(sigar)) {
sigar_log_printf(sigar, SIGAR_LOG_DEBUG, sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
"[swap] dev=%s: total=%lluMb, used=%lluMb", "[swap] dev=%s: active=%s, "
SWAP_DEV(ps), ps.mb_size, ps.mb_used); "total=%lluMb, used=%lluMb",
SWAP_DEV(ps),
((ps.active == 1) ? "yes" : "no"),
ps.mb_size, ps.mb_used);
}
if (ps.active != 1) {
continue;
} }
/* convert MB sizes to bytes */ /* convert MB sizes to bytes */
swap->total += SWAP_MB_TO_BYTES(ps.mb_size); swap->total += SWAP_MB_TO_BYTES(ps.mb_size);