@cryptotaxi247 / netdata-1 / commits / 563e91e17

more clear comparisons of dt given by plugins

Costa Tsaousis (ktsaou) committed Nov 7, 2016 at 23:42 UTC 563e91e17c7387ab0cfa2acb9f194a13cc782452
1 file changed +6 -6
src/rrd.c
+6 -6
@@ -1003,21 +1003,21 @@ void rrdset_next_usec(RRDSET *st, unsigned long long microseconds)
1003 unsigned long long since_last_usec = usec_dt(&now, &st->last_collected_time);
1004
1005 // verify the microseconds given is good
1006 - if(unlikely(last_usec + microseconds > now_usec)) {
1007 - debug(D_RRD_CALLS, "dt %llu usec given is too big - it leads %llu usec to the future, for chart '%s' (%s).", microseconds, last_usec + microseconds - now_usec, st->name, st->id);
1006 + if(unlikely(microseconds > since_last_usec)) {
1007 + debug(D_RRD_CALLS, "dt %llu usec given is too big - it leads %llu usec to the future, for chart '%s' (%s).", microseconds, microseconds - since_last_usec, st->name, st->id);
1008
1009 #ifdef NETDATA_INTERNAL_CHECKS
1010 if(unlikely(last_usec + microseconds > now_usec + 1000))
1011 - error("dt %llu usec given is too big - it leads %llu usec to the future, for chart '%s' (%s).", microseconds, last_usec + microseconds - now_usec, st->name, st->id);
1011 + error("dt %llu usec given is too big - it leads %llu usec to the future, for chart '%s' (%s).", microseconds, microseconds - since_last_usec, st->name, st->id);
1012 #endif
1013
1014 microseconds = since_last_usec;
1015 }
1016 - else if(unlikely(microseconds < since_last_usec * 0.8 || microseconds > since_last_usec * 1.2)) {
1017 - debug(D_RRD_CALLS, "dt %llu usec given is wrong - expected %llu usec +/- 20%%, for chart '%s' (%s).", microseconds, since_last_usec, st->name, st->id);
1016 + else if(unlikely(microseconds < since_last_usec * 0.8)) {
1017 + debug(D_RRD_CALLS, "dt %llu usec given is too small - expected %llu usec up to -20%%, for chart '%s' (%s).", microseconds, since_last_usec, st->name, st->id);
1018
1019 #ifdef NETDATA_INTERNAL_CHECKS
1020 - error("dt %llu usec given is wrong - expected %llu usec +/- 20%%, for chart '%s' (%s).", microseconds, since_last_usec, st->name, st->id);
1020 + error("dt %llu usec given is too small - expected %llu usec up to -20%%, for chart '%s' (%s).", microseconds, since_last_usec, st->name, st->id);
1021 #endif
1022 microseconds = since_last_usec;
1023 }