diff options
Diffstat (limited to 'plot_pm.py')
-rwxr-xr-x | plot_pm.py | 40 |
1 files changed, 31 insertions, 9 deletions
@@ -1,5 +1,6 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | import defapp | 2 | import defapp |
3 | import time | ||
3 | from os.path import splitext, basename | 4 | from os.path import splitext, basename |
4 | from optparse import make_option as o | 5 | from optparse import make_option as o |
5 | from tempfile import NamedTemporaryFile as Tmp | 6 | from tempfile import NamedTemporaryFile as Tmp |
@@ -50,19 +51,32 @@ def overhead_heading(conf, sharedL3=False): | |||
50 | ovd_type = 'unknowkn overhead' | 51 | ovd_type = 'unknowkn overhead' |
51 | if 'ovd' in conf: | 52 | if 'ovd' in conf: |
52 | if conf['ovd'] == 'preemption': | 53 | if conf['ovd'] == 'preemption': |
53 | ovd_type = 'Preemption' | 54 | ovd_type = 'a preemption' |
54 | elif conf['ovd'] == 'onchip': | 55 | elif conf['ovd'] == 'onchip': |
55 | if sharedL3: | 56 | if sharedL3: |
56 | ovd_type = 'Shared L3' | 57 | ovd_type = 'a migration through a shared L3 cache' |
57 | else: | 58 | else: |
58 | ovd_type = 'Shared L2' | 59 | ovd_type = 'a migration through a shared L2 cache' |
59 | elif conf['ovd'] == 'l2cache': | 60 | elif conf['ovd'] == 'l2cache': |
60 | ovd_type = 'Shared L2' | 61 | ovd_type = 'a migration through a shared L2 cache' |
61 | elif conf['ovd'] == 'offchip': | 62 | elif conf['ovd'] == 'offchip': |
62 | ovd_type = 'Diff. Socket' | 63 | ovd_type = 'a migration through main memory' |
63 | 64 | ||
64 | return ovd_type | 65 | return ovd_type |
65 | 66 | ||
67 | def style_selector(conf): | ||
68 | style = 'ls 1' | ||
69 | if 'ovd' in conf: | ||
70 | if conf['ovd'] == 'preemption': | ||
71 | style += '1' | ||
72 | elif conf['ovd'] == 'onchip': | ||
73 | style += '2' | ||
74 | elif conf['ovd'] == 'l2cache': | ||
75 | style += '3' | ||
76 | elif conf['ovd'] == 'offchip': | ||
77 | style += '4' | ||
78 | return style | ||
79 | |||
66 | class PmPlotter(defapp.App): | 80 | class PmPlotter(defapp.App): |
67 | def __init__(self): | 81 | def __init__(self): |
68 | defapp.App.__init__(self, options, defaults, no_std_opts=True) | 82 | defapp.App.__init__(self, options, defaults, no_std_opts=True) |
@@ -91,16 +105,16 @@ class PmPlotter(defapp.App): | |||
91 | def plot(self, graphs, title, name, conf, **xtra): | 105 | def plot(self, graphs, title, name, conf, **xtra): |
92 | name = self.compose_name(conf) | 106 | name = self.compose_name(conf) |
93 | print name | 107 | print name |
108 | style = ('yerrorlines' if 'soft' in conf else 'linespoints') | ||
94 | gnuplot(graphs, title=title, | 109 | gnuplot(graphs, title=title, |
95 | xlabel=self.options.xlabel, | 110 | xlabel=self.options.xlabel, |
96 | ylabel=self.options.ylabel + | 111 | ylabel=self.options.ylabel, |
97 | (' [avg]' if 'soft' in conf else ' [max]'), | ||
98 | #xrange=self.options.xrange, | 112 | #xrange=self.options.xrange, |
99 | #yrange=self.options.yrange, | 113 | #yrange=self.options.yrange, |
100 | #xticks=self.options.xticks, | 114 | #xticks=self.options.xticks, |
101 | #yticks=self.options.yticks, | 115 | #yticks=self.options.yticks, |
102 | format=self.options.format, | 116 | format=self.options.format, |
103 | style=('yerrorlines' if 'soft' in conf else 'linespoints'), | 117 | style=style, |
104 | fname=name, **xtra) | 118 | fname=name, **xtra) |
105 | 119 | ||
106 | def compose_title(self, conf): | 120 | def compose_title(self, conf): |
@@ -119,7 +133,9 @@ class PmPlotter(defapp.App): | |||
119 | wsspos += 1 | 133 | wsspos += 1 |
120 | for i in wsslist: | 134 | for i in wsslist: |
121 | self.fname['wss'].add(i) | 135 | self.fname['wss'].add(i) |
122 | label = conf['ovd'] + ' WSS=' + i | 136 | ### XXX tweaking for ospert |
137 | #label = conf['ovd'] + ' WSS=' + i | ||
138 | label = overhead_heading(conf, self.options.sharedL3) | ||
123 | if 'soft' in conf: | 139 | if 'soft' in conf: |
124 | self.graphs_list.append((tmpfile, 1, wsspos, wsspos+1, \ | 140 | self.graphs_list.append((tmpfile, 1, wsspos, wsspos+1, \ |
125 | wsspos+2, label)) | 141 | wsspos+2, label)) |
@@ -129,6 +145,10 @@ class PmPlotter(defapp.App): | |||
129 | 145 | ||
130 | def plot_graph_list(self, type, name): | 146 | def plot_graph_list(self, type, name): |
131 | self.plot(self.graphs_list, self.title, name, type) | 147 | self.plot(self.graphs_list, self.title, name, type) |
148 | ### XXX bad bad bad hack | ||
149 | ### for just one graph save tmp file and plot the gnuplot output for | ||
150 | ### manual tweaking | ||
151 | time.sleep(20) | ||
132 | 152 | ||
133 | # delete temporary data files | 153 | # delete temporary data files |
134 | for tmp in self.tmpfile_list: | 154 | for tmp in self.tmpfile_list: |
@@ -152,6 +172,8 @@ class PmPlotter(defapp.App): | |||
152 | % bname) | 172 | % bname) |
153 | # keep a list of temporary data files | 173 | # keep a list of temporary data files |
154 | self.tmpfile_list.append(tmpfile) | 174 | self.tmpfile_list.append(tmpfile) |
175 | ### XXX part of the bad ack | ||
176 | print tmpfile.name + ' ' + name | ||
155 | else: | 177 | else: |
156 | self.err("Skipped '%s'; it dosn't appear to contain data." | 178 | self.err("Skipped '%s'; it dosn't appear to contain data." |
157 | % bname) | 179 | % bname) |