From 02c7235d4de2153a6044dc7cc9b4ae0f85e7c372 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 20 Nov 2004 02:23:57 +0000 Subject: [PATCH] adjust mem.actual_{used,free} +/- buffers/cache --- src/os/linux/linux_sigar.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/os/linux/linux_sigar.c b/src/os/linux/linux_sigar.c index 2160232e..9860fb60 100644 --- a/src/os/linux/linux_sigar.c +++ b/src/os/linux/linux_sigar.c @@ -233,7 +233,7 @@ static SIGAR_INLINE sigar_uint64_t sigar_meminfo(char *buffer, int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem) { - sigar_uint64_t buffer, cached; + sigar_uint64_t buffers, cached, kern; char buffer[BUFSIZ]; int status = sigar_file2str(PROC_MEMINFO, @@ -247,11 +247,12 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem) mem->free = sigar_meminfo(buffer, MEMINFO_PARAM("MemFree")); mem->used = mem->total - mem->free; - buffer = sigar_meminfo(buffer, MEMINFO_PARAM("Buffers")); - cached = sigar_meminfo(buffer, MEMINFO_PARAM("Cached")); + buffers = sigar_meminfo(buffer, MEMINFO_PARAM("Buffers")); + cached = sigar_meminfo(buffer, MEMINFO_PARAM("Cached")); - mem->actual_free = mem->free; - mem->actual_used = mem->used; + kern = buffers + cached; + mem->actual_free = mem->free + kern; + mem->actual_used = mem->used - kern; mem->shared = 0; /* XXX where did this go in 2.6?? */