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 |
11 - naming and units | 11 - naming and units |
12 - importance tracking [whether a value will show up on a waterfall or output | 12 - importance tracking [whether a value will show up on a waterfall or output |
13 file by default] | 13 file by default] |
14 - other metadata, such as a description of what was measured | 14 - other metadata, such as a description of what was measured |
15 - default conversion to scalar and string | 15 - default conversion to scalar and string |
16 - merging properties | 16 - merging properties |
17 | 17 |
18 A page may actually run a few times during a single telemetry session. | 18 A page may actually run a few times during a single telemetry session. |
19 Downstream consumers of test results typically want to group these runs | 19 Downstream consumers of test results typically want to group these runs |
20 together, then compute summary statistics across runs. Value provides the | 20 together, then compute summary statistics across runs. Value provides the |
21 Merge* family of methods for this kind of aggregation. | 21 Merge* family of methods for this kind of aggregation. |
22 """ | 22 """ |
23 import os | 23 import os |
24 | 24 |
25 from telemetry.core import discover | 25 from telemetry.core import discover |
26 from telemetry.core import util | 26 from telemetry.core import util |
27 | 27 |
28 # When combining a pair of Values togehter, it is sometimes ambiguous whether | |
29 # the values should be concatenated, or one should be picked as representative. | |
30 # The possible merging policies are listed here. | |
31 CONCATENATE = 'concatenate' | |
32 PICK_FIRST = 'pick-first' | |
33 | |
34 # When converting a Value to its buildbot equivalent, the context in which the | 28 # When converting a Value to its buildbot equivalent, the context in which the |
35 # value is being interpreted actually affects the conversion. This is insane, | 29 # value is being interpreted actually affects the conversion. This is insane, |
36 # but there you have it. There are three contexts in which Values are converted | 30 # but there you have it. There are three contexts in which Values are converted |
37 # for use by buildbot, represented by these output-intent values. | 31 # for use by buildbot, represented by these output-intent values. |
38 PER_PAGE_RESULT_OUTPUT_CONTEXT = 'per-page-result-output-context' | 32 PER_PAGE_RESULT_OUTPUT_CONTEXT = 'per-page-result-output-context' |
39 COMPUTED_PER_PAGE_SUMMARY_OUTPUT_CONTEXT = 'merged-pages-result-output-context' | 33 COMPUTED_PER_PAGE_SUMMARY_OUTPUT_CONTEXT = 'merged-pages-result-output-context' |
40 SUMMARY_RESULT_OUTPUT_CONTEXT = 'summary-result-output-context' | 34 SUMMARY_RESULT_OUTPUT_CONTEXT = 'summary-result-output-context' |
41 | 35 |
42 class Value(object): | 36 class Value(object): |
43 """An abstract value produced by a telemetry page test. | 37 """An abstract value produced by a telemetry page test. |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 whereas telemetry represents values with a chart_name.trace_name convention, | 337 whereas telemetry represents values with a chart_name.trace_name convention, |
344 where chart_name is optional. This convention is also used by chart_json. | 338 where chart_name is optional. This convention is also used by chart_json. |
345 | 339 |
346 This converts from the telemetry convention to the buildbot convention, | 340 This converts from the telemetry convention to the buildbot convention, |
347 returning a 2-tuple (measurement_name, trace_name). | 341 returning a 2-tuple (measurement_name, trace_name). |
348 """ | 342 """ |
349 if '.' in value_name: | 343 if '.' in value_name: |
350 return value_name.split('.', 1) | 344 return value_name.split('.', 1) |
351 else: | 345 else: |
352 return value_name, value_name | 346 return value_name, value_name |
OLD | NEW |