aboutsummaryrefslogtreecommitdiff
path: root/crosperf/benchmark.py
diff options
context:
space:
mode:
authorCaroline Tice <cmtice@google.com>2017-04-06 17:16:05 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-04-08 19:40:20 -0700
commitf6ef4395fe1896ba68c80e52cb24763b0fcfe7f8 (patch)
tree7612123711db98f0746e56b66368d16b388192bd /crosperf/benchmark.py
parent8c18be1425c8a4ecfc059a7c637fc93f33edab1f (diff)
downloadtoolchain-utils-f6ef4395fe1896ba68c80e52cb24763b0fcfe7f8.tar.gz
[toolchain-utils] Fix remaining lint errors in toolchain-utils.
In addition to fixing the lint errors, this also fixes the Python formatting issues (ran tc_pyformat on nearly all the files). BUG=chromium:570450 TEST=Ran all crosperf & bisect tool unit tests. Ran afe_lock_machine.py (check machine status) Ran full crosperf test (octane, speedometer, BootPerf) on alex. Change-Id: Ic86f9192801ac67769f3de30f1c5f0d203ce0831 Reviewed-on: https://chromium-review.googlesource.com/471886 Commit-Ready: Caroline Tice <cmtice@chromium.org> Tested-by: Caroline Tice <cmtice@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Diffstat (limited to 'crosperf/benchmark.py')
-rw-r--r--crosperf/benchmark.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/crosperf/benchmark.py b/crosperf/benchmark.py
index 3f0a842a..bbb1cdfc 100644
--- a/crosperf/benchmark.py
+++ b/crosperf/benchmark.py
@@ -1,9 +1,8 @@
-
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""Define a type that wraps a Benchmark instance."""
+from __future__ import print_function
import math
from scipy import stats
@@ -20,20 +19,22 @@ _estimated_stddev = {
'page_cycler_v2.typical_25': 0.021,
}
+
# Get #samples needed to guarantee a given confidence interval, assuming the
# samples follow normal distribution.
def _samples(b):
- # TODO: Make this an option
- # CI = (0.9, 0.02), i.e., 90% chance that |sample mean - true mean| < 2%.
- p = 0.9
- e = 0.02
- if b not in _estimated_stddev:
- return 1
- d = _estimated_stddev[b]
- # 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
+ # TODO: Make this an option
+ # CI = (0.9, 0.02), i.e., 90% chance that |sample mean - true mean| < 2%.
+ p = 0.9
+ e = 0.02
+ if b not in _estimated_stddev:
+ return 1
+ d = _estimated_stddev[b]
+ # 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.