summaryrefslogtreecommitdiffstats
path: root/collectors/idlejitter.plugin/plugin_idlejitter.c
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2022-11-22 04:52:15 +0200
committerGitHub <noreply@github.com>2022-11-22 04:52:15 +0200
commit2d5f3acf71f0c759056a3269987fee484566bc4c (patch)
tree5246e1080ea721ba84e5f749f8d8e98d978d81c8 /collectors/idlejitter.plugin/plugin_idlejitter.c
parent147552807bc19af949fe3cb315c4743dadfa7f0b (diff)
Do not force internal collectors to call rrdset_next. (#13926)
* Remove calls to rrdset_next(). * Rm checks plugin * Update documentantion * Call rrdset_next from within rrdset_done This wraps up the removal of rrdset_next from internal collectors, which removes a lot of unecessary code and the need for if/else clauses in every place. The pluginsd parser is the only component that calls rrdset_next*() functions because it's not strictly speaking a collector but more of a collector manager/proxy. With the current changes it's possible to simplify the API we expose from RRD significantly, but this will be follow-up work in the future. * Remove stale reference to checks.plugin * Fix RRD unit test rrdset_next is not meant to be called from these tests. * Fix db engine unit test. * Schedule rrdset_next when we have completed at least one collection. * Mark chart creation clauses as unlikely. * Add missing brace to fix FreeBSD plugin.
Diffstat (limited to 'collectors/idlejitter.plugin/plugin_idlejitter.c')
-rw-r--r--collectors/idlejitter.plugin/plugin_idlejitter.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/collectors/idlejitter.plugin/plugin_idlejitter.c b/collectors/idlejitter.plugin/plugin_idlejitter.c
index 535819c69f..b6339cc0fc 100644
--- a/collectors/idlejitter.plugin/plugin_idlejitter.c
+++ b/collectors/idlejitter.plugin/plugin_idlejitter.c
@@ -47,18 +47,15 @@ void *cpuidlejitter_main(void *ptr) {
usec_t update_every_ut = localhost->rrd_update_every * USEC_PER_SEC;
struct timeval before, after;
- unsigned long long counter;
- for(counter = 0; 1 ;counter++) {
+ while (!netdata_exit) {
int iterations = 0;
usec_t error_total = 0,
error_min = 0,
error_max = 0,
elapsed = 0;
- if(netdata_exit) break;
-
- while(elapsed < update_every_ut) {
+ while (elapsed < update_every_ut) {
now_monotonic_high_precision_timeval(&before);
worker_is_idle();
sleep_usec(sleep_ut);
@@ -82,10 +79,7 @@ void *cpuidlejitter_main(void *ptr) {
iterations++;
}
- if(netdata_exit) break;
-
if(iterations) {
- if (likely(counter)) rrdset_next(st);
rrddim_set_by_pointer(st, rd_min, error_min);
rrddim_set_by_pointer(st, rd_max, error_max);
rrddim_set_by_pointer(st, rd_avg, error_total / iterations);