Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: telemetry/telemetry/internal/platform/profiler/trace_profiler.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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'
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698