From 97e01009d69b8fbebfebf68f51e3d126d0ed43fc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 30 Nov 2022 19:47:05 +0100 Subject: Merging upstream version 1.37.0. Signed-off-by: Daniel Baumann --- collectors/proc.plugin/proc_loadavg.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'collectors/proc.plugin/proc_loadavg.c') diff --git a/collectors/proc.plugin/proc_loadavg.c b/collectors/proc.plugin/proc_loadavg.c index 8b78ecc9e..d928c8617 100644 --- a/collectors/proc.plugin/proc_loadavg.c +++ b/collectors/proc.plugin/proc_loadavg.c @@ -52,9 +52,6 @@ int do_proc_loadavg(int update_every, usec_t dt) { // //unsigned long long next_pid = str2ull(procfile_lineword(ff, 0, 5)); - - // -------------------------------------------------------------------- - if(next_loadavg_dt <= dt) { if(likely(do_loadavg)) { static RRDSET *load_chart = NULL; @@ -80,8 +77,6 @@ int do_proc_loadavg(int update_every, usec_t dt) { rd_load5 = rrddim_add(load_chart, "load5", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE); rd_load15 = rrddim_add(load_chart, "load15", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE); } - else - rrdset_next(load_chart); rrddim_set_by_pointer(load_chart, rd_load1, (collected_number) (load1 * 1000)); rrddim_set_by_pointer(load_chart, rd_load5, (collected_number) (load5 * 1000)); @@ -90,16 +85,17 @@ int do_proc_loadavg(int update_every, usec_t dt) { next_loadavg_dt = load_chart->update_every * USEC_PER_SEC; } - else next_loadavg_dt = MIN_LOADAVG_UPDATE_EVERY * USEC_PER_SEC; + else + next_loadavg_dt = MIN_LOADAVG_UPDATE_EVERY * USEC_PER_SEC; } - else next_loadavg_dt -= dt; + else + next_loadavg_dt -= dt; - // -------------------------------------------------------------------- if(likely(do_all_processes)) { static RRDSET *processes_chart = NULL; static RRDDIM *rd_active = NULL; - static RRDSETVAR *rd_pidmax; + static const RRDSETVAR_ACQUIRED *rd_pidmax; if(unlikely(!processes_chart)) { processes_chart = rrdset_create_localhost( @@ -118,12 +114,11 @@ int do_proc_loadavg(int update_every, usec_t dt) { ); rd_active = rrddim_add(processes_chart, "active", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); - rd_pidmax = rrdsetvar_custom_chart_variable_create(processes_chart, "pidmax"); + rd_pidmax = rrdsetvar_custom_chart_variable_add_and_acquire(processes_chart, "pidmax"); } - else rrdset_next(processes_chart); rrddim_set_by_pointer(processes_chart, rd_active, active_processes); - rrdsetvar_custom_chart_variable_set(rd_pidmax, max_processes); + rrdsetvar_custom_chart_variable_set(processes_chart, rd_pidmax, max_processes); rrdset_done(processes_chart); } -- cgit v1.2.3