aboutsummaryrefslogtreecommitdiff
path: root/tests/test_trappy.py
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2016-01-05 14:47:07 +0000
committerJavi Merino <javi.merino@arm.com>2016-01-05 19:05:49 +0000
commit94d89c1b3c8aa29038731aade64b7a840622690f (patch)
tree241587293722bc23c986e316b1e30fd45d6f137b /tests/test_trappy.py
parentab94dac062ed58f03b1728a2857fa1563ed1e900 (diff)
downloadtrappy-94d89c1b3c8aa29038731aade64b7a840622690f.tar.gz
plot_utils: fix plot_allfreqs() for one actor
When the system has only one actor and you use trappy.summary_plots() or trappy.compare_runs() you get: Traceback (most recent call last): File "trappy/tests/test_trappy.py", line 127, in test_summary_plots_one_actor trappy.summary_plots(self.actor_order, map_label) File "trappy/trappy/compare_runs.py", line 96, in summary_plots return compare_runs(actor_order, map_label, [(title, path)], **kwords) File "trappy/trappy/compare_runs.py", line 78, in compare_runs trappy.plot_utils.plot_allfreqs(run_data, map_label, **kwords) File "trappy/trappy/plot_utils.py", line 209, in plot_allfreqs run.plot_allfreqs(map_label, ax=ax) File "trappy/trappy/ftrace.py", line 531, in plot_allfreqs for this_ax, (label, dfr) in zip(ax, all_freqs): TypeError: zip argument #1 must support iteration This is because plt.subplots() returns just the axis if ncols and nrows are both 1, a 1D array if either ncols or nrows is 1 and a 2D array otherwise. plot_utils.plot_all_freqs() copes with ncols being 1 but not with nrows being 1. The latter happens when you use summary_plots() or compare_runs() and there is only one actor. Fix it so that axis is always a 2D array: the first index is the run and the second the actor.
Diffstat (limited to 'tests/test_trappy.py')
-rw-r--r--tests/test_trappy.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_trappy.py b/tests/test_trappy.py
index 53e0afe..d66b96d 100644
--- a/tests/test_trappy.py
+++ b/tests/test_trappy.py
@@ -107,6 +107,25 @@ class TestTrappy(BaseTestThermal):
trappy.summary_plots(self.actor_order, self.map_label)
matplotlib.pyplot.close('all')
+ def test_summary_plots_one_actor(self):
+ """summary_plots() works if there is only one actor"""
+
+ # Strip out devfreq and little traces
+ trace_out = ""
+ with open("trace.txt") as fin:
+ for line in fin:
+ if ("thermal_power_devfreq_get_power:" not in line) and \
+ ("thermal_power_devfreq_limit:" not in line) and \
+ ("thermal_power_cpu_get_power: cpus=00000000,00000039" not in line) and \
+ ("thermal_power_cpu_limit: cpus=00000000,00000039" not in line):
+ trace_out += line
+
+ with open("trace.txt", "w") as fout:
+ fout.write(trace_out)
+
+ map_label = {"00000000,00000006": "A57"}
+ trappy.summary_plots(self.actor_order, map_label)
+ matplotlib.pyplot.close('all')
def test_compare_runs(self):
"""Basic compare_runs() functionality"""