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

Unified Diff: tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py

Issue 23902027: telemetry: Make trace profiler work with trace-based benchmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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/core/backends/chrome/tracing_backend.py
diff --git a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py
index 4d0c68a8a3edb617314407f60d0a8624407e4a14..b367e96504406907fac53d84c8366364c5ad949b 100644
--- a/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py
+++ b/tools/telemetry/telemetry/core/backends/chrome/tracing_backend.py
@@ -72,6 +72,9 @@ class TracingBackend(object):
self._thread = None
self._tracing_data = []
+ def _IsTracing(self):
+ return self._thread != None
+
def BeginTracing(self, custom_categories=None, timeout=10):
self._CheckNotificationSupported()
req = {'method': 'Tracing.start'}
@@ -84,20 +87,26 @@ class TracingBackend(object):
self._thread.start()
def EndTracing(self):
+ if not self._IsTracing():
+ return
req = {'method': 'Tracing.end'}
self._conn.SendRequest(req)
self._thread.join()
self._thread = None
- def GetTraceResultAndReset(self):
+ def GetTraceResult(self):
assert not self._thread
if self._tracing_data and type(self._tracing_data[0]) in [str, unicode]:
result_impl = TraceResultImpl(self._tracing_data)
else:
result_impl = RawTraceResultImpl(self._tracing_data)
- self._tracing_data = []
return trace_result.TraceResult(result_impl)
+ def GetTraceResultAndReset(self):
+ result = self.GetTraceResult()
+ self._tracing_data = []
+ return result
+
def _TracingReader(self):
while self._conn.socket:
try:

Powered by Google App Engine
This is Rietveld 408576698