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_hardirq.c | |
parent | a136acf0f63a75691705512a2f59e6aa3b0a9f16 (diff) |
Reduce service exit (#14381)
Diffstat (limited to 'collectors/ebpf.plugin/ebpf_hardirq.c')
-rw-r--r-- | collectors/ebpf.plugin/ebpf_hardirq.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/collectors/ebpf.plugin/ebpf_hardirq.c b/collectors/ebpf.plugin/ebpf_hardirq.c index 4541afa254..20c4b9d052 100644 --- a/collectors/ebpf.plugin/ebpf_hardirq.c +++ b/collectors/ebpf.plugin/ebpf_hardirq.c @@ -396,13 +396,16 @@ static void hardirq_collector(ebpf_module_t *em) // loop and read from published data until ebpf plugin is closed. heartbeat_t hb; heartbeat_init(&hb); - usec_t step = em->update_every * USEC_PER_SEC; + int update_every = em->update_every; + int counter = update_every - 1; //This will be cancelled by its parent 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; hardirq_reader(); pthread_mutex_lock(&lock); |