Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: tools/telemetry/telemetry/page/buildbot_page_measurement_results.py

Issue 22754003: Refactor BenchmarkResult.Add to take enum for data_type (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/page/buildbot_page_measurement_results.py
===================================================================
--- tools/telemetry/telemetry/page/buildbot_page_measurement_results.py (revision 222891)
+++ tools/telemetry/telemetry/page/buildbot_page_measurement_results.py (working copy)
@@ -6,8 +6,14 @@
from itertools import chain
from telemetry.page import page_measurement_results
-from telemetry.page import perf_tests_helper
+from telemetry.core import util
+# Get build scripts into our path.
+util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'util', 'lib')
+from common import perf_result_data_type # pylint: disable=F0401
+from common import perf_tests_results_helper # pylint: disable=F0401
+
+
class BuildbotPageMeasurementResults(
page_measurement_results.PageMeasurementResults):
def __init__(self, trace_tag=''):
@@ -15,8 +21,8 @@
self._trace_tag = trace_tag
def _PrintPerfResult(self, measurement, trace, values, units,
- result_type='default'):
- perf_tests_helper.PrintPerfResult(
+ result_type=perf_result_data_type.DEFAULT):
+ perf_tests_results_helper.PrintPerfResult(
measurement, trace, values, units, result_type)
def PrintSummary(self):
@@ -43,7 +49,7 @@
continue
unique_pages.append(name)
unique_pages_set.add(name)
- perf_tests_helper.PrintPages(unique_pages)
+ perf_tests_results_helper.PrintPages(unique_pages)
# Build the results summary.
results_summary = defaultdict(list)
@@ -65,11 +71,12 @@
results_summary.iteritems()):
measurement, units, data_type = measurement_units_type
- if 'histogram' in data_type:
- by_name_data_type = 'unimportant-histogram'
+ if perf_result_data_type.IsHistogram(data_type):
+ by_name_data_type = perf_result_data_type.UNIMPORTANT_HISTOGRAM
else:
- by_name_data_type = 'unimportant'
- if '.' in measurement and 'histogram' not in data_type:
+ by_name_data_type = perf_result_data_type.UNIMPORTANT
+ if ('.' in measurement and
+ not perf_result_data_type.IsHistogram(data_type)):
measurement, trace = measurement.split('.', 1)
trace += self._trace_tag
else:
@@ -82,7 +89,8 @@
len(value_and_display_name_list) == 1)):
name_value_map = defaultdict(list)
for value, name in value_and_display_name_list:
- if 'histogram' in data_type and name_value_map[name]:
+ if (perf_result_data_type.IsHistogram(data_type) and
+ name_value_map[name]):
# TODO(tonyg/marja): The histogram processing code only accepts one
# histogram, so we only report the first histogram. Once histograms
# support aggregating multiple values, this can be removed.
@@ -98,7 +106,7 @@
# For histograms, we don't print the average data, only the _by_name,
# unless there is only 1 page in which case the _by_names are omitted.
if not (self.errors or self.failures):
- if ('histogram' not in data_type or
+ if (not perf_result_data_type.IsHistogram(data_type) or
len(value_and_display_name_list) == 1):
values = [i[0] for i in value_and_display_name_list]
if isinstance(values[0], list):

Powered by Google App Engine
This is Rietveld 408576698