aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crosperf/benchmark.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/crosperf/benchmark.py b/crosperf/benchmark.py
index 55673a56..3f0a842a 100644
--- a/crosperf/benchmark.py
+++ b/crosperf/benchmark.py
@@ -30,7 +30,10 @@ def _samples(b):
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.