OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 from telemetry.perf_tests_helper import GeomMeanAndStdDevFromHistogram | 4 from telemetry.perf_tests_helper import GeomMeanAndStdDevFromHistogram |
5 | 5 |
6 def _Mean(l): | 6 def _Mean(l): |
7 return float(sum(l)) / len(l) if len(l) > 0 else 0.0 | 7 return float(sum(l)) / len(l) if len(l) > 0 else 0.0 |
8 | 8 |
9 class PageBenchmarkValue(object): | 9 class PageBenchmarkValue(object): |
10 def __init__(self, trace_name, units, value, chart_name, data_type): | 10 def __init__(self, trace_name, units, value, chart_name, data_type): |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 @property | 24 @property |
25 def output_value(self): | 25 def output_value(self): |
26 if self.data_type == 'histogram': | 26 if self.data_type == 'histogram': |
27 (mean, _) = GeomMeanAndStdDevFromHistogram(self.value) | 27 (mean, _) = GeomMeanAndStdDevFromHistogram(self.value) |
28 return mean | 28 return mean |
29 elif isinstance(self.value, list): | 29 elif isinstance(self.value, list): |
30 return _Mean(self.value) | 30 return _Mean(self.value) |
31 else: | 31 else: |
32 return self.value | 32 return self.value |
OLD | NEW |