run: don't fail if there is no GPU trace
Some old traces don't have GPU information and with the addition of
devfreq to the plots, they break summary_plots(). Let
get_all_freqs_data(), plot_freq_hists() and plot_load() cope with traces
without devfreq information.
Fix the number of freq plots while we are at it so that we only display
as many plots as we need and don't generate empty ones if the GPU
information is not there.
Change-Id: Id57eaf21771e711d72429ca38d74dbd2cc5eef5b
Signed-off-by: Javi Merino <javi.merino@arm.com>
diff --git a/tests/test_plot_utils.py b/tests/test_plot_utils.py
index 66cf315..dbcef49 100644
--- a/tests/test_plot_utils.py
+++ b/tests/test_plot_utils.py
@@ -114,6 +114,29 @@
self.map_label = {"00000000,00000039": "A53", "00000000,00000006": "A57"}
self.actor_order = ["GPU", "A57", "A53"]
+ def test_number_freq_plots(self):
+ """Calculate the number of frequency plots correctly"""
+ trace_out = ""
+
+ run = cr2.Run()
+ self.assertEquals(plot_utils.number_freq_plots([run], self.map_label),
+ 3)
+
+ # Strip out devfreq traces
+ 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):
+ trace_out += line
+
+ with open("trace.txt", "w") as fout:
+ fout.write(trace_out)
+
+ # Without devfreq there should only be two plots
+ run = cr2.Run()
+ self.assertEquals(plot_utils.number_freq_plots([run], self.map_label),
+ 2)
+
def test_plot_temperature(self):
"""Test that plot_utils.plot_temperature() doesn't bomb"""