OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 _PREFIX_FOR_EXCLUDED_CATEGORY = '-' | |
6 _PREFIX_FOR_DISABLED_BY_DEFAULT_CATEGORY = 'disabled-by-default-' | |
7 | |
8 # If you add a new metric, then register its categories in this table | |
9 # and use AugmentOptionsForMetrics in the benchmark configuration. | |
10 # TODO(ulan): Add all existing metics to this table. | |
11 _CATEGORIES_FOR_METRICS = { | |
nednguyen
2017/03/02 13:36:00
ulan: instead of this, I think we should make a al
| |
12 'expectedQueueingTimeMetric': [ | |
13 'blink.console', # For ranges in cache_temperature.MarkTelemetryInternal. | |
14 'blink.user_timing', # For core navigation events. | |
15 'loading', # For first-meaningful-paint computation. | |
16 'navigation', # For core navigation events. | |
17 'toplevel', # For time-to-interactive computation. | |
18 ], | |
19 'loadingMetric': [ | |
20 'blink.console', # For ranges in cache_temperature.MarkTelemetryInternal. | |
21 'blink.user_timing', # For core navigation events. | |
22 'loading', # For first-meaningful-paint computation. | |
23 'navigation', # For core navigation events. | |
24 'toplevel', # For time-to-interactive computation. | |
25 ], | |
26 } | |
27 | |
28 def AugmentOptionsForMetrics(tbm_options, metrics): | |
29 """ For each metric in the given metrics list adds its category dependencies | |
30 to the tracing config of the given tmb_options. | |
31 Args: | |
32 tbm_options: An instance of timeline_based_measurement.Options | |
33 metrics: A list of timeline based metric names. | |
34 """ | |
35 category_filter = tbm_options.config.chrome_trace_config.category_filter | |
36 for metric in metrics: | |
37 assert metric in _CATEGORIES_FOR_METRICS, 'Unknown metric.' | |
38 categories = _CATEGORIES_FOR_METRICS[metric] | |
39 for category in categories: | |
40 if category.startswith(_PREFIX_FOR_EXCLUDED_CATEGORY): | |
41 category_filter.AddExcludedCategory(category) | |
42 elif category.startswith(_PREFIX_FOR_DISABLED_BY_DEFAULT_CATEGORY): | |
43 category_filter.AddDisabledByDefault(category) | |
44 else: | |
45 category_filter.AddIncludedCategory(category) | |
46 | |
47 def SetMetricDependenciesForTesting(categories_for_metrics): | |
48 global _CATEGORIES_FOR_METRICS | |
49 _CATEGORIES_FOR_METRICS = categories_for_metrics | |
OLD | NEW |