summaryrefslogtreecommitdiffstats
path: root/src/plugin_idlejitter.c
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2017-04-30 16:09:37 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2017-04-30 18:09:45 +0000
commitbed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521 (patch)
tree519e5945ec0db75bfb50583539caa408a5819e87 /src/plugin_idlejitter.c
parentTemporarily disable signature checking (diff)
downloadnetdata-bed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521.tar.xz
netdata-bed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521.zip
New upstream version 1.6.0+dfsg
Diffstat (limited to 'src/plugin_idlejitter.c')
-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 7d4a4c189..2ed78160c 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);