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

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

Issue 1685683003: Implement Timeline Based Measurement v2 (Closed) Base URL: git@github.com:catapult-project/catapult.git@new_style_results
Patch Set: fix vinn tests Created 4 years, 10 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: telemetry/telemetry/value/__init__.py
diff --git a/telemetry/telemetry/value/__init__.py b/telemetry/telemetry/value/__init__.py
index a2ab23e29165a2724e2061a4b74e386d701c789f..e4381117025e37c10a17ce45e6c4d5876a11cf98 100644
--- a/telemetry/telemetry/value/__init__.py
+++ b/telemetry/telemetry/value/__init__.py
@@ -43,7 +43,7 @@ class Value(object):
"""An abstract value produced by a telemetry page test.
"""
def __init__(self, page, name, units, important, description,
- tir_label):
+ tir_label, grouping_keys):
"""A generic Value object.
Args:
@@ -59,6 +59,7 @@ class Value(object):
value represents.
tir_label: The string label of the TimelineInteractionRecord with
which this value is associated.
+ grouping_keys: A dict that maps grouping key names to grouping keys.
"""
# TODO(eakuefner): Check story here after migration (crbug.com/442036)
if not isinstance(name, basestring):
@@ -73,6 +74,11 @@ class Value(object):
isinstance(tir_label, basestring)):
raise ValueError('tir_label field of Value must absent or '
'string.')
+ if not ((grouping_keys is None) or isinstance(grouping_keys, dict)):
+ raise ValueError('grouping_keys field of Value must be absent or dict')
+
+ if grouping_keys is None:
+ grouping_keys = {}
self.page = page
self.name = name
@@ -80,6 +86,7 @@ class Value(object):
self.important = important
self.description = description
self.tir_label = tir_label
+ self.grouping_keys = grouping_keys
def __eq__(self, other):
return hash(self) == hash(other)
@@ -211,6 +218,9 @@ class Value(object):
if self.page:
d['page_id'] = self.page.id
+ if self.grouping_keys:
+ d['grouping_keys'] = self.grouping_keys
+
return d
def AsDictWithoutBaseClassEntries(self):
@@ -300,6 +310,12 @@ class Value(object):
else:
d['tir_label'] = None
+ grouping_keys = value_dict.get('grouping_keys', None)
+ if grouping_keys:
+ d['grouping_keys'] = grouping_keys
+ else:
+ d['grouping_keys'] = None
+
return d
def ValueNameFromTraceAndChartName(trace_name, chart_name=None):
« no previous file with comments | « perf_insights/perf_insights/timeline_based_measurement/rendering_frame_test.html ('k') | telemetry/telemetry/value/failure.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698