aboutsummaryrefslogtreecommitdiff
path: root/tests/test_ftrace.py
diff options
context:
space:
mode:
authorLeo Yan <leo.yan@linaro.org>2015-12-25 22:40:31 +0800
committerJavi Merino <javi.merino@arm.com>2015-12-27 17:16:19 +0100
commit8da87510391505576e2b19331f236eab06844316 (patch)
tree476439140640a41690f0e318608f5e3d3053b0a1 /tests/test_ftrace.py
parent8f66a45ebed8fbb9f9ed5e8ffb47f028f29533c5 (diff)
downloadtrappy-8da87510391505576e2b19331f236eab06844316.tar.gz
ftrace: fix error with only one actor
When system has only one actor and call method trappy.summary_plots, it will report failure "zip argument #1 must support iteration". This failure is cause by parsing allfreqs plots. Python always pass by value, so when there have only one actor the axis will pass by value and it's not a array type anymore. So finally zip will report it cannot support iteration. So in this case convert axis to array type. Signed-off-by: Leo Yan <leo.yan@linaro.org>
Diffstat (limited to 'tests/test_ftrace.py')
-rw-r--r--tests/test_ftrace.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_ftrace.py b/tests/test_ftrace.py
index 82fa404..b594c1d 100644
--- a/tests/test_ftrace.py
+++ b/tests/test_ftrace.py
@@ -265,6 +265,22 @@ class TestFTrace(BaseTestThermal):
trace.plot_allfreqs(self.map_label, ax=axis)
matplotlib.pyplot.close('all')
+ def test_plot_allfreqs_with_one_actor(self):
+ """Check that plot_allfreqs() works with one actor"""
+
+ in_data = """ kworker/4:1-397 [004] 720.741349: thermal_power_cpu_get: cpus=00000000,00000006 freq=1400000 raw_cpu_power=189 load={23, 12} power=14
+ kworker/4:1-397 [004] 720.741349: thermal_power_cpu_limit: cpus=00000000,00000006 freq=1400000 cdev_state=1 power=14"""
+
+ with open("trace.txt", "w") as fout:
+ fout.write(in_data)
+
+ trace = trappy.FTrace()
+ map_label = {"00000000,00000006": "A57"}
+ _, axis = matplotlib.pyplot.subplots(nrows=1)
+
+ trace.plot_allfreqs(map_label, ax=axis)
+ matplotlib.pyplot.close('all')
+
def test_trace_metadata(self):
"""Test if metadata gets populated correctly"""