mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user