diff options
author | Björn B. Brandenburg <bbb@cs.unc.edu> | 2010-05-25 14:59:00 -0400 |
---|---|---|
committer | Björn B. Brandenburg <bbb@cs.unc.edu> | 2010-05-25 14:59:00 -0400 |
commit | cff6fda4e6acfd3978702618160a055981f09f97 (patch) | |
tree | d5772ef86664020543eb466e08fea6620bd2e441 | |
parent | 8690d0c48131d7d6338aee1f701ab8a1acaf9474 (diff) |
Incorporate JSA'09 changes based on new Plot class
-rwxr-xr-x | plot.py | 101 |
1 files changed, 87 insertions, 14 deletions
@@ -4,7 +4,7 @@ from os.path import splitext, basename | |||
4 | from optparse import make_option as o | 4 | from optparse import make_option as o |
5 | from tempfile import NamedTemporaryFile as Tmp | 5 | from tempfile import NamedTemporaryFile as Tmp |
6 | 6 | ||
7 | from gnuplot import gnuplot, FORMATS | 7 | from gnuplot import gnuplot, FORMATS, Plot, label, curve |
8 | 8 | ||
9 | options = [ | 9 | options = [ |
10 | o('-f', '--format', action='store', dest='format', type='choice', | 10 | o('-f', '--format', action='store', dest='format', type='choice', |
@@ -13,6 +13,7 @@ options = [ | |||
13 | o(None, '--wide', action='store_true', dest='wide'), | 13 | o(None, '--wide', action='store_true', dest='wide'), |
14 | o(None, '--column', action='store_true', dest='column'), | 14 | o(None, '--column', action='store_true', dest='column'), |
15 | o(None, '--split', action='store_true', dest='split'), | 15 | o(None, '--split', action='store_true', dest='split'), |
16 | o(None, '--alternate', action='store_true', dest='alternate'), | ||
16 | ] | 17 | ] |
17 | 18 | ||
18 | defaults = { | 19 | defaults = { |
@@ -27,6 +28,7 @@ defaults = { | |||
27 | 'paper' : False, | 28 | 'paper' : False, |
28 | 'split' : False, | 29 | 'split' : False, |
29 | 'wide' : False, | 30 | 'wide' : False, |
31 | 'alternate' : False, | ||
30 | 'column' : False, | 32 | 'column' : False, |
31 | } | 33 | } |
32 | 34 | ||
@@ -202,21 +204,92 @@ class SchedPlotter(defapp.App): | |||
202 | ] | 204 | ] |
203 | self.plot(graphs, title, name, conf) | 205 | self.plot(graphs, title, name, conf) |
204 | 206 | ||
207 | def make_plot(self, fname=None): | ||
208 | p = Plot() | ||
209 | p.output = "%s.%s" % (fname, self.options.format) | ||
210 | p.format = self.options.format | ||
211 | return p | ||
212 | |||
213 | def setup_png(self, plot): | ||
214 | # standard png options; usually correct; never tweaked for paper | ||
215 | if self.options.format == 'png': | ||
216 | plot.font_size = 'large' | ||
217 | plot.size = (1024, 768) | ||
218 | plot.xticks = (0, 1) | ||
219 | plot.yticks = (0, 0.1) | ||
220 | plot.default_style = "linespoints" | ||
221 | return True | ||
222 | else: | ||
223 | return False | ||
224 | |||
225 | |||
205 | def plot_irq(self, tmpfile, name, conf): | 226 | def plot_irq(self, tmpfile, name, conf): |
206 | graphs = [ | 227 | p = self.make_plot(name) |
207 | (tmpfile, 1, 2, 'quantum-centric (100% overhead)'), | 228 | |
208 | (tmpfile, 1, 3, 'task-centric (100% overhead)'), | 229 | #### Data. |
209 | (tmpfile, 1, 4, 'processor-centric (100% overhead)'), | 230 | |
210 | (tmpfile, 1, 5, 'quantum-centric (20% overhead)'), | 231 | titles = ['quantum-centric', |
211 | (tmpfile, 1, 6, 'task-centric (20% overhead)'), | 232 | 'task-centric', |
212 | (tmpfile, 1, 7, 'processor-centric (20% overhead)'), | 233 | 'processor-centric', |
213 | ] | 234 | 'dedicated processor', |
214 | if self.options.paper and self.options.format == 'pdf': | 235 | 'dedicated proc. + timer multiplexing'] |
215 | title = scenario_heading(conf) | 236 | |
216 | self.plot_paper(graphs, title, name, conf) | 237 | if self.options.alternate: |
238 | extra = '; 20% ISR costs' | ||
239 | cols = [8, 9, 10, 12, 14] | ||
240 | p.output = 'alt_' + p.output | ||
217 | else: | 241 | else: |
218 | title = 'Interrupt accounting under G-EDF: utilization ' + scenario_heading(conf) | 242 | extra = '; 100% ISR costs' |
219 | self.plot(graphs, title, name, conf) | 243 | cols = [1, 2, 3, 5, 7] |
244 | |||
245 | p.curves += [ curve(fname=tmpfile, xcol=1, ycol=(y + 1), title=t) | ||
246 | for (y, t) in zip(cols, titles) ] | ||
247 | |||
248 | #### Styling. | ||
249 | |||
250 | if not self.setup_png(p): | ||
251 | # eps or pdf | ||
252 | p.rounded_caps = True | ||
253 | p.font = 'Helvetica' | ||
254 | |||
255 | if self.options.paper: | ||
256 | # workaround strange font-size bug | ||
257 | if self.options.format == 'eps': | ||
258 | p.font_size = '9.5pt' | ||
259 | else: | ||
260 | p.font_size = '5pt' | ||
261 | p.size = ('6.5cm', '5.25cm') | ||
262 | p.monochrome = True | ||
263 | p.dashed_lines = True | ||
264 | p.key = 'off' | ||
265 | |||
266 | p.xticks = (0, 2) | ||
267 | p.yrange = (-0.1, 1.1) | ||
268 | p.yticks = (0, 0.2) | ||
269 | p.xlabel = "task set utilization cap (prior to overhead accounting)" | ||
270 | p.default_style = 'lines lw 2.5' | ||
271 | else: | ||
272 | p.font_size = '10' | ||
273 | p.size = ('20cm', '10cm') | ||
274 | p.monochrome = False | ||
275 | p.dashed_lines = False | ||
276 | p.key = 'below' | ||
277 | |||
278 | p.xticks = (0, 1) | ||
279 | p.yrange = (-0.05, 1.05) | ||
280 | p.yticks = (0, 0.1) | ||
281 | p.xlabel = "ucap (prior to inflation)" | ||
282 | p.default_style = 'lines lw 6' | ||
283 | |||
284 | p.ylabel = "schedulability " + (' [soft]' if 'soft' in conf else ' [hard]') | ||
285 | p.xrange = (0.5, 32.5) | ||
286 | |||
287 | p.title = scenario_heading(conf) + extra | ||
288 | if not self.options.paper: | ||
289 | p.title = 'Interrupt accounting under G-EDF: utilization ' + p.title | ||
290 | |||
291 | # print str(p.gnuplot_commands()) | ||
292 | p.gnuplot_exec() | ||
220 | 293 | ||
221 | def plot_rtss09(self, tmpfile, name, conf): | 294 | def plot_rtss09(self, tmpfile, name, conf): |
222 | title = scenario_heading(conf, want_period=True) | 295 | title = scenario_heading(conf, want_period=True) |