diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2023-02-03 15:47:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-03 15:47:02 +0000 |
commit | e2c26406560caab8a39d87d2ad270dc3ad0f716c (patch) | |
tree | bbc689b55833b4c56f0d7be238688bde29310224 /collectors/ebpf.plugin/ebpf_dcstat.c | |
parent | a136acf0f63a75691705512a2f59e6aa3b0a9f16 (diff) |
Reduce service exit (#14381)
Diffstat (limited to 'collectors/ebpf.plugin/ebpf_dcstat.c')
-rw-r--r-- | collectors/ebpf.plugin/ebpf_dcstat.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/collectors/ebpf.plugin/ebpf_dcstat.c b/collectors/ebpf.plugin/ebpf_dcstat.c index d1e189d1ad..75e83214ab 100644 --- a/collectors/ebpf.plugin/ebpf_dcstat.c +++ b/collectors/ebpf.plugin/ebpf_dcstat.c @@ -985,12 +985,14 @@ static void dcstat_collector(ebpf_module_t *em) int update_every = em->update_every; heartbeat_t hb; heartbeat_init(&hb); - usec_t step = update_every * USEC_PER_SEC; + int counter = update_every - 1; while (!ebpf_exit_plugin) { - (void)heartbeat_next(&hb, step); - if (ebpf_exit_plugin) - break; + (void)heartbeat_next(&hb, USEC_PER_SEC); + if (ebpf_exit_plugin || ++counter != update_every) + continue; + + counter = 0; netdata_apps_integration_flags_t apps = em->apps_charts; ebpf_dc_read_global_table(); pthread_mutex_lock(&collect_data_mutex); |