diff options
-rwxr-xr-x | gnuplot.py | 4 | ||||
-rwxr-xr-x | plot_pm.py | 40 | ||||
-rwxr-xr-x | plot_pm2.py | 28 |
3 files changed, 54 insertions, 18 deletions
@@ -126,8 +126,8 @@ def pipe2gnuplot(cmds): | |||
126 | proc.wait() | 126 | proc.wait() |
127 | 127 | ||
128 | def gnuplot(*args, **kargs): | 128 | def gnuplot(*args, **kargs): |
129 | cmd = gnuplot_cmd(*args, **kargs) | 129 | cmd = gnuplot_cmd(*args, **kargs) |
130 | pipe2gnuplot(cmd) | 130 | pipe2gnuplot(cmd) |
131 | 131 | ||
132 | def eps2pdf(file): | 132 | def eps2pdf(file): |
133 | Popen(['ps2pdf', '-dEPSCrop', '%s.eps' % file]).wait() | 133 | Popen(['ps2pdf', '-dEPSCrop', '%s.eps' % file]).wait() |
@@ -1,5 +1,6 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | import defapp | 2 | import defapp |
3 | import time | ||
3 | from os.path import splitext, basename | 4 | from os.path import splitext, basename |
4 | from optparse import make_option as o | 5 | from optparse import make_option as o |
5 | from tempfile import NamedTemporaryFile as Tmp | 6 | from tempfile import NamedTemporaryFile as Tmp |
@@ -50,19 +51,32 @@ def overhead_heading(conf, sharedL3=False): | |||
50 | ovd_type = 'unknowkn overhead' | 51 | ovd_type = 'unknowkn overhead' |
51 | if 'ovd' in conf: | 52 | if 'ovd' in conf: |
52 | if conf['ovd'] == 'preemption': | 53 | if conf['ovd'] == 'preemption': |
53 | ovd_type = 'Preemption' | 54 | ovd_type = 'a preemption' |
54 | elif conf['ovd'] == 'onchip': | 55 | elif conf['ovd'] == 'onchip': |
55 | if sharedL3: | 56 | if sharedL3: |
56 | ovd_type = 'Shared L3' | 57 | ovd_type = 'a migration through a shared L3 cache' |
57 | else: | 58 | else: |
58 | ovd_type = 'Shared L2' | 59 | ovd_type = 'a migration through a shared L2 cache' |
59 | elif conf['ovd'] == 'l2cache': | 60 | elif conf['ovd'] == 'l2cache': |
60 | ovd_type = 'Shared L2' | 61 | ovd_type = 'a migration through a shared L2 cache' |
61 | elif conf['ovd'] == 'offchip': | 62 | elif conf['ovd'] == 'offchip': |
62 | ovd_type = 'Diff. Socket' | 63 | ovd_type = 'a migration through main memory' |
63 | 64 | ||
64 | return ovd_type | 65 | return ovd_type |
65 | 66 | ||
67 | def style_selector(conf): | ||
68 | style = 'ls 1' | ||
69 | if 'ovd' in conf: | ||
70 | if conf['ovd'] == 'preemption': | ||
71 | style += '1' | ||
72 | elif conf['ovd'] == 'onchip': | ||
73 | style += '2' | ||
74 | elif conf['ovd'] == 'l2cache': | ||
75 | style += '3' | ||
76 | elif conf['ovd'] == 'offchip': | ||
77 | style += '4' | ||
78 | return style | ||
79 | |||
66 | class PmPlotter(defapp.App): | 80 | class PmPlotter(defapp.App): |
67 | def __init__(self): | 81 | def __init__(self): |
68 | defapp.App.__init__(self, options, defaults, no_std_opts=True) | 82 | defapp.App.__init__(self, options, defaults, no_std_opts=True) |
@@ -91,16 +105,16 @@ class PmPlotter(defapp.App): | |||
91 | def plot(self, graphs, title, name, conf, **xtra): | 105 | def plot(self, graphs, title, name, conf, **xtra): |
92 | name = self.compose_name(conf) | 106 | name = self.compose_name(conf) |
93 | print name | 107 | print name |
108 | style = ('yerrorlines' if 'soft' in conf else 'linespoints') | ||
94 | gnuplot(graphs, title=title, | 109 | gnuplot(graphs, title=title, |
95 | xlabel=self.options.xlabel, | 110 | xlabel=self.options.xlabel, |
96 | ylabel=self.options.ylabel + | 111 | ylabel=self.options.ylabel, |
97 | (' [avg]' if 'soft' in conf else ' [max]'), | ||
98 | #xrange=self.options.xrange, | 112 | #xrange=self.options.xrange, |
99 | #yrange=self.options.yrange, | 113 | #yrange=self.options.yrange, |
100 | #xticks=self.options.xticks, | 114 | #xticks=self.options.xticks, |
101 | #yticks=self.options.yticks, | 115 | #yticks=self.options.yticks, |
102 | format=self.options.format, | 116 | format=self.options.format, |
103 | style=('yerrorlines' if 'soft' in conf else 'linespoints'), | 117 | style=style, |
104 | fname=name, **xtra) | 118 | fname=name, **xtra) |
105 | 119 | ||
106 | def compose_title(self, conf): | 120 | def compose_title(self, conf): |
@@ -119,7 +133,9 @@ class PmPlotter(defapp.App): | |||
119 | wsspos += 1 | 133 | wsspos += 1 |
120 | for i in wsslist: | 134 | for i in wsslist: |
121 | self.fname['wss'].add(i) | 135 | self.fname['wss'].add(i) |
122 | label = conf['ovd'] + ' WSS=' + i | 136 | ### XXX tweaking for ospert |
137 | #label = conf['ovd'] + ' WSS=' + i | ||
138 | label = overhead_heading(conf, self.options.sharedL3) | ||
123 | if 'soft' in conf: | 139 | if 'soft' in conf: |
124 | self.graphs_list.append((tmpfile, 1, wsspos, wsspos+1, \ | 140 | self.graphs_list.append((tmpfile, 1, wsspos, wsspos+1, \ |
125 | wsspos+2, label)) | 141 | wsspos+2, label)) |
@@ -129,6 +145,10 @@ class PmPlotter(defapp.App): | |||
129 | 145 | ||
130 | def plot_graph_list(self, type, name): | 146 | def plot_graph_list(self, type, name): |
131 | self.plot(self.graphs_list, self.title, name, type) | 147 | self.plot(self.graphs_list, self.title, name, type) |
148 | ### XXX bad bad bad hack | ||
149 | ### for just one graph save tmp file and plot the gnuplot output for | ||
150 | ### manual tweaking | ||
151 | time.sleep(20) | ||
132 | 152 | ||
133 | # delete temporary data files | 153 | # delete temporary data files |
134 | for tmp in self.tmpfile_list: | 154 | for tmp in self.tmpfile_list: |
@@ -152,6 +172,8 @@ class PmPlotter(defapp.App): | |||
152 | % bname) | 172 | % bname) |
153 | # keep a list of temporary data files | 173 | # keep a list of temporary data files |
154 | self.tmpfile_list.append(tmpfile) | 174 | self.tmpfile_list.append(tmpfile) |
175 | ### XXX part of the bad ack | ||
176 | print tmpfile.name + ' ' + name | ||
155 | else: | 177 | else: |
156 | self.err("Skipped '%s'; it dosn't appear to contain data." | 178 | self.err("Skipped '%s'; it dosn't appear to contain data." |
157 | % bname) | 179 | % 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 | |||
13 | import defapp | 13 | import defapp |
14 | 14 | ||
15 | from plot import decode | 15 | from plot import decode |
16 | from gnuplot import gnuplot, FileGraph, FORMATS | 16 | from gnuplot import gnuplot, FileGraph, FORMATS, gnuplot_cmd |
17 | 17 | ||
18 | 18 | ||
19 | 19 | ||
@@ -410,8 +410,8 @@ class CyclePlotter(defapp.App): | |||
410 | 410 | ||
411 | fname = "%s_full_%s" % (name, kind) | 411 | fname = "%s_full_%s" % (name, kind) |
412 | 412 | ||
413 | gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, | 413 | #gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, |
414 | yrange=yrange, logscale=axis, format=self.options.format) | 414 | # yrange=yrange, logscale=axis, format=self.options.format) |
415 | 415 | ||
416 | # per-sample delta measures | 416 | # per-sample delta measures |
417 | for offset, kind, long in [(0, 'avg', 'average'), (2, 'wc', 'maximum')]: | 417 | for offset, kind, long in [(0, 'avg', 'average'), (2, 'wc', 'maximum')]: |
@@ -429,8 +429,22 @@ class CyclePlotter(defapp.App): | |||
429 | yrange = None | 429 | yrange = None |
430 | 430 | ||
431 | fname = "%s_delta_%s" % (name, kind) | 431 | fname = "%s_delta_%s" % (name, kind) |
432 | gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, | 432 | figname = "fig_" + fname |
433 | yrange=yrange, logscale=axis, format=self.options.format) | 433 | cmd = gnuplot_cmd(graphs, |
434 | xlabel=xlabel, | ||
435 | ylabel=ylabel, | ||
436 | yrange=yrange, | ||
437 | logscale=axis, | ||
438 | title=title, | ||
439 | format=self.options.format, | ||
440 | fname=figname) | ||
441 | f = open("%s.plot" % figname, "w") | ||
442 | f.write(str(cmd)) | ||
443 | f.close() | ||
444 | del f | ||
445 | |||
446 | #gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, | ||
447 | # yrange=yrange, logscale=axis, format=self.options.format) | ||
434 | 448 | ||
435 | graphs = [] | 449 | graphs = [] |
436 | for (x, y, yminus, tag, idx) in columns: | 450 | for (x, y, yminus, tag, idx) in columns: |
@@ -446,8 +460,8 @@ class CyclePlotter(defapp.App): | |||
446 | yrange = None | 460 | yrange = None |
447 | 461 | ||
448 | fname = "%s_delta-h_%s" % (name, kind) | 462 | fname = "%s_delta-h_%s" % (name, kind) |
449 | gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, | 463 | #gnuplot(graphs, xlabel=xlabel, ylabel=ylabel, title=title, fname=fname, |
450 | yrange=yrange, logscale=axis, format=self.options.format) | 464 | # yrange=yrange, logscale=axis, format=self.options.format) |
451 | 465 | ||
452 | # del tmp | 466 | # del tmp |
453 | 467 | ||