aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing-Yuan Huang <laszio@chromium.org>2017-03-10 11:26:45 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-03-10 14:34:57 -0800
commit9088f2b8997baf37098bce7a464348296e0dbe47 (patch)
tree6ddef5a76331086fce8741cf0c1c5f4e540ec727
parent86fe1ed1707823392bdac5d5ffd227707104fea3 (diff)
downloadtoolchain-utils-9088f2b8997baf37098bce7a464348296e0dbe47.tar.gz
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>
-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.