aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fernandes <joelaf@google.com>2017-06-02 14:48:49 -0700
committerJoel Fernandes <joelaf@google.com>2017-06-02 14:56:34 -0700
commitf1ce538168a9da50f495e09cc0762c597d6b49ec (patch)
tree9222519239e9c469a19196df54bd4b268cc2bcbd
parent393306e80b919fdd7b72c1f5e2e6226e05aeb8ff (diff)
downloadlisa-f1ce538168a9da50f495e09cc0762c597d6b49ec.tar.gz
lisa: Hook into event callback support in trappy
trappy has event callback support, add a way for Trace class to hook into it. Change-Id: Ifd82b531ccc2248c1d12394c87c8a447ff8ff249 Signed-off-by: Joel Fernandes <joelaf@google.com>
-rw-r--r--libs/utils/trace.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/libs/utils/trace.py b/libs/utils/trace.py
index ada8db4..d3cabed 100644
--- a/libs/utils/trace.py
+++ b/libs/utils/trace.py
@@ -78,7 +78,9 @@ class Trace(object):
normalize_time=True,
trace_format='FTrace',
plots_dir=None,
- plots_prefix=''):
+ plots_prefix='',
+ event_callbacks={},
+ build_df=True):
# The platform used to run the experiments
self.platform = platform
@@ -108,6 +110,10 @@ class Trace(object):
# List of events required by user
self.events = []
+ # Stuff for event callback support
+ self.event_callbacks = event_callbacks
+ self.build_df = build_df
+
# List of events available in the parsed trace
self.available_events = []
@@ -135,6 +141,11 @@ class Trace(object):
self.__registerTraceEvents(events)
self.__parseTrace(data_dir, tasks, window, normalize_time,
trace_format)
+
+ if not self.build_df:
+ self._log.info('Data frames not built for the trace')
+ return
+
self.__computeTimeSpan()
# Minimum and Maximum x_time to use for all plots
@@ -242,7 +253,9 @@ class Trace(object):
raise ValueError("Unknown trace format {}".format(trace_format))
self.ftrace = trace_class(path, scope="custom", events=self.events,
- window=window, normalize_time=normalize_time)
+ window=window, normalize_time=normalize_time,
+ event_callbacks=self.event_callbacks,
+ build_df=self.build_df)
# Load Functions profiling data
has_function_stats = self._loadFunctionsStats(path)
@@ -253,6 +266,8 @@ class Trace(object):
if has_function_stats:
self._log.info('Trace contains only functions stats')
return
+ elif not self.build_df:
+ return
raise ValueError('The trace does not contain useful events '
'nor function stats')