projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
virt plugin: Support new metric from libvirt-5.0.0 virDomainMemoryStats()
[collectd.git]
/
src
/
memory.c
diff --git
a/src/memory.c
b/src/memory.c
index
e49fe84
..
4a3a772
100644
(file)
--- a/
src/memory.c
+++ b/
src/memory.c
@@
-25,8
+25,8
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
@@
-94,8
+94,8
@@
static int pagesize;
#error "No applicable input method."
#endif
#error "No applicable input method."
#endif
-static
_Bool values_absolute = 1
;
-static
_Bool values_percentage = 0
;
+static
bool values_absolute = true
;
+static
bool values_percentage
;
static int memory_config(oconfig_item_t *ci) /* {{{ */
{
static int memory_config(oconfig_item_t *ci) /* {{{ */
{
@@
-163,9
+163,9
@@
static int memory_init(void) {
#define MEMORY_SUBMIT(...) \
do { \
if (values_absolute) \
#define MEMORY_SUBMIT(...) \
do { \
if (values_absolute) \
- plugin_dispatch_multivalue(vl,
0, DS_TYPE_GAUGE, __VA_ARGS__, NULL);
\
+ plugin_dispatch_multivalue(vl,
false, DS_TYPE_GAUGE, __VA_ARGS__, NULL);
\
if (values_percentage) \
if (values_percentage) \
- plugin_dispatch_multivalue(vl,
1, DS_TYPE_GAUGE, __VA_ARGS__, NULL);
\
+ plugin_dispatch_multivalue(vl,
true, DS_TYPE_GAUGE, __VA_ARGS__, NULL);
\
} while (0)
static int memory_read_internal(value_list_t *vl) {
} while (0)
static int memory_read_internal(value_list_t *vl) {
@@
-268,7
+268,7
@@
static int memory_read_internal(value_list_t *vl) {
char *fields[8];
int numfields;
char *fields[8];
int numfields;
-
_Bool detailed_slab_info = 0
;
+
bool detailed_slab_info = false
;
gauge_t mem_total = 0;
gauge_t mem_used = 0;
gauge_t mem_total = 0;
gauge_t mem_used = 0;
@@
-280,8
+280,7
@@
static int memory_read_internal(value_list_t *vl) {
gauge_t mem_slab_unreclaimable = 0;
if ((fh = fopen("/proc/meminfo", "r")) == NULL) {
gauge_t mem_slab_unreclaimable = 0;
if ((fh = fopen("/proc/meminfo", "r")) == NULL) {
- char errbuf[1024];
- WARNING("memory: fopen: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("memory: fopen: %s", STRERRNO);
return -1;
}
return -1;
}
@@
-300,10
+299,10
@@
static int memory_read_internal(value_list_t *vl) {
val = &mem_slab_total;
else if (strncasecmp(buffer, "SReclaimable:", 13) == 0) {
val = &mem_slab_reclaimable;
val = &mem_slab_total;
else if (strncasecmp(buffer, "SReclaimable:", 13) == 0) {
val = &mem_slab_reclaimable;
- detailed_slab_info =
1
;
+ detailed_slab_info =
true
;
} else if (strncasecmp(buffer, "SUnreclaim:", 11) == 0) {
val = &mem_slab_unreclaimable;
} else if (strncasecmp(buffer, "SUnreclaim:", 11) == 0) {
val = &mem_slab_unreclaimable;
- detailed_slab_info =
1
;
+ detailed_slab_info =
true
;
} else
continue;
} else
continue;
@@
-315,8
+314,7
@@
static int memory_read_internal(value_list_t *vl) {
}
if (fclose(fh)) {
}
if (fclose(fh)) {
- char errbuf[1024];
- WARNING("memory: fclose: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("memory: fclose: %s", STRERRNO);
}
if (mem_total < (mem_free + mem_buffered + mem_cached + mem_slab_total))
}
if (mem_total < (mem_free + mem_buffered + mem_cached + mem_slab_total))
@@
-421,9
+419,7
@@
static int memory_read_internal(value_list_t *vl) {
size = sizeof(vmtotal);
if (sysctl(mib, 2, &vmtotal, &size, NULL, 0) < 0) {
size = sizeof(vmtotal);
if (sysctl(mib, 2, &vmtotal, &size, NULL, 0) < 0) {
- char errbuf[1024];
- WARNING("memory plugin: sysctl failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("memory plugin: sysctl failed: %s", STRERRNO);
return -1;
}
return -1;
}
@@
-451,9
+447,7
@@
static int memory_read_internal(value_list_t *vl) {
perfstat_memory_total_t pmemory = {0};
if (perfstat_memory_total(NULL, &pmemory, sizeof(pmemory), 1) < 0) {
perfstat_memory_total_t pmemory = {0};
if (perfstat_memory_total(NULL, &pmemory, sizeof(pmemory), 1) < 0) {
- char errbuf[1024];
- WARNING("memory plugin: perfstat_memory_total failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("memory plugin: perfstat_memory_total failed: %s", STRERRNO);
return -1;
}
return -1;
}