aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2016-03-24 10:50:03 +0000
committerJavi Merino <javi.merino@arm.com>2016-03-24 11:43:41 +0000
commit0341082b2baa11780548c12028067b9f4c5d6ee1 (patch)
tree17834c54d43cc6abd352f2542e03c238eace7486 /tests
parent46458d66cd5118b6d9cac7cb455f8dae1286b9b2 (diff)
downloadtrappy-0341082b2baa11780548c12028067b9f4c5d6ee1.tar.gz
sched: cope with SysTrace's sched_switch event
For trace-cmd traces, we use the raw trace to parse sched_switch. That's not possible for SysTrace traces, we don't have access to the raw data. Luckily SysTrace doesn't mangle the data as much as trace-cmd's plugin, so a simple string replace is enough to get rid of a stray "==>".
Diffstat (limited to 'tests')
-rw-r--r--tests/test_systrace.py4
-rw-r--r--tests/trace_systrace.html4
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_systrace.py b/tests/test_systrace.py
index 22b9288..4c2a594 100644
--- a/tests/test_systrace.py
+++ b/tests/test_systrace.py
@@ -31,6 +31,10 @@ class TestSystrace(utils_tests.SetupDirectory):
events = ["sched_switch", "sched_wakeup", "trace_event_clock_sync"]
trace = trappy.SysTrace("trace.html", events=events)
+ self.assertTrue(hasattr(trace, "sched_switch"))
+ self.assertEquals(len(trace.sched_switch.data_frame), 4)
+ self.assertTrue("prev_comm" in trace.sched_switch.data_frame.columns)
+
self.assertTrue(hasattr(trace, "sched_wakeup"))
self.assertEquals(len(trace.sched_wakeup.data_frame), 4)
self.assertTrue("target_cpu" in trace.sched_wakeup.data_frame.columns)
diff --git a/tests/trace_systrace.html b/tests/trace_systrace.html
index d35e904..94f2aaa 100644
--- a/tests/trace_systrace.html
+++ b/tests/trace_systrace.html
@@ -25,9 +25,13 @@
# | | | | |||| | |
RenderThread-1143 ( 611) [004] ...1 514769.085985: tracing_mark_write: E
com.android.systemui-611 ( 611) [001] d..5 514769.086090: sched_wakeup: comm=Binder_5 pid=679 prio=120 success=1 target_cpu=001 state=W
+com.android.systemui-611 ( 611) [001] d..3 514769.086139: sched_switch: prev_comm=ndroid.systemui prev_pid=611 prev_prio=120 prev_state=S ==> next_comm=Binder_5 next_pid=679 next_prio=120
atrace-15227 (15227) [000] ...1 514769.086243: tracing_mark_write: trace_event_clock_sync: realtime_ts=1448979311493
+atrace-15227 (15227) [000] d..3 514769.086283: sched_switch: prev_comm=atrace prev_pid=15227 prev_prio=120 prev_state=S ==> next_comm=Binder_4 next_pid=280 next_prio=120
Binder_4-280 ( 184) [000] d..5 514769.086330: sched_wakeup: comm=Binder_5 pid=1158 prio=120 success=1 target_cpu=002 state=W
+ <idle>-0 (-----) [002] d..3 514769.086339: sched_switch: prev_comm=swapper/2 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Binder_5 next_pid=1158 next_prio=120
Binder_4-280 ( 184) [000] d..3 514769.086417: sched_wakeup: comm=Binder_5 pid=1158 prio=120 success=1 target_cpu=002 state=W|m
+ <idle>-0 (-----) [002] d..3 514769.086424: sched_switch: prev_comm=swapper/2 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Binder_5 next_pid=1158 next_prio=120
Binder_4-280 ( 184) [000] d..4 514769.086473: sched_wakeup: comm=EventThread pid=238 prio=111 success=1 target_cpu=003 state=W
</script>
<!-- END TRACE -->