summaryrefslogtreecommitdiffstats
path: root/src/plugin_idlejitter.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/plugin_idlejitter.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugin_idlejitter.c b/src/plugin_idlejitter.c
index 7d4a4c18..2ed78160 100644
--- a/src/plugin_idlejitter.c
+++ b/src/plugin_idlejitter.c
@@ -19,10 +19,11 @@ void *cpuidlejitter_main(void *ptr) {
sleep_ms = CPU_IDLEJITTER_SLEEP_TIME_MS;
}
- RRDSET *st = rrdset_find("system.idlejitter");
+ RRDSET *st = rrdset_find_localhost("system.idlejitter");
if(!st) {
- st = rrdset_create("system", "idlejitter", NULL, "processes", NULL, "CPU Idle Jitter", "microseconds lost/s", 9999, rrd_update_every, RRDSET_TYPE_LINE);
- rrddim_add(st, "jitter", NULL, 1, 1, RRDDIM_ABSOLUTE);
+ st = rrdset_create_localhost("system", "idlejitter", NULL, "processes", NULL, "CPU Idle Jitter"
+ , "microseconds lost/s", 9999, localhost->rrd_update_every, RRDSET_TYPE_LINE);
+ rrddim_add(st, "jitter", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
}
struct timeval before, after;
@@ -30,11 +31,13 @@ void *cpuidlejitter_main(void *ptr) {
for(counter = 0; 1 ;counter++) {
usec_t usec = 0, susec = 0;
- while(susec < (rrd_update_every * USEC_PER_SEC)) {
+ if(netdata_exit) break;
- now_realtime_timeval(&before);
+ while(susec < (localhost->rrd_update_every * USEC_PER_SEC)) {
+
+ now_monotonic_timeval(&before);
sleep_usec(sleep_ms * 1000);
- now_realtime_timeval(&after);
+ now_monotonic_timeval(&after);
// calculate the time it took for a full loop
usec = dt_usec(&after, &before);