@cryptotaxi247 / netdata-1 / commits / 474e0053b

added debug code to trace #3752

Costa Tsaousis (ktsaou) committed Jun 1, 2018 at 02:42 UTC 474e0053bcdd21a8079d41c954ccfea804774657
1 file changed +24
src/rrdset.c
+24
@@ -755,6 +755,30 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) {
755
756 microseconds = (usec_t)since_last_usec;
757 }
758 +
759 +#ifdef NETDATA_INTERNAL_CHECKS
760 + if(since_last_usec > 0 && (susec_t)microseconds < since_last_usec) {
761 + static __thread susec_t min_delta = USEC_PER_SEC * 3600, permanent_min_delta = 0;
762 + static __thread time_t last_t = 0;
763 +
764 + // the first time initialize it so that it will make the check later
765 + if(last_t == 0) last_t = now.tv_sec + 60;
766 +
767 + susec_t delta = since_last_usec - (susec_t)microseconds;
768 + if(delta < min_delta) min_delta = delta;
769 +
770 + if(now.tv_sec >= last_t + 60) {
771 + last_t = now.tv_sec;
772 +
773 + if(min_delta > permanent_min_delta) {
774 + info("MINIMUM MICROSECONDS DELTA of thread %d increased from %lld to %lld (+%lld)", gettid(), permanent_min_delta, min_delta, min_delta - permanent_min_delta);
775 + permanent_min_delta = min_delta;
776 + }
777 +
778 + min_delta = USEC_PER_SEC * 3600;
779 + }
780 + }
781 +#endif
782 }
783
784 #ifdef NETDATA_INTERNAL_CHECKS