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

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

Issue 399893003: Add "description" attribute to Value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix calls to Value constructor so that the tests pass. Created 6 years, 5 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
« no previous file with comments | « no previous file | tools/telemetry/telemetry/value/failure.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/value/__init__.py
diff --git a/tools/telemetry/telemetry/value/__init__.py b/tools/telemetry/telemetry/value/__init__.py
index 57f0a226d0766ec6113ca97fb02146b10527572e..816e7cfa051de18be91a4d7538b356fcbb1f1d71 100644
--- a/tools/telemetry/telemetry/value/__init__.py
+++ b/tools/telemetry/telemetry/value/__init__.py
@@ -11,6 +11,7 @@ The core Value concept provides the basic functionality:
- naming and units
- importance tracking [whether a value will show up on a waterfall or output
file by default]
+- other metadata, such as a description of what was measured
- default conversion to scalar and string
- merging properties
@@ -37,16 +38,26 @@ 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):
+ def __init__(self, page, name, units, important, description):
"""A generic Value object.
- Note: page may be given as None to indicate that the value represents
- results multiple pages.
+ Args:
+ page: A Page object, may be given as None to indicate that the value
+ represents results for multiple pages.
+ name: A value name string, may contain a dot. Values from the same test
+ with the same prefix before the dot may be considered to belong to
+ the same chart.
+ units: A units string.
+ important: Whether the value is "important". Causes the value to appear
+ by default in downstream UIs.
+ description: A string explaining in human-understandable terms what this
+ value represents.
"""
self.page = page
self.name = name
self.units = units
self.important = important
+ self.description = description
def IsMergableWith(self, that):
return (self.units == that.units and
@@ -168,6 +179,9 @@ class Value(object):
'unit': self.units,
}
+ if self.description:
+ d['description'] = self.description
+
if self.page:
d['page_id'] = self.page.id
@@ -177,7 +191,7 @@ class Value(object):
full_dict = self.AsDict()
base_dict_keys = set(self._AsDictImpl().keys())
- # Exctracts only entries added by the subclass.
+ # Extracts only entries added by the subclass.
return dict([(k, v) for (k, v) in full_dict.iteritems()
if k not in base_dict_keys])
« no previous file with comments | « no previous file | tools/telemetry/telemetry/value/failure.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698