From cff6fda4e6acfd3978702618160a055981f09f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=2E=20Brandenburg?= Date: Tue, 25 May 2010 14:59:00 -0400 Subject: Incorporate JSA'09 changes based on new Plot class --- plot.py | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 87 insertions(+), 14 deletions(-) (limited to 'plot.py') diff --git a/plot.py b/plot.py index e649025..f9039c9 100755 --- a/plot.py +++ b/plot.py @@ -4,7 +4,7 @@ from os.path import splitext, basename from optparse import make_option as o from tempfile import NamedTemporaryFile as Tmp -from gnuplot import gnuplot, FORMATS +from gnuplot import gnuplot, FORMATS, Plot, label, curve options = [ o('-f', '--format', action='store', dest='format', type='choice', @@ -13,6 +13,7 @@ options = [ o(None, '--wide', action='store_true', dest='wide'), o(None, '--column', action='store_true', dest='column'), o(None, '--split', action='store_true', dest='split'), + o(None, '--alternate', action='store_true', dest='alternate'), ] defaults = { @@ -27,6 +28,7 @@ defaults = { 'paper' : False, 'split' : False, 'wide' : False, + 'alternate' : False, 'column' : False, } @@ -202,21 +204,92 @@ class SchedPlotter(defapp.App): ] self.plot(graphs, title, name, conf) + def make_plot(self, fname=None): + p = Plot() + p.output = "%s.%s" % (fname, self.options.format) + p.format = self.options.format + return p + + def setup_png(self, plot): + # standard png options; usually correct; never tweaked for paper + if self.options.format == 'png': + plot.font_size = 'large' + plot.size = (1024, 768) + plot.xticks = (0, 1) + plot.yticks = (0, 0.1) + plot.default_style = "linespoints" + return True + else: + return False + + def plot_irq(self, tmpfile, name, conf): - graphs = [ - (tmpfile, 1, 2, 'quantum-centric (100% overhead)'), - (tmpfile, 1, 3, 'task-centric (100% overhead)'), - (tmpfile, 1, 4, 'processor-centric (100% overhead)'), - (tmpfile, 1, 5, 'quantum-centric (20% overhead)'), - (tmpfile, 1, 6, 'task-centric (20% overhead)'), - (tmpfile, 1, 7, 'processor-centric (20% overhead)'), - ] - if self.options.paper and self.options.format == 'pdf': - title = scenario_heading(conf) - self.plot_paper(graphs, title, name, conf) + p = self.make_plot(name) + + #### Data. + + titles = ['quantum-centric', + 'task-centric', + 'processor-centric', + 'dedicated processor', + 'dedicated proc. + timer multiplexing'] + + if self.options.alternate: + extra = '; 20% ISR costs' + cols = [8, 9, 10, 12, 14] + p.output = 'alt_' + p.output else: - title = 'Interrupt accounting under G-EDF: utilization ' + scenario_heading(conf) - self.plot(graphs, title, name, conf) + extra = '; 100% ISR costs' + cols = [1, 2, 3, 5, 7] + + p.curves += [ curve(fname=tmpfile, xcol=1, ycol=(y + 1), title=t) + for (y, t) in zip(cols, titles) ] + + #### Styling. + + if not self.setup_png(p): + # eps or pdf + p.rounded_caps = True + p.font = 'Helvetica' + + if self.options.paper: + # workaround strange font-size bug + if self.options.format == 'eps': + p.font_size = '9.5pt' + else: + p.font_size = '5pt' + p.size = ('6.5cm', '5.25cm') + p.monochrome = True + p.dashed_lines = True + p.key = 'off' + + p.xticks = (0, 2) + p.yrange = (-0.1, 1.1) + p.yticks = (0, 0.2) + p.xlabel = "task set utilization cap (prior to overhead accounting)" + p.default_style = 'lines lw 2.5' + else: + p.font_size = '10' + p.size = ('20cm', '10cm') + p.monochrome = False + p.dashed_lines = False + p.key = 'below' + + p.xticks = (0, 1) + p.yrange = (-0.05, 1.05) + p.yticks = (0, 0.1) + p.xlabel = "ucap (prior to inflation)" + p.default_style = 'lines lw 6' + + p.ylabel = "schedulability " + (' [soft]' if 'soft' in conf else ' [hard]') + p.xrange = (0.5, 32.5) + + p.title = scenario_heading(conf) + extra + if not self.options.paper: + p.title = 'Interrupt accounting under G-EDF: utilization ' + p.title + +# print str(p.gnuplot_commands()) + p.gnuplot_exec() def plot_rtss09(self, tmpfile, name, conf): title = scenario_heading(conf, want_period=True) -- cgit v1.2.2