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

Side by Side Diff: tools/telemetry/telemetry/core/platform/tracing_options.py

Issue 1231643002: [Startup Tracing][Telemetry] Move tracing_options and tracing_category_filter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
(Empty)
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
3 # found in the LICENSE file.
4
5 RECORD_UNTIL_FULL = 'record-until-full'
6 RECORD_CONTINUOUSLY = 'record-continuously'
7 RECORD_AS_MUCH_AS_POSSIBLE = 'record-as-much-as-possible'
8 ECHO_TO_CONSOLE = 'trace-to-console'
9
10 RECORD_MODES = [
11 RECORD_UNTIL_FULL,
12 RECORD_CONTINUOUSLY,
13 RECORD_AS_MUCH_AS_POSSIBLE,
14 ECHO_TO_CONSOLE
15 ]
16
17 ENABLE_SYSTRACE = 'enable-systrace'
18
19 class TracingOptions(object):
20 """Tracing options control which core tracing systems should be enabled.
21
22 This simply turns on those systems. If those systems have additional options,
23 e.g. what to trace, then they are typically configured by adding
24 categories to the TracingCategoryFilter.
25
26 Options:
27 enable_chrome_trace: a boolean that specifies whether to enable
28 chrome tracing.
29 enable_platform_display_trace: a boolean that specifies whether to
30 platform display tracing.
31
32 The following ones are specific to chrome tracing. See
33 base/trace_event/trace_config.h for more information.
34 record_mode: can be any mode in RECORD_MODES. This corresponds to
35 record modes in chrome.
36 enable_systrace: a boolean that specifies whether to enable systrace.
37 """
38 def __init__(self):
39 self.enable_chrome_trace = False
40 self.enable_platform_display_trace = False
41
42 self._record_mode = RECORD_AS_MUCH_AS_POSSIBLE
43 self._enable_systrace = False
44
45 @property
46 def record_mode(self):
47 return self._record_mode
48
49 @record_mode.setter
50 def record_mode(self, value):
51 assert value in RECORD_MODES
52 self._record_mode = value
53
54 @property
55 def enable_systrace(self):
56 return self._enable_systrace
57
58 @enable_systrace.setter
59 def enable_systrace(self, value):
60 self._enable_systrace = value
61
62 def GetTraceOptionsStringForChromeDevtool(self):
63 """Map Chrome tracing options in Telemetry to the DevTools API string."""
64 # Map telemetry's tracing record_mode to the DevTools API string.
65 # (The keys happen to be the same as the values.)
66 m = {
67 RECORD_UNTIL_FULL: 'record-until-full',
68 RECORD_CONTINUOUSLY: 'record-continuously',
69 RECORD_AS_MUCH_AS_POSSIBLE: 'record-as-much-as-possible',
70 ECHO_TO_CONSOLE: 'trace-to-console'
71 }
72 result = [m[self._record_mode]]
73 if self._enable_systrace:
74 result.append(ENABLE_SYSTRACE)
75 return ','.join(result)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698