| Index: systrace/systrace/agents/ftrace_agent.py
|
| diff --git a/systrace/systrace/agents/ftrace_agent.py b/systrace/systrace/agents/ftrace_agent.py
|
| index 758fc617e5e10dea6140501b7a7d678e6dbf49ce..3186f2beb5fa175a02f3cd352846d5c5ff711283 100644
|
| --- a/systrace/systrace/agents/ftrace_agent.py
|
| +++ b/systrace/systrace/agents/ftrace_agent.py
|
| @@ -6,7 +6,7 @@ import os
|
| import sys
|
| import time
|
|
|
| -from systrace import systrace_agent
|
| +from systrace import tracing_agent
|
|
|
|
|
| class FtraceAgentIo(object):
|
| @@ -90,7 +90,7 @@ def try_create_agent(options, categories):
|
| return FtraceAgent(options, categories, FtraceAgentIo)
|
|
|
|
|
| -class FtraceAgent(systrace_agent.SystraceAgent):
|
| +class FtraceAgent(tracing_agent.TracingAgent):
|
|
|
| def __init__(self, options, categories, fio=FtraceAgentIo):
|
| """Initialize a systrace agent.
|
| @@ -99,13 +99,16 @@ class FtraceAgent(systrace_agent.SystraceAgent):
|
| options: The command-line options.
|
| categories: The trace categories to capture.
|
| """
|
| - super(FtraceAgent, self).__init__(options, categories)
|
| - if not self._categories:
|
| + super(FtraceAgent, self).__init__()
|
| + if not categories:
|
| self._categories = ["sched"]
|
| + else:
|
| + self._categories = categories
|
| self._fio = fio
|
| + self._options = options
|
| self._categories = [x for x in self._categories
|
| if self._is_category_available(x)]
|
| - self._expect_trace = False
|
| + self._should_output_trace = False
|
|
|
| def _get_trace_buffer_size(self):
|
| buffer_size = 4096
|
| @@ -121,13 +124,14 @@ class FtraceAgent(systrace_agent.SystraceAgent):
|
| wait_time = self._options.trace_time
|
| return wait_time
|
|
|
| - def start(self):
|
| + #override
|
| + def StartAgentTracing(self):
|
| """Start tracing.
|
| """
|
| if self._options.list_categories or len(self._categories) == 0:
|
| - self._expect_trace = False
|
| + self._should_output_trace = False
|
| else:
|
| - self._expect_trace = True
|
| + self._should_output_trace = True
|
|
|
| self._fio.writeFile(FT_BUFFER_SIZE, str(self._get_trace_buffer_size()))
|
|
|
| @@ -148,8 +152,10 @@ class FtraceAgent(systrace_agent.SystraceAgent):
|
| sys.stdout.flush()
|
|
|
| self._fio.writeFile(FT_TRACE_ON, '1')
|
| + return True
|
|
|
| - def collect_result(self):
|
| + #override
|
| + def StopAgentTracing(self):
|
| """Collect the result of tracing.
|
|
|
| This function will block while collecting the result. For sync mode, it
|
| @@ -172,17 +178,10 @@ class FtraceAgent(systrace_agent.SystraceAgent):
|
| print "WARN: tgid fixing is not yet supported."
|
| if self._options.fix_circular:
|
| print "WARN: circular buffer fixups are not yet supported."
|
| + return True
|
|
|
| - def expect_trace(self):
|
| - """Check if the agent is returning a trace or not.
|
| -
|
| - This will be determined in collect_result().
|
| - Returns:
|
| - Whether the agent is expecting a trace or not.
|
| - """
|
| - return self._expect_trace
|
| -
|
| - def get_trace_data(self):
|
| + #override
|
| + def GetResults(self):
|
| """Get the trace data.
|
|
|
| Returns:
|
| @@ -190,10 +189,16 @@ class FtraceAgent(systrace_agent.SystraceAgent):
|
| """
|
| d = self._fio.readFile(FT_TRACE)
|
| self._fio.writeFile(FT_BUFFER_SIZE, "1")
|
| - return d
|
| + return tracing_agent.TraceResults('systemTraceEvents', d,
|
| + self._should_output_trace)
|
| +
|
| + #override
|
| + def SupportsExplicitClockSync(self):
|
| + return False
|
|
|
| - def get_class_name(self):
|
| - return 'trace-data'
|
| + #override
|
| + def RecordClockSyncMarker(self, sync_id, callback):
|
| + raise NotImplementedError
|
|
|
| def _is_category_available(self, category):
|
| if category not in all_categories:
|
|
|