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

Unified Diff: tools/telemetry/telemetry/value/__init__.py

Issue 809393002: Added support for improvement_direction to relevant values, which is propogated to chartjson. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/value/__init__.py
diff --git a/tools/telemetry/telemetry/value/__init__.py b/tools/telemetry/telemetry/value/__init__.py
index c4330ecdd92c5da1a3b24217ed9d5e43b2840694..c6e70caa971e69f841414f1ffbb7f2d4bb12d7b6 100644
--- a/tools/telemetry/telemetry/value/__init__.py
+++ b/tools/telemetry/telemetry/value/__init__.py
@@ -42,7 +42,8 @@ SUMMARY_RESULT_OUTPUT_CONTEXT = 'summary-result-output-context'
class Value(object):
"""An abstract value produced by a telemetry page test.
"""
- def __init__(self, page, name, units, important, description):
+ def __init__(
+ self, page, name, units, important, description, higher_is_better=None):
"""A generic Value object.
Args:
@@ -56,12 +57,15 @@ class Value(object):
by default in downstream UIs.
description: A string explaining in human-understandable terms what this
value represents.
+ higher_is_better: Whether a higher value is an improvement (True) or a
+ regression (False). None if unknown.
tonyg 2014/12/18 17:31:35 Thinking aloud here... not all Value subclasses ha
"""
self.page = page
self.name = name
self.units = units
self.important = important
self.description = description
+ self.higher_is_better = higher_is_better
def IsMergableWith(self, that):
return (self.units == that.units and
@@ -189,6 +193,9 @@ class Value(object):
if self.page:
d['page_id'] = self.page.id
+ if self.higher_is_better is not None:
+ d['higher_is_better'] = self.higher_is_better
+
return d
def AsDictWithoutBaseClassEntries(self):
@@ -272,6 +279,9 @@ class Value(object):
d['important'] = False
+ if 'higher_is_better' in value_dict:
+ d['higher_is_better'] = value_dict['higher_is_better']
+
return d
def ValueNameFromTraceAndChartName(trace_name, chart_name=None):

Powered by Google App Engine
This is Rietveld 408576698