blob: 76b4ccb24ccb6b5e2997b63f695e4385e858e993 [file] [log] [blame]
KP Singh7319a882014-12-24 18:18:01 +00001#!/usr/bin/env python
2
3import unittest
4import matplotlib
5import pandas as pd
6
7from test_thermal import BaseTestThermal
8import cr2
9
10
11class TestPlotter(BaseTestThermal):
12
13 """No Bombing testcases for plotter"""
14
15 def __init__(self, *args, **kwargs):
16 super(TestPlotter, self).__init__(*args, **kwargs)
17
18 def test_plot_no_pivot(self):
19 """Tests LinePlot with no pivot"""
20 run1 = cr2.Run(name="first")
21 l = cr2.LinePlot(run1, cr2.thermal.Thermal, column="temp")
22 l.view()
23 matplotlib.pyplot.close('all')
24
25 def test_plot_multi_run(self):
26 """Tests LinePlot with no Pivot multi runs"""
27 run1 = cr2.Run(name="first")
28 run2 = cr2.Run(name="second")
29 l = cr2.LinePlot(
30 [run1, run2], cr2.thermal.Thermal, column="temp")
31 l.view()
32 matplotlib.pyplot.close('all')
33
34 def test_plot_multi(self):
35 """Tests LinePlot with no Pivot multi attrs"""
36 run1 = cr2.Run(name="first")
37 run2 = cr2.Run(name="second")
38 l = cr2.LinePlot([run1,
Kapileshwar Singh18820752015-02-11 12:01:08 +000039 run2],
40 [cr2.thermal.Thermal,
41 cr2.thermal.ThermalGovernor],
42 column=["temp",
43 "power_range"])
KP Singh7319a882014-12-24 18:18:01 +000044 l.view()
45 matplotlib.pyplot.close('all')
46
47 def test_plot_filter(self):
48 """Tests LinePlot with no Pivot with filters"""
49 run1 = cr2.Run(name="first")
50 run2 = cr2.Run(name="second")
51 l = cr2.LinePlot([run1,
Kapileshwar Singh18820752015-02-11 12:01:08 +000052 run2],
53 [cr2.power.OutPower],
54 column=["power"],
55 filters={"cdev_state": [1]})
KP Singh7319a882014-12-24 18:18:01 +000056 l.view()
57 matplotlib.pyplot.close('all')
58
59 def test_plot_pivot(self):
60 """Tests LinePlot with Pivot"""
61 run1 = cr2.Run(name="first")
62 l = cr2.LinePlot(
63 run1,
64 cr2.thermal.Thermal,
65 column="temp",
66 pivot="thermal_zone")
67 l.view()
68 matplotlib.pyplot.close('all')
69
70 def test_plot_multi_run_pivot(self):
71 """Tests LinePlot with Pivot multi runs"""
72 run1 = cr2.Run(name="first")
73 run2 = cr2.Run(name="second")
74 l = cr2.LinePlot(
75 [run1, run2], cr2.power.OutPower, column="power", pivot="cpus")
76 l.view()
77 matplotlib.pyplot.close('all')
78
79 def test_plot_multi_pivot(self):
80 """Tests LinePlot with Pivot with multi attrs"""
81 run1 = cr2.Run(name="first")
82 run2 = cr2.Run(name="second")
83 l = cr2.LinePlot([run1,
Kapileshwar Singh18820752015-02-11 12:01:08 +000084 run2],
85 [cr2.power.InPower,
86 cr2.power.OutPower],
87 column=["dynamic_power",
88 "power"],
89 pivot="cpus")
KP Singh7319a882014-12-24 18:18:01 +000090 l.view()
91 matplotlib.pyplot.close('all')
92
93 def test_plot_multi_pivot_filter(self):
94 """Tests LinePlot with Pivot and filters"""
95 run1 = cr2.Run(name="first")
96 run2 = cr2.Run(name="second")
97 l = cr2.LinePlot(
98 run1,
99 cr2.power.InPower,
100 column=[
Kapileshwar Singh18820752015-02-11 12:01:08 +0000101 "dynamic_power",
KP Singh7319a882014-12-24 18:18:01 +0000102 "load1"],
103 filters={
104 "cdev_state": [
105 1,
106 0]},
107 pivot="cpus")
108 l.view()
109 matplotlib.pyplot.close('all')