Index: systrace/profile_chrome/ddms_tracing_agent.py |
diff --git a/systrace/profile_chrome/ddms_tracing_agent.py b/systrace/profile_chrome/ddms_tracing_agent.py |
index 158e45b27fc74ea05486e073d4d83ac027d4b3a6..276a3b9fb055a92ef9b11770fed647a8dd82b803 100644 |
--- a/systrace/profile_chrome/ddms_tracing_agent.py |
+++ b/systrace/profile_chrome/ddms_tracing_agent.py |
@@ -41,10 +41,12 @@ class DdmsAgent(tracing_agents.TracingAgent): |
cmd += '--sampling %d ' % _DDMS_SAMPLING_FREQUENCY_US |
cmd += '%s %s' % (self._package, self._output_file) |
self._device.RunShellCommand(cmd) |
+ return True |
@py_utils.Timeout(tracing_agents.START_STOP_TIMEOUT) |
def StopAgentTracing(self, timeout=None): |
self._device.RunShellCommand('am profile stop %s' % self._package) |
+ return True |
@py_utils.Timeout(tracing_agents.GET_RESULTS_TIMEOUT) |
def GetResults(self, timeout=None): |
@@ -65,15 +67,24 @@ class DdmsAgent(tracing_agents.TracingAgent): |
return False |
def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback): |
+ # pylint: disable=unused-argument |
assert self.SupportsExplicitClockSync(), ('Clock sync marker cannot be ' |
'recorded since explicit clock sync is not supported.') |
class DdmsConfig(tracing_agents.TracingConfig): |
- def __init__(self): |
+ def __init__(self, device, package_info, ddms): |
tracing_agents.TracingConfig.__init__(self) |
+ self.device = device |
+ self.package_info = package_info |
+ self.ddms = ddms |
+def try_create_agent(config): |
+ if config.ddms: |
+ return DdmsAgent(config.device, config.package_info) |
+ return None |
+ |
def add_options(parser): |
options = optparse.OptionGroup(parser, 'Java tracing') |
options.add_option('--ddms', help='Trace Java execution using DDMS ' |
@@ -81,5 +92,4 @@ def add_options(parser): |
return options |
def get_config(options): |
- # pylint: disable=unused-argument |
- return DdmsConfig() |
+ return DdmsConfig(options.device, options.package_info, options.ddms) |