def _reset_realtime(self): self.realtime_meters: Dict = {} self.realtime_meters["tps"] = TimeMeter() # tokens per second self.realtime_meters["ups"] = TimeMeter() # updates per second
def test_time_meter(self): tps = TimeMeter() for i in range(10): tps.update(i) self.assertEqual(tps.n, 45) self.assertTrue(tps.avg > 1)