Skip to content

Commit 2c27149

Browse files
committed
[benchmark] Limit of Accuracy in Setup Overhead
Clarified limit of accuracy in setup overhead detection.
1 parent b4d8172 commit 2c27149

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

benchmark/scripts/Benchmark_Driver

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@ class BenchmarkDoctor(object):
455455
[[result.samples.min for result in i_series]
456456
for i_series in
457457
[select(measurements, num_iters=i) for i in [1, 2]]]]
458-
setup = int(round(2.0 * (ti1 - ti2))) if ti2 > 20 else 0
458+
setup = (int(round(2.0 * (ti1 - ti2))) if ti2 > 20 # limit of accuracy
459+
else 0)
459460
ratio = (setup / ti1) if ti1 > 0 else 0
460461
return (setup, ratio)
461462

benchmark/scripts/test_Benchmark_Driver.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -743,17 +743,17 @@ def test_benchmark_has_no_significant_setup_overhead(self):
743743
doctor.analyze({'name': 'Zero', 'Zero O i1a': _PTR(min=0),
744744
'Zero O i2a': _PTR(min=0)})
745745
doctor.analyze({
746-
'name': 'OOO', # Out Of Order
747-
# Impossible to detect overhead -- limits of precision:
746+
'name': 'LOA', # Limit of Accuracy
747+
# Impossible to detect overhead:
748748
# Even 1μs change in 20μs runtime is 5%.
749-
'OOO O i1a': _PTR(min=21),
750-
'OOO O i2a': _PTR(min=20)})
749+
'LOA O i1a': _PTR(min=21),
750+
'LOA O i2a': _PTR(min=20)})
751751
output = out.getvalue()
752752

753753
self.assertIn('runtime: ', output)
754754
self.assertNotIn('NoOverhead', output)
755755
self.assertNotIn('ZeroRuntime', output)
756-
self.assertNotIn('OOO', output)
756+
self.assertNotIn('LOA', output)
757757
self.assert_contains(
758758
["'SO' has setup overhead of 4 μs (5.8%)."],
759759
self.logs['error'])

0 commit comments

Comments
 (0)