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

Unified Diff: tools/telemetry/telemetry/internal/platform/tracing_controller_backend.py

Issue 1338423007: [Telemetry] Platform-level tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review fix Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/internal/platform/tracing_controller_backend.py
diff --git a/tools/telemetry/telemetry/internal/platform/tracing_controller_backend.py b/tools/telemetry/telemetry/internal/platform/tracing_controller_backend.py
index 0c66f4ab89031b281b32f5515135cd96f00e5af3..6e2fff273c7c92a2a0c27cae6aec6c82d8f78179 100644
--- a/tools/telemetry/telemetry/internal/platform/tracing_controller_backend.py
+++ b/tools/telemetry/telemetry/internal/platform/tracing_controller_backend.py
@@ -50,9 +50,10 @@ class TracingControllerBackend(object):
self._current_trace_options = trace_options
self._current_category_filter = category_filter
- # Hack: chrome tracing agent depends on the number of alive chrome devtools
- # processes, rather platform, hence we add it to the list of supported
- # agents here if it was not added.
+ # Hack: chrome tracing agent may only depend on the number of alive chrome
+ # devtools processes, rather platform (when startup tracing is not
+ # supported), hence we add it to the list of supported agents here if it was
+ # not added.
if (chrome_tracing_agent.ChromeTracingAgent.IsSupported(
self._platform_backend) and
not chrome_tracing_agent.ChromeTracingAgent in
@@ -95,3 +96,25 @@ class TracingControllerBackend(object):
@property
def is_tracing_running(self):
return self._current_trace_options != None
+
+ def _GetActiveChromeTracingAgent(self):
+ if not self.is_tracing_running:
+ return None
+ if not self._current_trace_options.enable_chrome_trace:
+ return None
+ for agent in self._active_agents_instances:
+ if isinstance(agent, chrome_tracing_agent.ChromeTracingAgent):
+ return agent
+ return None
+
+ def GetChromeTraceConfig(self):
+ agent = self._GetActiveChromeTracingAgent()
+ if agent:
+ return agent.trace_config
+ return None
+
+ def GetChromeTraceConfigFile(self):
+ agent = self._GetActiveChromeTracingAgent()
+ if agent:
+ return agent.trace_config_file
+ return None

Powered by Google App Engine
This is Rietveld 408576698