diff options
author | Markos Fountoulakis <44345837+mfundul@users.noreply.github.com> | 2020-11-06 14:43:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-06 14:43:23 +0200 |
commit | a9d02495c799b560289ccb14d036a44edca7dacc (patch) | |
tree | b67b228f2b59870403fd69a2ab322b611cdd93d9 /collectors/proc.plugin | |
parent | b873b655ce2adb75cac07decfb8e2687e8fa8c6c (diff) |
Move shared memory accounting from "cached" to "used" dimension (#10183)
* Move shared memory accounting from "cached" to "used" dimension
Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
Diffstat (limited to 'collectors/proc.plugin')
-rw-r--r-- | collectors/proc.plugin/proc_meminfo.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/collectors/proc.plugin/proc_meminfo.c b/collectors/proc.plugin/proc_meminfo.c index 92135393d2..51d77fe0b6 100644 --- a/collectors/proc.plugin/proc_meminfo.c +++ b/collectors/proc.plugin/proc_meminfo.c @@ -35,7 +35,7 @@ int do_proc_meminfo(int update_every, usec_t dt) { Writeback = 0, //AnonPages = 0, //Mapped = 0, - //Shmem = 0, + Shmem = 0, Slab = 0, SReclaimable = 0, SUnreclaim = 0, @@ -92,7 +92,7 @@ int do_proc_meminfo(int update_every, usec_t dt) { arl_expect(arl_base, "Writeback", &Writeback); //arl_expect(arl_base, "AnonPages", &AnonPages); //arl_expect(arl_base, "Mapped", &Mapped); - //arl_expect(arl_base, "Shmem", &Shmem); + arl_expect(arl_base, "Shmem", &Shmem); arl_expect(arl_base, "Slab", &Slab); arl_expect(arl_base, "SReclaimable", &SReclaimable); arl_expect(arl_base, "SUnreclaim", &SUnreclaim); @@ -145,8 +145,8 @@ int do_proc_meminfo(int update_every, usec_t dt) { // -------------------------------------------------------------------- - // http://stackoverflow.com/questions/3019748/how-to-reliably-measure-available-memory-in-linux - unsigned long long MemCached = Cached + SReclaimable; + // http://calimeroteknik.free.fr/blag/?article20/really-used-memory-on-gnu-linux + unsigned long long MemCached = Cached + SReclaimable - Shmem; unsigned long long MemUsed = MemTotal - MemFree - MemCached - Buffers; if(do_ram) { @@ -526,4 +526,3 @@ int do_proc_meminfo(int update_every, usec_t dt) { return 0; } - |