aboutsummaryrefslogtreecommitdiff
path: root/tests/test_plot_utils.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_plot_utils.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_plot_utils.py')
-rw-r--r--tests/test_plot_utils.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_plot_utils.py b/tests/test_plot_utils.py
index d5a6def..e912762 100644
--- a/tests/test_plot_utils.py
+++ b/tests/test_plot_utils.py
@@ -181,6 +181,21 @@ class TestPlotUtilsNeedTrace(BaseTestThermal):
plot_utils.plot_allfreqs([trace], self.map_label)
matplotlib.pyplot.close('all')
+ def test_plot_allfreqs_one_actor(self):
+ """plot_utils.plot_allfreqs work when there is only 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)
+
+ traces = [trappy.FTrace(name="first"), trappy.FTrace(name="second")]
+ map_label = {"00000000,00000006": "A57"}
+
+ plot_utils.plot_allfreqs(traces, map_label)
+ matplotlib.pyplot.close("all")
+
def test_plot_controller(self):
"""plot_utils.plot_controller() doesn't bomb"""