| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright 2016 The Chromium Authors. All rights reserved. | 3 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 '''Tracing agent interface for systrace. | 7 '''Tracing agent interface for systrace. |
| 8 | 8 |
| 9 This class represents an agent that captures traces from a particular | 9 This class represents an agent that captures traces from a particular |
| 10 tool (e.g. atrace, ftrace.) | 10 tool (e.g. atrace, ftrace.) |
| 11 ''' | 11 ''' |
| 12 | 12 |
| 13 # Timeout interval constants. | 13 # Timeout interval constants. |
| 14 | 14 |
| 15 START_STOP_TIMEOUT = 10.0 | 15 START_STOP_TIMEOUT = 10.0 |
| 16 GET_RESULTS_TIMEOUT = 30.0 | 16 GET_RESULTS_TIMEOUT = 30.0 |
| 17 | 17 |
| 18 | 18 |
| 19 class TracingConfig(object): |
| 20 '''Store the tracing configuration options for all Systrace agents. If there |
| 21 are ever any options that are to be shared between all of the agents, those |
| 22 options should go here. |
| 23 ''' |
| 24 def __init__(self): |
| 25 pass |
| 26 |
| 27 |
| 19 class TracingAgent(object): | 28 class TracingAgent(object): |
| 20 def __init__(self): | 29 def __init__(self): |
| 21 pass | 30 pass |
| 22 | 31 |
| 23 def StartAgentTracing(self, options, categories, timeout=None): | 32 def StartAgentTracing(self, config, timeout=None): |
| 24 '''Starts running the trace for this agent. Stops with timeout if | 33 '''Starts running the trace for this agent. Stops with timeout if |
| 25 not completed within timeout interval. | 34 not completed within timeout interval. |
| 26 | 35 |
| 27 Args: | 36 Args: |
| 28 options: Tracing options. | 37 config: TracingConfig subclass containing agent-specific options |
| 29 categories: Categories of trace events to record. | 38 and categories. |
| 30 timeout: Timeout interval in seconds. | 39 timeout: Timeout interval in seconds. |
| 31 | 40 |
| 32 Returns: | 41 Returns: |
| 33 Boolean value indicating whether or not the trace started successfully. | 42 Boolean value indicating whether or not the trace started successfully. |
| 34 ''' | 43 ''' |
| 35 pass | 44 pass |
| 36 | 45 |
| 37 def StopAgentTracing(self, timeout=None): | 46 def StopAgentTracing(self, timeout=None): |
| 38 '''Stops running the trace for this agent and returns immediately. | 47 '''Stops running the trace for this agent and returns immediately. |
| 39 Stops with timeout if not completed within timeout interval. | 48 Stops with timeout if not completed within timeout interval. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 StopAgentTracing is done. This function blocks until the result | 82 StopAgentTracing is done. This function blocks until the result |
| 74 is collected (note; this may take several seconds). Stops with timeout | 83 is collected (note; this may take several seconds). Stops with timeout |
| 75 if not completed within self._options.collection_timeout seconds. | 84 if not completed within self._options.collection_timeout seconds. |
| 76 | 85 |
| 77 Args: | 86 Args: |
| 78 timeout: Timeout interval in seconds. | 87 timeout: Timeout interval in seconds. |
| 79 Returns: | 88 Returns: |
| 80 Completed trace for this agent. | 89 Completed trace for this agent. |
| 81 ''' | 90 ''' |
| 82 pass | 91 pass |
| OLD | NEW |