From 1d4c0da88cdd6fada48350e1b9e64602b8ca863b Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Sun, 3 Jul 2011 16:45:57 -0400 Subject: support comparison overhead plotting --- oplot.py | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 104 insertions(+), 7 deletions(-) (limited to 'oplot.py') diff --git a/oplot.py b/oplot.py index 2945b63..21edf64 100755 --- a/oplot.py +++ b/oplot.py @@ -2,6 +2,7 @@ import defapp from plot import decode +from dplot import sched_name from util import load_csv_file, load_binary_file, write_csv_file from stats import iqr_cutoff @@ -59,6 +60,8 @@ options = [ o(None, '--cycles', action='store', dest='cycles', type='int', help='how many cycles per usec'), + o(None, '--compare', action='store', dest='compare', + help='plot overhead comparison', choices=['max', 'avg']), ] defaults = { @@ -86,12 +89,14 @@ defaults = { 'xmax' : None, 'ymax' : None, 'ylog' : False, + + 'compare' : None, } TXT = { - 'RELEASE-LATENCY' : 'timer interrupt latency', - 'RELEASE' : 'job release overhead', + 'RELEASE-LATENCY' : 'event latency', + 'RELEASE' : 'release interrupt overhead', 'SCHED' : 'scheduling overhead', 'SCHED2' : 'post-scheduling overhead', 'CXS' : 'context-switch overhead', @@ -291,7 +296,7 @@ class OverheadPlotter(defapp.App): self.render(p) - def prepare_trends(self, datafile, name, conf): + def prepare_trends(self, datafile, name, conf, want_avg_ymax=False): data = load_csv_file(datafile) if not self.options.per_proc and \ 'host' in conf and conf['host'] in HOST_CPUS: @@ -312,7 +317,10 @@ class OverheadPlotter(defapp.App): r[std_idx]] for r in data] - max_y = numpy.amax(data[:,wc_idx]) + if want_avg_ymax: + max_y = numpy.amax(data[:,avg_idx]) + else: + max_y = numpy.amax(data[:,wc_idx]) return (self.write(rows, name), cpus, max_y) @@ -363,6 +371,92 @@ class OverheadPlotter(defapp.App): self.render(p) + def plot_comparison(self, datafiles): + + if self.options.compare == 'max': + stat = 'maximum' + want_avg_ymax = False + else: + stat = 'average' + want_avg_ymax = True + + plots = [] + max_y = 0 + cpus = 0 + overheads = set() + + for i, datafile in enumerate(datafiles): + self.out("[%d/%d] Processing %s ..." % (i + 1, len(datafiles), datafile)) + bname = basename(datafile) + name, ext = splitext(bname) + conf = decode(name) + overheads.add(conf['overhead']) + fname, _cpus, _max_y = self.prepare_trends(datafile, name, conf, want_avg_ymax) + max_y = max(max_y, _max_y) + cpus = max(cpus, _cpus) + plots.append((fname, conf)) + + assert len(overheads) == 1 + overhead = overheads.pop() + + + schedulers = '_'.join([conf['scheduler'] for (_, conf) in plots]) + + name = 'compare_%s-%s_%s' % (stat, overhead, schedulers) + + p = self.make_plot(name) + + p.title = "%s measured %s" \ + % (stat, TXT[overhead]) + + p.ylabel = "overhead in microseconds" + if self.options.per_proc: + p.xlabel = "number of tasks per processor" + else: + p.xlabel = "number of tasks" + + p.xticks = (0, max(cpus, 10)) + if self.options.xmax: + p.xrange = (0, self.options.xmax) + elif self.options.per_proc: + p.xrange = (0.5, 20.5) + p.xticks = (0, 1) + else: + p.xrange = (0, ceil(cpus * 20 / 100.0) * 100) + + if self.options.ymax: + p.yrange = (0, self.options.ymax) + else: + p.yrange = (0, (ceil(max_y / 10.0)) * 10) + + for (fname, conf) in plots: + name = sched_name(conf['scheduler']) + if self.options.compare == 'max': + p.curves += [ + curve(fname, xcol=1, ycol=2, title=name)] + else: + p.curves += [ + curve(fname, xcol=1, ycol=3, title=name)] +# curve(fname, xcol=1, ycol=3, error=4, title='notitle')] + + #### Styling. + + marker = 'lines' + if len(p.curves) > 2: + p.curves[2].style = marker + " ls 4" + + if len(p.curves) > 3: + p.curves[3].style = marker + " ls 6" + + p.font_size = '7' + p.size = ('6in', '2.50in') + p.monochrome = True #False + p.dashed_lines = True #True + p.key = 'top left' + p.default_style = marker + ' lw 1' + p.pointsize = 2 + + self.render(p) def plot_file(self, datafile): bname = basename(datafile) @@ -390,9 +484,12 @@ class OverheadPlotter(defapp.App): if self.options.outlier_file: self.options.outliers = load_outliers(self.options.outlier_file) - for i, datafile in enumerate(self.args): - self.out("[%d/%d] Processing %s ..." % (i + 1, len(self.args), datafile)) - self.plot_file(datafile) + if not self.options.compare is None: + self.plot_comparison(self.args) + else: + for i, datafile in enumerate(self.args): + self.out("[%d/%d] Processing %s ..." % (i + 1, len(self.args), datafile)) + self.plot_file(datafile) if __name__ == "__main__": OverheadPlotter().launch() -- cgit v1.2.2