crosperf: make default iterations of benchmarks >= 2
So as to get standard deviations, which are needed in ttest for p-value.
TEST=none
BUG=none
Change-Id: If59fb46b62c0cb58610507962f8ca13ccc0b7d01
Reviewed-on: https://chromium-review.googlesource.com/452796
Commit-Ready: Ting-Yuan Huang <laszio@chromium.org>
Tested-by: Ting-Yuan Huang <laszio@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
diff --git a/crosperf/benchmark.py b/crosperf/benchmark.py
index 55673a5..3f0a842 100644
--- a/crosperf/benchmark.py
+++ b/crosperf/benchmark.py
@@ -30,7 +30,10 @@
if b not in _estimated_stddev:
return 1
d = _estimated_stddev[b]
- return int(math.ceil((stats.norm.isf((1 - p) / 2) * d / e) ** 2))
+ # Get at least 2 samples so as to calculate standard deviation, which is
+ # needed in T-test for p-value.
+ n = int(math.ceil((stats.norm.isf((1 - p) / 2) * d / e) ** 2))
+ return n if n > 1 else 2
class Benchmark(object):
"""Class representing a benchmark to be run.