[benchmark] Limit setup overhead detection (>20)

For really small runtimes < 20 μs this method of setup overhead detection doesn’t work. Even 1μs change in 20μs runtime is 5%. Just return no overhead.
This commit is contained in:
Pavol Vaskovic
2019-01-08 19:15:29 +01:00
parent 8fcf884076
commit 8a8a3ad6df
2 changed files with 8 additions and 1 deletions

View File

@@ -728,11 +728,18 @@ class TestBenchmarkDoctor(unittest.TestCase):
'SO O i2a': _PTR(min=67), 'SO O i2b': _PTR(min=68)})
doctor.analyze({'name': 'Zero', 'Zero O i1a': _PTR(min=0),
'Zero O i2a': _PTR(min=0)})
doctor.analyze({
'name': 'OOO', # Out Of Order
# Impossible to detect overhead -- limits of precision:
# Even 1μs change in 20μs runtime is 5%.
'OOO O i1a': _PTR(min=21),
'OOO O i2a': _PTR(min=20)})
output = out.getvalue()
self.assertIn('runtime: ', output)
self.assertNotIn('NoOverhead', output)
self.assertNotIn('ZeroRuntime', output)
self.assertNotIn('OOO', output)
self.assert_contains(
["'SO' has setup overhead of 4 μs (5.8%)."],
self.logs['error'])