* Copyright (C) 2009 Sebastian Harl
* Copyright (C) 2009 Andrés J. Díaz
* Copyright (C) 2009 Manuel Sanmartin
+ * Copyright (C) 2010 Clément Stenac
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Sebastian Harl <sh at tokkee.org>
* Andrés J. Díaz <ajdiaz at connectical.com>
* Manuel Sanmartin
+ * Clément Stenac <clement.stenac at diwi.org>
**/
#include "collectd.h"
# define ARG_MAX 4096
#endif
-#define BUFSIZE 256
-
static const char *config_keys[] =
{
"Process",
if ((fh = fopen (filename, "r")) == NULL)
return (NULL);
- while (fgets (buffer, 1024, fh) != NULL)
+ while (fgets (buffer, sizeof(buffer), fh) != NULL)
{
long long tmp;
char *endptr;
- if (strncasecmp (buffer, "Vm", 2) != 0)
+ if (strncmp (buffer, "Vm", 2) != 0)
continue;
- numfields = strsplit (buffer, fields, 8);
+ numfields = strsplit (buffer, fields,
+ STATIC_ARRAY_SIZE (fields));
if (numfields < 2)
continue;
if ((fh = fopen (filename, "r")) == NULL)
return (NULL);
- while (fgets (buffer, 1024, fh) != NULL)
+ while (fgets (buffer, sizeof (buffer), fh) != NULL)
{
derive_t *val = NULL;
long long tmp;
else
continue;
- numfields = strsplit (buffer, fields, 8);
+ numfields = strsplit (buffer, fields,
+ STATIC_ARRAY_SIZE (fields));
if (numfields < 2)
continue;
return (-1);
buffer[i] = 0;
- fields_len = strsplit (buffer, fields, 64);
+ fields_len = strsplit (buffer, fields, STATIC_ARRAY_SIZE (fields));
if (fields_len < 24)
{
DEBUG ("processes plugin: ps_read_process (pid = %i):"
errno = 0;
endptr = NULL;
- result = strtoul(fields[1], &endptr, 10);
+ result = strtoul(fields[1], &endptr, /* base = */ 10);
if ((endptr == fields[1]) || (errno != 0)) {
ERROR ("processes plugin: Cannot parse fork rate: %s",
fields[1]);
}
pse.num_proc++;
+ pse.vmem_size = task_basic_info.virtual_size;
pse.vmem_rss = task_basic_info.resident_size;
/* Does not seem to be easily exposed */
pse.vmem_data = 0;
pse.vmem_code = 0;
pse.stack_size = 0;
+ pse.io_rchar = -1;
+ pse.io_wchar = -1;
+ pse.io_syscr = -1;
+ pse.io_syscw = -1;
+
ps_list_add (cmdline, cargs, &pse);
} /* for (i = 0 .. nprocs) */