def test_speed(self): obj = self.obj mock = MockReader() obj.add_listener(mock) res = {} # current measurements shows ~25K samples/sec for cnt in (10, 100, 1000, 10000, 25000, 40000, 50000): for a in range(0, cnt): sample = (cnt, "", 1, r(1000), r(1000), r(1000), rc(), err(), '') mock.data.append(sample) before = time.time() for point in mock.datapoints(): pass after = time.time() res[cnt] = after - before logging.info("Times: %s", res) while mock.results: point = mock.results.pop(0) overall = point[DataPoint.CURRENT][''] self.assertTrue(len(overall[KPISet.PERCENTILES]) > 0) for point in mock.datapoints(True): pass
def test_speed(self): obj = self.obj mock = MockReader() mock.buffer_scale_idx = '100.0' obj.add_listener(mock) res = {} # current measurements shows ~25K samples/sec for cnt in (10, 100, 1000, 10000, 25000, 40000, 50000): for a in range(0, cnt): sample = (cnt, "", 1, r(1000), r(1000), r(1000), rc(), err(), '', 0) mock.data.append(sample) before = time.time() for point in mock.datapoints(): pass after = time.time() res[cnt] = after - before logging.info("Times: %s", res) while mock.results: point = mock.results.pop(0) overall = point[DataPoint.CURRENT][''] self.assertTrue(len(overall[KPISet.PERCENTILES]) > 0) for point in mock.datapoints(True): pass