From 3ccfe7790cb0a678f635895e20a359eb89f6f712 Mon Sep 17 00:00:00 2001 From: Andrea Bastoni Date: Wed, 21 Apr 2010 22:47:07 -0400 Subject: Changes made to manually tweak plots for april version of ospert10 --- gnuplot.py | 4 ++-- plot_pm.py | 40 +++++++++++++++++++++++++++++++--------- plot_pm2.py | 28 +++++++++++++++++++++------- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/gnuplot.py b/gnuplot.py index 2604cb0..b717683 100755 --- a/gnuplot.py +++ b/gnuplot.py @@ -126,8 +126,8 @@ def pipe2gnuplot(cmds): proc.wait() def gnuplot(*args, **kargs): - cmd = gnuplot_cmd(*args, **kargs) - pipe2gnuplot(cmd) + cmd = gnuplot_cmd(*args, **kargs) + pipe2gnuplot(cmd) def eps2pdf(file): Popen(['ps2pdf', '-dEPSCrop', '%s.eps' % file]).wait() diff --git a/plot_pm.py b/plot_pm.py index 2975b45..bc8ffff 100755 --- a/plot_pm.py +++ b/plot_pm.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import defapp +import time from os.path import splitext, basename from optparse import make_option as o from tempfile import NamedTemporaryFile as Tmp @@ -50,19 +51,32 @@ def overhead_heading(conf, sharedL3=False): ovd_type = 'unknowkn overhead' if 'ovd' in conf: if conf['ovd'] == 'preemption': - ovd_type = 'Preemption' + ovd_type = 'a preemption' elif conf['ovd'] == 'onchip': if sharedL3: - ovd_type = 'Shared L3' + ovd_type = 'a migration through a shared L3 cache' else: - ovd_type = 'Shared L2' + ovd_type = 'a migration through a shared L2 cache' elif conf['ovd'] == 'l2cache': - ovd_type = 'Shared L2' + ovd_type = 'a migration through a shared L2 cache' elif conf['ovd'] == 'offchip': - ovd_type = 'Diff. Socket' + ovd_type = 'a migration through main memory' return ovd_type +def style_selector(conf): + style = 'ls 1' + if 'ovd' in conf: + if conf['ovd'] == 'preemption': + style += '1' + elif conf['ovd'] == 'onchip': + style += '2' + elif conf['ovd'] == 'l2cache': + style += '3' + elif conf['ovd'] == 'offchip': + style += '4' + return style + class PmPlotter(defapp.App): def __init__(self): defapp.App.__init__(self, options, defaults, no_std_opts=True) @@ -91,16 +105,16 @@ class PmPlotter(defapp.App): def plot(self, graphs, title, name, conf, **xtra): name = self.compose_name(conf) print name + style = ('yerrorlines' if 'soft' in conf else 'linespoints') gnuplot(graphs, title=title, xlabel=self.options.xlabel, - ylabel=self.options.ylabel + - (' [avg]' if 'soft' in conf else ' [max]'), + ylabel=self.options.ylabel, #xrange=self.options.xrange, #yrange=self.options.yrange, #xticks=self.options.xticks, #yticks=self.options.yticks, format=self.options.format, - style=('yerrorlines' if 'soft' in conf else 'linespoints'), + style=style, fname=name, **xtra) def compose_title(self, conf): @@ -119,7 +133,9 @@ class PmPlotter(defapp.App): wsspos += 1 for i in wsslist: self.fname['wss'].add(i) - label = conf['ovd'] + ' WSS=' + i + ### XXX tweaking for ospert + #label = conf['ovd'] + ' WSS=' + i + label = overhead_heading(conf, self.options.sharedL3) if 'soft' in conf: self.graphs_list.append((tmpfile, 1, wsspos, wsspos+1, \ wsspos+2, label)) @@ -129,6 +145,10 @@ class PmPlotter(defapp.App): def plot_graph_list(self, type, name): self.plot(self.graphs_list, self.title, name, type) + ### XXX bad bad bad hack + ### for just one graph save tmp file and plot the gnuplot output for + ### manual tweaking + time.sleep(20) # delete temporary data files for tmp in self.tmpfile_list: @@ -152,6 +172,8 @@ class PmPlotter(defapp.App): % bname) # keep a list of temporary data files self.tmpfile_list.append(tmpfile) + ### XXX part of the bad ack + print tmpfile.name + ' ' + name else: self.err("Skipped '%s'; it dosn't appear to contain data." % bname) diff --git a/plot_pm2.py b/plot_pm2.py index c2fcbf3..914c4f4 100755 --- a/plot_pm2.py +++ b/plot_pm2.py @@ -13,7 +13,7 @@ import stats import defapp from plot import decode -from gnuplot import gnuplot, FileGraph, FORMATS +from gnuplot import gnuplot, FileGraph, FORMATS, gnuplot_cmd @@ -410,8 +410,8 @@ class CyclePlotter(defapp.App): fname = "%s_full_%s" % (name, kind) - gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, - yrange=yrange, logscale=axis, format=self.options.format) + #gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, + # yrange=yrange, logscale=axis, format=self.options.format) # per-sample delta measures for offset, kind, long in [(0, 'avg', 'average'), (2, 'wc', 'maximum')]: @@ -429,8 +429,22 @@ class CyclePlotter(defapp.App): yrange = None fname = "%s_delta_%s" % (name, kind) - gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, - yrange=yrange, logscale=axis, format=self.options.format) + figname = "fig_" + fname + cmd = gnuplot_cmd(graphs, + xlabel=xlabel, + ylabel=ylabel, + yrange=yrange, + logscale=axis, + title=title, + format=self.options.format, + fname=figname) + f = open("%s.plot" % figname, "w") + f.write(str(cmd)) + f.close() + del f + + #gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, + # yrange=yrange, logscale=axis, format=self.options.format) graphs = [] for (x, y, yminus, tag, idx) in columns: @@ -446,8 +460,8 @@ class CyclePlotter(defapp.App): yrange = None fname = "%s_delta-h_%s" % (name, kind) - gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, - yrange=yrange, logscale=axis, format=self.options.format) + #gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, + # yrange=yrange, logscale=axis, format=self.options.format) # del tmp -- cgit v1.2.2