**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
static int memory_config (oconfig_item_t *ci) /* {{{ */
{
- int i;
-
- for (i = 0; i < ci->children_num; i++)
+ for (int i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("ValuesAbsolute", child->key) == 0)
* vm.stats.vm.v_inactive_count: 113730
* vm.stats.vm.v_cache_count: 10809
*/
- char *sysctl_keys[8] =
+ const char *sysctl_keys[8] =
{
"vm.stats.vm.v_page_size",
"vm.stats.vm.v_page_count",
};
double sysctl_vals[8];
- int i;
-
- for (i = 0; sysctl_keys[i] != NULL; i++)
+ for (int i = 0; sysctl_keys[i] != NULL; i++)
{
int value;
size_t value_len = sizeof (value);
} /* for (sysctl_keys) */
/* multiply all all page counts with the pagesize */
- for (i = 1; sysctl_keys[i] != NULL; i++)
+ for (int i = 1; sysctl_keys[i] != NULL; i++)
if (!isnan (sysctl_vals[i]))
sysctl_vals[i] *= sysctl_vals[0];
#elif HAVE_SYSCTL
int mib[] = {CTL_VM, VM_METER};
- struct vmtotal vmtotal;
+ struct vmtotal vmtotal = { 0 };
gauge_t mem_active;
gauge_t mem_inactive;
gauge_t mem_free;
size_t size;
- memset (&vmtotal, 0, sizeof (vmtotal));
size = sizeof (vmtotal);
if (sysctl (mib, 2, &vmtotal, &size, NULL, 0) < 0) {
/* #endif HAVE_LIBSTATGRAB */
#elif HAVE_PERFSTAT
- perfstat_memory_total_t pmemory;
+ perfstat_memory_total_t pmemory = { 0 };
- memset (&pmemory, 0, sizeof (pmemory));
if (perfstat_memory_total(NULL, &pmemory, sizeof(pmemory), 1) < 0)
{
char errbuf[1024];