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

Unified Diff: systrace/systrace/tracing_agents/__init__.py

Issue 1776013005: [DO NOT COMMIT] Refactor systrace to support new clock sync design (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: fix categories issue Created 4 years, 9 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
« no previous file with comments | « systrace/systrace/systrace_unittest.py ('k') | systrace/systrace/tracing_agents/atrace_agent.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: systrace/systrace/tracing_agents/__init__.py
diff --git a/systrace/systrace/tracing_agents/__init__.py b/systrace/systrace/tracing_agents/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..8d529e3560235e2572d2baf4997ed10c669f4762
--- /dev/null
+++ b/systrace/systrace/tracing_agents/__init__.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+'''Tracing agent interface for systrace.
+
+This class represents an agent that captures traces from a particular
+tool (e.g. atrace, ftrace.)
+'''
+
+from collections import namedtuple
+
+TraceResults = namedtuple('TraceResults', ['data_name',
+ 'trace_data'])
+
+class TracingAgent(object):
+ def __init__(self):
+ pass
+
+ def StartAgentTracing(self, options, categories, timeout=10):
+ '''Starts running the trace for this agent. Stops with timeout if
+ not completed within timeout interval.
+
+ Args:
+ options: Tracing options.
+ categories: Categories of trace events to record.
+ timeout: Timeout interval in seconds.
+
+ Returns:
+ Boolean value indicating whether or not the trace started successfully.
+ '''
+ pass
+
+ def StopAgentTracing(self, timeout=10):
+ '''Stops running the trace for this agent and returns immediately.
+ Stops with timeout if not completed within timeout interval.
+
+ Args:
+ timeout: Timeout interval in seconds.
+
+ Returns:
+ Boolean value indicating whether or not the trace started successfully.
+ '''
+ pass
+
+ def SupportsExplicitClockSync(self):
+ '''Find out if this agent supports recording of clock sync markers.
+
+ Returns:
+ Boolean value indicating whether this agent supports recording
+ of clock sync markers.
+ '''
+ raise NotImplementedError
+
+ def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback):
+ '''Record a clock sync marker for this agent.
+
+ Args:
+ sync_id: Clock sync ID string.
+ did_record_sync_marker_callback: Callback function to call
+ (with arguments: timestamp and sync_id) after the
+ clock sync marker is recorded.
+ '''
+ raise NotImplementedError
+
+ def GetResults(self, timeout=30):
+ '''Get the completed trace for this agent, stopping with timeout
+
+ Get the completed trace for this agent. Call only after
+ StopAgentTracing is done. This function blocks until the result
+ is collected (note; this may take several seconds). Stops with timeout
+ if not completed within self._options.collection_timeout seconds.
+
+ Args:
+ timeout: Timeout interval in seconds.
+ Returns:
+ Completed trace for this agent.
+ '''
+ pass
« no previous file with comments | « systrace/systrace/systrace_unittest.py ('k') | systrace/systrace/tracing_agents/atrace_agent.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698