add some swap logging

This commit is contained in:
Doug MacEachern 2004-07-18 17:46:26 +00:00
parent 1e80697f92
commit 426d2d9e11
1 changed files with 14 additions and 0 deletions

View File

@ -311,6 +311,12 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
return status; return status;
} }
if (SIGAR_LOG_IS_DEBUG(sigar)) {
sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
"[swap] pagesize=%d, shift=%d",
getpagesize(), sigar->pagesize);
}
swap->total = swap->free = 0; swap->total = swap->free = 0;
for (i=0; i<sigar->swaps.num; i++) { for (i=0; i<sigar->swaps.num; i++) {
@ -322,6 +328,14 @@ int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
return errno; return errno;
} }
if (SIGAR_LOG_IS_DEBUG(sigar)) {
sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
"[swap] %s total=%d/%d, free=%d/%d",
sigar->swaps.devs[i],
info.size, PAGESHIFT(info.size),
info.free, PAGESHIFT(info.free));
}
swap->total += PAGESHIFT(info.size); /* lsps -a */ swap->total += PAGESHIFT(info.size); /* lsps -a */
swap->free += PAGESHIFT(info.free); swap->free += PAGESHIFT(info.free);
} }