adjust mem.actual_{used,free} +/- buffers/cache
This commit is contained in:
parent
6e7e2a4b0d
commit
02c7235d4d
|
@ -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?? */
|
||||
|
||||
|
|
Loading…
Reference in New Issue