X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fprocesses.c;h=ac5ec6041bd221ace5413d2ee88be44b57b50189;hb=25824c65721f0f21cadf1607fad367c7e7831816;hp=aa7cfa395afb559aeaef6da7d262a61f6a4d17d1;hpb=126d448bce2ab48300c05f13ee7eb0a75b214d81;p=collectd.git diff --git a/src/processes.c b/src/processes.c index aa7cfa39..ac5ec604 100644 --- a/src/processes.c +++ b/src/processes.c @@ -38,12 +38,12 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #if HAVE_LIBTASKSTATS +#include "utils/taskstats/taskstats.h" #include "utils_complain.h" -#include "utils_taskstats.h" #endif /* Include header files for the mach system, if they exist.. */ @@ -216,7 +216,7 @@ typedef struct process_entry_s { typedef struct procstat_entry_s { unsigned long id; - unsigned long age; + unsigned char age; derive_t vmem_minflt_counter; derive_t vmem_majflt_counter; @@ -587,7 +587,8 @@ static void ps_list_add(const char *name, const char *cmdline, entry->cpu_system_counter); #if HAVE_LIBTASKSTATS - ps_update_delay(ps, pse, entry); + if (entry->has_delay) + ps_update_delay(ps, pse, entry); #endif } } @@ -616,7 +617,7 @@ static void ps_list_reset(void) { pse_prev = NULL; pse = ps->instances; while (pse != NULL) { - if (pse->age > 10) { + if (pse->age > 0) { DEBUG("Removing this procstat entry cause it's too old: " "id = %lu; name = %s;", pse->id, ps->name); @@ -631,7 +632,7 @@ static void ps_list_reset(void) { pse = pse_prev->next; } } else { - pse->age++; + pse->age = 1; pse_prev = pse; pse = pse->next; } @@ -1577,7 +1578,6 @@ static char *ps_get_cmdline(long pid, return NULL; } - info.pr_psargs[sizeof(info.pr_psargs) - 1] = 0; sstrncpy(buffer, info.pr_psargs, buffer_size); return buffer;