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 | |
26 from telemetry.core import util | 25 from telemetry.core import util |
27 | 26 |
| 27 from py_utils import discover |
| 28 |
28 # When converting a Value to its buildbot equivalent, the context in which the | 29 # When converting a Value to its buildbot equivalent, the context in which the |
29 # value is being interpreted actually affects the conversion. This is insane, | 30 # value is being interpreted actually affects the conversion. This is insane, |
30 # but there you have it. There are three contexts in which Values are converted | 31 # but there you have it. There are three contexts in which Values are converted |
31 # for use by buildbot, represented by these output-intent values. | 32 # for use by buildbot, represented by these output-intent values. |
32 PER_PAGE_RESULT_OUTPUT_CONTEXT = 'per-page-result-output-context' | 33 PER_PAGE_RESULT_OUTPUT_CONTEXT = 'per-page-result-output-context' |
33 COMPUTED_PER_PAGE_SUMMARY_OUTPUT_CONTEXT = 'merged-pages-result-output-context' | 34 COMPUTED_PER_PAGE_SUMMARY_OUTPUT_CONTEXT = 'merged-pages-result-output-context' |
34 SUMMARY_RESULT_OUTPUT_CONTEXT = 'summary-result-output-context' | 35 SUMMARY_RESULT_OUTPUT_CONTEXT = 'summary-result-output-context' |
35 | 36 |
36 class Value(object): | 37 class Value(object): |
37 """An abstract value produced by a telemetry page test. | 38 """An abstract value produced by a telemetry page test. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 whereas telemetry represents values with a chart_name.trace_name convention, | 365 whereas telemetry represents values with a chart_name.trace_name convention, |
365 where chart_name is optional. This convention is also used by chart_json. | 366 where chart_name is optional. This convention is also used by chart_json. |
366 | 367 |
367 This converts from the telemetry convention to the buildbot convention, | 368 This converts from the telemetry convention to the buildbot convention, |
368 returning a 2-tuple (measurement_name, trace_name). | 369 returning a 2-tuple (measurement_name, trace_name). |
369 """ | 370 """ |
370 if '.' in value_name: | 371 if '.' in value_name: |
371 return value_name.split('.', 1) | 372 return value_name.split('.', 1) |
372 else: | 373 else: |
373 return value_name, value_name | 374 return value_name, value_name |
OLD | NEW |