summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cce1f27)
raw | patch | inline | side by side (parent: cce1f27)
author | Florian Forster <octo@collectd.org> | |
Sat, 6 Jun 2015 19:37:00 +0000 (21:37 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Sat, 6 Jun 2015 19:37:00 +0000 (21:37 +0200) |
Should reading the number of threads from /prod/$pid/status fail, use the
number provided by /prod/$pid/stat as a fallback. If that fails, too, use 1.
As discussed with @manuelluis in #1033.
number provided by /prod/$pid/stat as a fallback. If that fails, too, use 1.
As discussed with @manuelluis in #1033.
src/processes.c | patch | blob | history |
diff --git a/src/processes.c b/src/processes.c
index 8b7d75989aa6bfc7f71effe844183cd4475b2196..176cdf9d750030b8bd8a07db2ac75c05b6fc51ec 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
ps->vmem_data = data * 1024;
ps->vmem_code = (exe + lib) * 1024;
- ps->num_lwp = threads;
+ if (threads != 0)
+ ps->num_lwp = threads;
return (ps);
} /* procstat_t *ps_read_vmem */
}
else
{
- if ( (ps_read_status(pid, ps)) == NULL)
+ ps->num_lwp = strtoul (fields[17], /* endptr = */ NULL, /* base = */ 10);
+ if ((ps_read_status(pid, ps)) == NULL)
{
/* No VMem data */
ps->vmem_data = -1;
ps->vmem_code = -1;
- ps->num_lwp = 0;
DEBUG("ps_read_process: did not get vmem data for pid %i",pid);
}
- if ( ps->num_lwp <= 0)
- {
+ if (ps->num_lwp <= 0)
ps->num_lwp = 1;
- }
ps->num_proc = 1;
}