| Index: systrace/systrace/systrace_runner.py
|
| diff --git a/systrace/systrace/systrace_runner.py b/systrace/systrace/systrace_runner.py
|
| index 6fe8fa63aa20c09c6eaed4e6e8ad88611f359ea5..c3452d10e4983bbbbfacc773e2b5a96eaf03a10b 100644
|
| --- a/systrace/systrace/systrace_runner.py
|
| +++ b/systrace/systrace/systrace_runner.py
|
| @@ -9,7 +9,6 @@ necessary tracing agents for systrace, runs them, and outputs the results
|
| as an HTML or JSON file.'''
|
|
|
| from systrace import output_generator
|
| -from systrace import tracing_agents
|
| from systrace import tracing_controller
|
| from systrace.tracing_agents import atrace_agent
|
| from systrace.tracing_agents import atrace_from_file_agent
|
| @@ -17,7 +16,7 @@ from systrace.tracing_agents import battor_trace_agent
|
| from systrace.tracing_agents import ftrace_agent
|
|
|
|
|
| -AGENT_MODULES_ = [atrace_agent, atrace_from_file_agent,
|
| +AGENT_MODULES = [atrace_agent, atrace_from_file_agent,
|
| battor_trace_agent, ftrace_agent]
|
|
|
|
|
| @@ -33,8 +32,9 @@ class SystraceRunner(object):
|
| # Parse command line arguments and create agents.
|
| self._script_dir = script_dir
|
| self._out_filename = options.output_file
|
| - agents_with_config = _CreateAgentsWithConfig(options)
|
| - controller_config = _GetControllerConfig(options)
|
| + agents_with_config = tracing_controller.CreateAgentsWithConfig(
|
| + options, AGENT_MODULES)
|
| + controller_config = tracing_controller.GetControllerConfig(options)
|
|
|
| # Set up tracing controller.
|
| self._tracing_controller = tracing_controller.TracingController(
|
| @@ -67,55 +67,3 @@ class SystraceRunner(object):
|
| self._out_filename)
|
| print '\nWrote trace %s file: file://%s\n' % (('JSON' if write_json
|
| else 'HTML'), result)
|
| -
|
| -
|
| -class AgentWithConfig(object):
|
| - def __init__(self, agent, config):
|
| - self.agent = agent
|
| - self.config = config
|
| -
|
| -
|
| -def _CreateAgentsWithConfig(options):
|
| - """Create tracing agents.
|
| -
|
| - This function will determine which tracing agents are valid given the
|
| - options and create those agents along with their corresponding configuration
|
| - object.
|
| - Args:
|
| - options: The command-line options.
|
| - Returns:
|
| - A list of AgentWithConfig options containing agents and their corresponding
|
| - configuration object.
|
| - """
|
| - result = []
|
| - for module in AGENT_MODULES_:
|
| - config = module.get_config(options)
|
| - agent = module.try_create_agent(config)
|
| - if agent and config:
|
| - result.append(AgentWithConfig(agent, config))
|
| - return [x for x in result if x and x.agent]
|
| -
|
| -
|
| -class TracingControllerConfig(tracing_agents.TracingConfig):
|
| - def __init__(self, output_file, trace_time, list_categories, write_json,
|
| - link_assets, asset_dir, timeout, collection_timeout,
|
| - device_serial_number, target):
|
| - tracing_agents.TracingConfig.__init__(self)
|
| - self.output_file = output_file
|
| - self.trace_time = trace_time
|
| - self.list_categories = list_categories
|
| - self.write_json = write_json
|
| - self.link_assets = link_assets
|
| - self.asset_dir = asset_dir
|
| - self.timeout = timeout
|
| - self.collection_timeout = collection_timeout
|
| - self.device_serial_number = device_serial_number
|
| - self.target = target
|
| -
|
| -
|
| -def _GetControllerConfig(options):
|
| - return TracingControllerConfig(options.output_file, options.trace_time,
|
| - options.list_categories, options.write_json,
|
| - options.link_assets, options.asset_dir,
|
| - options.timeout, options.collection_timeout,
|
| - options.device_serial_number, options.target)
|
|
|