summaryrefslogtreecommitdiffstats
path: root/collectors/ebpf.plugin/ebpf_cachestat.c
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/ebpf.plugin/ebpf_cachestat.c')
-rw-r--r--collectors/ebpf.plugin/ebpf_cachestat.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/collectors/ebpf.plugin/ebpf_cachestat.c b/collectors/ebpf.plugin/ebpf_cachestat.c
index d322993d1c..b21cc6103d 100644
--- a/collectors/ebpf.plugin/ebpf_cachestat.c
+++ b/collectors/ebpf.plugin/ebpf_cachestat.c
@@ -1067,13 +1067,15 @@ static void cachestat_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;
//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;
netdata_apps_integration_flags_t apps = em->apps_charts;
ebpf_cachestat_read_global_table();
pthread_mutex_lock(&collect_data_mutex);