Пример #1
0
    def test_summary_other_dir(self):
        """Test summary_plots() with another directory"""

        other_random_dir = tempfile.mkdtemp()
        os.chdir(other_random_dir)

        trappy.summary_plots(self.actor_order, self.map_label, path=self.out_dir)
        matplotlib.pyplot.close('all')

        # Sanity check that the test actually ran from another directory
        self.assertEquals(os.getcwd(), other_random_dir)
Пример #2
0
    def test_summary_plots(self):
        """Test summary_plots()

        Can't check that the graphs are ok, so just see that the method doesn't blow up"""

        trappy.summary_plots(self.actor_order, self.map_label)
        matplotlib.pyplot.close('all')

        trappy.summary_plots(self.actor_order, self.map_label, width=14,
                          title="Foo")
        matplotlib.pyplot.close('all')
Пример #3
0
    def test_summary_other_dir(self):
        """Test summary_plots() with another directory"""

        other_random_dir = tempfile.mkdtemp()
        os.chdir(other_random_dir)

        trappy.summary_plots(self.actor_order,
                             self.map_label,
                             path=self.out_dir)
        matplotlib.pyplot.close('all')

        # Sanity check that the test actually ran from another directory
        self.assertEquals(os.getcwd(), other_random_dir)
Пример #4
0
    def test_summary_plots(self):
        """Test summary_plots()

        Can't check that the graphs are ok, so just see that the method doesn't blow up"""

        trappy.summary_plots(self.actor_order, self.map_label)
        matplotlib.pyplot.close('all')

        trappy.summary_plots(self.actor_order,
                             self.map_label,
                             width=14,
                             title="Foo")
        matplotlib.pyplot.close('all')
Пример #5
0
    def test_summary_plots_no_gpu(self):
        """summary_plots() works if there is no GPU trace"""

        # Strip out devfreq 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):
                    trace_out += line

        with open("trace.txt", "w") as fout:
            fout.write(trace_out)

        trappy.summary_plots(self.actor_order, self.map_label)
        matplotlib.pyplot.close('all')
Пример #6
0
    def test_summary_plots_only_power_allocator_trace(self):
        """Test that summary_plots() work if there is only power allocator
        trace"""

        # Strip out "thermal_temperature" from the trace
        trace_out = ""
        with open("trace.txt") as fin:
            for line in fin:
                if not re.search("thermal_temperature:", line):
                    trace_out += line

        with open("trace.txt", "w") as fout:
            fout.write(trace_out)

        trappy.summary_plots(self.actor_order, self.map_label)
        matplotlib.pyplot.close('all')
Пример #7
0
    def test_summary_plots_no_gpu(self):
        """summary_plots() works if there is no GPU trace"""

        # Strip out devfreq 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):
                    trace_out += line

        with open("trace.txt", "w") as fout:
            fout.write(trace_out)

        trappy.summary_plots(self.actor_order, self.map_label)
        matplotlib.pyplot.close('all')
Пример #8
0
    def test_summary_plots_only_power_allocator_trace(self):
        """Test that summary_plots() work if there is only power allocator
        trace"""

        # Strip out "thermal_temperature" from the trace
        trace_out = ""
        with open("trace.txt") as fin:
            for line in fin:
                if not re.search("thermal_temperature:", line):
                    trace_out += line

        with open("trace.txt", "w") as fout:
            fout.write(trace_out)

        trappy.summary_plots(self.actor_order, self.map_label)
        matplotlib.pyplot.close('all')
Пример #9
0
    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')
Пример #10
0
    def test_summary_plots_bad_parameters(self):
        """When summary_plots() receives bad parameters, it offers an understandable error"""

        self.assertRaises(TypeError, trappy.summary_plots,
                          (self.map_label, self.actor_order))

        try:
            trappy.summary_plots(self.map_label, self.actor_order)
        except TypeError as exception:
            self.assertTrue("actor_order" in str(exception))
        else:
            self.fail()

        try:
            trappy.summary_plots(self.actor_order, self.actor_order)
        except TypeError as exception:
            self.assertTrue("map_label" in str(exception))
        else:
            self.fail()
Пример #11
0
    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')
Пример #12
0
    def test_summary_plots_bad_parameters(self):
        """When summary_plots() receives bad parameters, it offers an understandable error"""

        self.assertRaises(TypeError, trappy.summary_plots,
                          (self.map_label, self.actor_order))

        try:
            trappy.summary_plots(self.map_label, self.actor_order)
            self.fail()
        except TypeError as exception:
            pass

        self.assertTrue("actor_order" in str(exception))

        try:
            trappy.summary_plots(self.actor_order, self.actor_order)
            self.fail()
        except TypeError as exception:
            pass

        self.assertTrue("map_label" in str(exception))