From: Pavel Rochnyack Date: Wed, 19 Dec 2018 13:44:25 +0000 (+0700) Subject: processes: Reduce procstat entry 'age' limit X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=471b37345751027b75366f28a17ef993fdae9b33;p=collectd.git processes: Reduce procstat entry 'age' limit The 'age' value can grow only when process terminated. There is no sence to wait 10 read cycles for process rebirth. Theoretically, this reduces probability for process data takeover by another process with same pid. Issue: #3026 --- diff --git a/src/processes.c b/src/processes.c index 171dde95..2e3b927e 100644 --- a/src/processes.c +++ b/src/processes.c @@ -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; @@ -617,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); @@ -632,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; }