def flush(self):
        count = 0
        now = time.time()
        # calculate period for precise rate calculation
        period = now - self.last
        for k, timer in self.timers.iteritems():
            stats = timer.stats(period, self.zero)
            if stats:
                count += 1
                if self.output:
                    self.output.put(Event(tags=['stat'], metric=k, stats=stats))
                if self.logger.isEnabledFor(logging.DEBUG):
                    self.logger.debug('%s: %s' % (k, pformat(stats)))
            timer.reset()
        if count:
            self.logger.debug('Flushed %d stats' % count)
        self.last = now
dataset/ETHPy150Open artirix/logcabin/logcabin/filters/stats.py/Stats.flush/original