OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """ | 4 """ |
5 The Value hierarchy provides a way of representing the values measurements | 5 The Value hierarchy provides a way of representing the values measurements |
6 produce such that they can be merged across runs, grouped by page, and output | 6 produce such that they can be merged across runs, grouped by page, and output |
7 to different targets. | 7 to different targets. |
8 | 8 |
9 The core Value concept provides the basic functionality: | 9 The core Value concept provides the basic functionality: |
10 - association with a page, may be none | 10 - association with a page, may be none |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 represents results for multiple pages. | 50 represents results for multiple pages. |
51 name: A value name string, may contain a dot. Values from the same test | 51 name: A value name string, may contain a dot. Values from the same test |
52 with the same prefix before the dot may be considered to belong to | 52 with the same prefix before the dot may be considered to belong to |
53 the same chart. | 53 the same chart. |
54 units: A units string. | 54 units: A units string. |
55 important: Whether the value is "important". Causes the value to appear | 55 important: Whether the value is "important". Causes the value to appear |
56 by default in downstream UIs. | 56 by default in downstream UIs. |
57 description: A string explaining in human-understandable terms what this | 57 description: A string explaining in human-understandable terms what this |
58 value represents. | 58 value represents. |
59 """ | 59 """ |
60 if page is not None: | |
61 # TODO(eakuefner): Change this to isinstance once page is refactored. | |
62 assert type(page).__name__ == 'Page' | |
nednguyen
2015/02/13 19:09:21
Actually, let's left page alone for now because th
eakuefner
2015/02/13 19:29:13
Fair enough. I did some fiddling in the bug tracke
| |
63 assert isinstance(name, str) | |
64 assert isinstance(units, str) | |
65 assert isinstance(important, bool) | |
66 if description is not None: | |
67 assert isinstance(description, str) | |
nednguyen
2015/02/13 19:09:21
assert (not description) or isinstance(description
eakuefner
2015/02/13 19:29:13
Done, except I think (not description) is not quit
| |
68 | |
60 self.page = page | 69 self.page = page |
61 self.name = name | 70 self.name = name |
62 self.units = units | 71 self.units = units |
63 self.important = important | 72 self.important = important |
64 self.description = description | 73 self.description = description |
65 | 74 |
66 def IsMergableWith(self, that): | 75 def IsMergableWith(self, that): |
67 return (self.units == that.units and | 76 return (self.units == that.units and |
68 type(self) == type(that) and | 77 type(self) == type(that) and |
69 self.important == that.important) | 78 self.important == that.important) |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 whereas telemetry represents values with a chart_name.trace_name convention, | 308 whereas telemetry represents values with a chart_name.trace_name convention, |
300 where chart_name is optional. This convention is also used by chart_json. | 309 where chart_name is optional. This convention is also used by chart_json. |
301 | 310 |
302 This converts from the telemetry convention to the buildbot convention, | 311 This converts from the telemetry convention to the buildbot convention, |
303 returning a 2-tuple (measurement_name, trace_name). | 312 returning a 2-tuple (measurement_name, trace_name). |
304 """ | 313 """ |
305 if '.' in value_name: | 314 if '.' in value_name: |
306 return value_name.split('.', 1) | 315 return value_name.split('.', 1) |
307 else: | 316 else: |
308 return value_name, value_name | 317 return value_name, value_name |
OLD | NEW |