OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import os | 5 import os |
6 import StringIO | 6 import StringIO |
7 import zipfile | 7 import zipfile |
8 | 8 |
9 from telemetry.internal.platform import profiler | 9 from telemetry.internal.platform import profiler |
| 10 from telemetry.timeline import chrome_trace_category_filter |
10 from telemetry.timeline import trace_data as trace_data_module | 11 from telemetry.timeline import trace_data as trace_data_module |
11 from telemetry.timeline import tracing_category_filter | |
12 from telemetry.timeline import tracing_config | 12 from telemetry.timeline import tracing_config |
13 | 13 |
14 | 14 |
15 class TraceProfiler(profiler.Profiler): | 15 class TraceProfiler(profiler.Profiler): |
16 | 16 |
17 def __init__(self, browser_backend, platform_backend, output_path, state, | 17 def __init__(self, browser_backend, platform_backend, output_path, state, |
18 categories=None): | 18 categories=None): |
19 super(TraceProfiler, self).__init__( | 19 super(TraceProfiler, self).__init__( |
20 browser_backend, platform_backend, output_path, state) | 20 browser_backend, platform_backend, output_path, state) |
21 assert self._browser_backend.supports_tracing | 21 assert self._browser_backend.supports_tracing |
22 # We always want flow events when tracing via telemetry. | 22 # We always want flow events when tracing via telemetry. |
23 categories_with_flow = 'disabled-by-default-toplevel.flow' | 23 categories_with_flow = 'disabled-by-default-toplevel.flow' |
24 if categories: | 24 if categories: |
25 categories_with_flow += ',%s' % categories | 25 categories_with_flow += ',%s' % categories |
26 config = tracing_config.TracingConfig() | 26 config = tracing_config.TracingConfig() |
27 config.enable_chrome_trace = True | 27 config.enable_chrome_trace = True |
28 config.chrome_trace_config.SetTracingCategoryFilter( | 28 config.chrome_trace_config.SetCategoryFilter( |
29 tracing_category_filter.TracingCategoryFilter(categories_with_flow)) | 29 chrome_trace_category_filter.ChromeTraceCategoryFilter( |
| 30 categories_with_flow)) |
30 self._browser_backend.StartTracing(config, timeout=10) | 31 self._browser_backend.StartTracing(config, timeout=10) |
31 | 32 |
32 @classmethod | 33 @classmethod |
33 def name(cls): | 34 def name(cls): |
34 return 'trace' | 35 return 'trace' |
35 | 36 |
36 @classmethod | 37 @classmethod |
37 def is_supported(cls, browser_type): | 38 def is_supported(cls, browser_type): |
38 return True | 39 return True |
39 | 40 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 class TraceAllProfiler(TraceProfiler): | 74 class TraceAllProfiler(TraceProfiler): |
74 | 75 |
75 def __init__(self, browser_backend, platform_backend, output_path, state): | 76 def __init__(self, browser_backend, platform_backend, output_path, state): |
76 super(TraceAllProfiler, self).__init__( | 77 super(TraceAllProfiler, self).__init__( |
77 browser_backend, platform_backend, output_path, state, | 78 browser_backend, platform_backend, output_path, state, |
78 categories='disabled-by-default-*') | 79 categories='disabled-by-default-*') |
79 | 80 |
80 @classmethod | 81 @classmethod |
81 def name(cls): | 82 def name(cls): |
82 return 'trace-all' | 83 return 'trace-all' |
OLD | NEW |