@cryptotaxi247 / netdata-1 / commits / a86641cf0

adaptive calculation of duration in microseconds for each chart refresh, when duration is not given by the chart owner

Costa Tsaousis (ktsaou) committed Jun 1, 2014 at 13:27 UTC a86641cf0d195d4e6602efac535c94040487159f
1 file changed +10 -2
netdata.c
+10 -2
@@ -1697,12 +1697,20 @@ void rrd_stats_next_usec(RRD_STATS *st, unsigned long long microseconds)
1697
1698 void rrd_stats_next(RRD_STATS *st)
1699 {
1700 - rrd_stats_next_usec(st, st->update_every * 1000000ULL);
1700 + unsigned long long microseconds = 0;
1701 +
1702 + if(st->last_collected_time.tv_sec) {
1703 + struct timeval now;
1704 + gettimeofday(&now, NULL);
1705 + microseconds = usecdiff(&now, &st->last_collected_time);
1706 + }
1707 +
1708 + rrd_stats_next_usec(st, microseconds);
1709 }
1710
1711 void rrd_stats_next_plugins(RRD_STATS *st)
1712 {
1705 - rrd_stats_next_usec(st, st->update_every * 1000000ULL);
1713 + rrd_stats_next(st);
1714 }
1715
1716 unsigned long long rrd_stats_done(RRD_STATS *st)