aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2016-07-13 19:15:58 +0100
committerJavi Merino <javi.merino@arm.com>2016-07-13 19:31:49 +0100
commitd2f6c2f57797495c14350fde390ba2b42318a75b (patch)
treeaad43d9908997c5a86aebc9972ae0019a62b572d /tests
parent6870a4d4d53797ddf3fff85615451ed0c9bd6fa3 (diff)
downloadtrappy-d2f6c2f57797495c14350fde390ba2b42318a75b.tar.gz
grammar: apply filters to data accesses
Parser() operations happens across the whole event. While it is possible to filter the events and add them back to the trace object with .add_parsed_event(), it is a kludge that we could remove by bringing the concept of filters from the plotters to here. With this change, we can simplify this: ftrace = trappy.FTrace(trace_fname) sbt_dfr = ftrace.sched_boost_task.data_frame boost_task_rtapp = sbt_dfr[sbt_dfr.comm == rta_task_name] ftrace.add_parsed_event("boost_task_rtapp", boost_task_rtapp) analyzer = Analyzer(ftrace, {}) analyzer.assertStatement("blah") To: ftrace = trappy.FTrace(trace_fname) analyzer = Analyzer(ftrace, filters={"comm": "rta_task_name"}) analyzer.assertStatement("blah") This fixes #145
Diffstat (limited to 'tests')
-rw-r--r--tests/test_stats_grammar.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_stats_grammar.py b/tests/test_stats_grammar.py
index 009ea6a..1050763 100644
--- a/tests/test_stats_grammar.py
+++ b/tests/test_stats_grammar.py
@@ -236,3 +236,11 @@ trappy.thermal.Thermal:temp"
self.assertEquals(dfr_res.index[0], trace.thermal.data_frame.index[0])
self.assertLess(dfr_res.index[-1], 1)
+
+ def test_filtered_parse(self):
+ """The Parser can filter a trace"""
+ trace = trappy.FTrace()
+
+ prs = Parser(trace, filters={"cdev_state": 3})
+ dfr_res = prs.solve("devfreq_out_power:freq")
+ self.assertEquals(len(dfr_res), 1)