From 98ce8d88ca3d8476759c006a9ba8262beb045c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20B=2E=20Brandenburg?= Date: Sun, 28 Mar 2010 00:20:56 -0400 Subject: improve pm2 plotter: - error bars - hot vs. hot error - keep aggregate CSVs around. --- plot_pm2.py | 58 ++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 14 deletions(-) (limited to 'plot_pm2.py') diff --git a/plot_pm2.py b/plot_pm2.py index 09b2d49..40e6a63 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, FORMATS +from gnuplot import gnuplot, FileGraph, FORMATS @@ -75,6 +75,8 @@ PMO_AGGR_SUBPLOTS = [ # (0, 10, 7, True), # (0, 10, 8, True), (0, 10, 9, True), + (0, 8, 7, False), # difference of second to first hot access + (0, 9, 8, False), # difference of third to second hot access ] PMO_AGGR_COMBINE = [ @@ -104,6 +106,7 @@ options = [ o(None, '--wide', action='store_true', dest='wide'), o(None, '--split', action='store_true', dest='split'), o(None, '--log-y', action='store_true', dest='logy'), + o(None, '--errorbar', action='store_true', dest='errbar'), o(None, '--extend', action='store', type='float', dest='extend'), o(None, '--aggregate', action='store_true', dest='aggregate'), o('-c', '--cycles-per-usec', action='store', type='float', dest='cycles_per_usec'), @@ -117,7 +120,8 @@ defaults = { 'aggregate' : False, 'extend' : 1.5, 'cycles_per_usec' : None, - 'logy' : False, + 'logy' : False, + 'errbar' : False, } def extract_cols(data, xcol, ycol1, ycol2, cast=int, cpu_filter=lambda x, y: True): @@ -346,11 +350,16 @@ class CyclePlotter(defapp.App): mems = [tag for (tag, _) in MACHINE_TOPOLOGY[host][1]] columns = [] idx = 2 + header = ["wss"] for (x, y, yminus, split) in PMO_AGGR_SUBPLOTS: tags = ['all'] if split: tags += mems for tag in tags: + col_name = "%s %s" % (PMO_COL_LABEL[y][1], tag) + if not yminus is None: + col_name += ' - ' + PMO_COL_LABEL[yminus][1] + header += [col_name + " avg", col_name + " std", col_name + " wc"] columns.append((x, y, yminus, tag, idx)) idx += 3 @@ -360,7 +369,10 @@ class CyclePlotter(defapp.App): data[:, 1:] /= self.options.cycles_per_usec else: yunit = "(cycles)" - tmp = write_csv_file(None, data) + + csvfile = "xxx-%s" % datafile + + write_csv_file(csvfile, data, header, width=max([len(h) for h in header])) rw = int(conf['wcycle']) rw = 1.0 / rw * 100 if rw != 0 else 0 @@ -378,9 +390,10 @@ class CyclePlotter(defapp.App): label = PMO_COL_LABEL[y][0] if y == 10: label += " from %s" % PMO_MEM[tag] - graphs += [ - (tmp.name, 1, idx + offset, label), - ] + graphs.append( + FileGraph( + csvfile, xcol=1, ycol=idx + offset, title=label, + error=idx + offset + 1 if kind == 'avg' and self.options.errbar else None)) xlabel = "working set size (kilobytes)" ylabel = "time to complete access " + yunit title = "measured %s WSS access time (%.2f%% writes)" % (long, rw) @@ -397,9 +410,10 @@ class CyclePlotter(defapp.App): for (x, y, yminus, tag, idx) in columns: if not (yminus is None) and tag != 'all': label = "%s" % PMO_MEM[tag] - graphs += [ - (tmp.name, 1, idx + offset, label), - ] + graphs.append( + FileGraph( + csvfile, xcol=1, ycol=idx + offset, title=label, + error=idx + offset + 1 if kind == 'avg' and self.options.errbar else None)) xlabel = "working set size (kilobytes)" ylabel = "per-sample delta to hot access " + yunit title = "measured %s overhead (%.2f%% writes)" % (long, rw) @@ -408,7 +422,25 @@ class CyclePlotter(defapp.App): fname = "%s_delta_%s" % (name, kind) gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, yrange=yrange, logscale=axis, format=self.options.format) - del tmp + + graphs = [] + for (x, y, yminus, tag, idx) in columns: + if y in [8, 9] and yminus in [7, 8] and tag == 'all': + label = "%s to %s" % (PMO_COL_LABEL[yminus][0], PMO_COL_LABEL[y][0]) + graphs.append( + FileGraph( + csvfile, xcol=1, ycol=idx + offset, title=label, + error=idx + offset + 1 if kind == 'avg' and self.options.errbar else None)) + xlabel = "working set size (kilobytes)" + ylabel = "per-sample delta to previous hot access " + yunit + title = "measured %s differences (%.2f%% writes)" % (long, rw) + 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) + +# del tmp # stats delta # find hot column @@ -433,9 +465,7 @@ class CyclePlotter(defapp.App): if yminus is None and tag != 'all': label = PMO_COL_LABEL[y][0] label = PMO_MEM[tag] - graphs += [ - (tmp.name, 1, idx + offset, label), - ] + graphs.append(FileGraph(tmp.name, xcol=1, ycol=idx+offset, title=label)) xlabel = "working set size (kilobytes)" ylabel = "delta to third hot access " + yunit title = "difference of %s access costs (%.2f%% writes)" % (long, rw) @@ -444,7 +474,7 @@ class CyclePlotter(defapp.App): fname = "%s_diff_%s" % (name, kind) gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, yrange=yrange, logscale=axis, format=self.options.format) - del tmp +# del tmp def plot_file(self, datafile): bname = basename(datafile) -- cgit v1.2.2