From: Manuel CISSÉ Date: Thu, 20 Feb 2014 15:06:56 +0000 (+0100) Subject: memory plugin: Add slab memory stats (linux) X-Git-Tag: collectd-5.5.0~186 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=002fec64b13f6618d5588d0590998a4b3b82bc57;p=collectd.git memory plugin: Add slab memory stats (linux) Pull-Request: #560 --- diff --git a/src/memory.c b/src/memory.c index c503821b..8166accd 100644 --- a/src/memory.c +++ b/src/memory.c @@ -283,6 +283,8 @@ static int memory_read_internal (value_list_t *vl) gauge_t mem_buffered = 0; gauge_t mem_cached = 0; gauge_t mem_free = 0; + gauge_t mem_slab_reclaimable = 0; + gauge_t mem_slab_unreclaimable = 0; if ((fh = fopen ("/proc/meminfo", "r")) == NULL) { @@ -304,6 +306,10 @@ static int memory_read_internal (value_list_t *vl) val = &mem_buffered; else if (strncasecmp (buffer, "Cached:", 7) == 0) val = &mem_cached; + else if (strncasecmp (buffer, "SReclaimable:", 13) == 0) + val = &mem_slab_reclaimable; + else if (strncasecmp (buffer, "SUnreclaim:", 11) == 0) + val = &mem_slab_unreclaimable; else continue; @@ -324,11 +330,13 @@ static int memory_read_internal (value_list_t *vl) if (mem_total < (mem_free + mem_buffered + mem_cached)) return (-1); - mem_used = mem_total - (mem_free + mem_buffered + mem_cached); - MEMORY_SUBMIT ("used", mem_used, - "buffered", mem_buffered, - "cached", mem_cached, - "free", mem_free); + mem_used = mem_total - (mem_free + mem_buffered + mem_cached + mem_slab_unreclaimable + mem_slab_reclaimable); + MEMORY_SUBMIT ("used", mem_used, + "buffered", mem_buffered, + "cached", mem_cached, + "free", mem_free, + "slab_unrecl", mem_slab_unreclaimable, + "slab_recl", mem_slab_reclaimable); /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT