aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2011-10-18 22:24:51 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2011-10-18 22:24:51 -0400
commit6469f7be7b5edf73b9ecd8d498199961a8be3dd9 (patch)
tree3c0b8aa7e6182e3de3ecce5819a8863d9fcc218f
parent8ef8c63dda2f75b312a9b1a6194271de6cc8a449 (diff)
add png format, too
-rwxr-xr-xplot_rtas12.py45
-rwxr-xr-xplot_rtas12_betaexp.py20
2 files changed, 42 insertions, 23 deletions
diff --git a/plot_rtas12.py b/plot_rtas12.py
index f4deef9..5cbcabd 100755
--- a/plot_rtas12.py
+++ b/plot_rtas12.py
@@ -2,6 +2,7 @@
2 2
3import sys 3import sys
4import time 4import time
5import optparse
5 6
6from os.path import basename 7from os.path import basename
7from os import listdir 8from os import listdir
@@ -27,6 +28,11 @@ COLS = {'plugin': 0,
27 'iqr_min': 12} 28 'iqr_min': 12}
28 29
29 30
31def parse_args():
32 p = optparse.OptionParser(description='make graphs')
33 p.add_option('--paper', dest='paper', action='store_true', default=False)
34 return p.parse_args()
35
30def usage(msg): 36def usage(msg):
31 print >>sys.stderr, msg 37 print >>sys.stderr, msg
32 sys.exit(1) 38 sys.exit(1)
@@ -56,11 +62,9 @@ def get_overhead_title(ov):
56 'LVLA-RELEASE': '(A)'} 62 'LVLA-RELEASE': '(A)'}
57 return OV[ov] 63 return OV[ov]
58 64
59def set_plot_opts(p): 65def set_plot_opts(opts, p):
60 p.rounded_caps = True 66 p.rounded_caps = True
61 p.font = 'Helvetica' 67 p.font = 'Helvetica'
62 p.font_size = '5pt'
63 p.size = ('8.5cm', '5.25cm')
64 p.default_style = 'linespoints lw 2.5' 68 p.default_style = 'linespoints lw 2.5'
65 p.default_style += ' smooth bezier' 69 p.default_style += ' smooth bezier'
66 p.key = 'off' 70 p.key = 'off'
@@ -69,6 +73,16 @@ def set_plot_opts(p):
69 p.xrange = (18, 122) 73 p.xrange = (18, 122)
70 p.yrange = (0, '') 74 p.yrange = (0, '')
71 75
76 if opts.paper:
77 ext = 'pdf'
78 p.size = ('8.5cm', '5.25cm')
79 p.font_size = '5pt'
80 else:
81 ext = 'png'
82 p.size = (1024, 768)
83 p.output = '{0}.{1}'.format(p.output, ext)
84 p.format = ext
85
72 for i, c in enumerate(p.curves): 86 for i, c in enumerate(p.curves):
73 c.style = "linespoints ls %d" % (i + 1) 87 c.style = "linespoints ls %d" % (i + 1)
74 88
@@ -141,10 +155,9 @@ def include_level_a_releases(data_dir, o_type, scheduler, ycol):
141 return (f.name, f) 155 return (f.name, f)
142 156
143 157
144def plot_release(data_dir, ycol, title, fname): 158def plot_release(opts, data_dir, ycol, title, fname):
145 p = Plot() 159 p = Plot()
146 p.output = '{0}/{1}'.format(data_dir, fname) 160 p.output = '{0}/{1}'.format(data_dir, fname)
147 p.format = 'pdf'
148 refs = [] # need to save reference to file handle so it is not deleted 161 refs = [] # need to save reference to file handle so it is not deleted
149 162
150 for o_type in ['RELEASE', 'LVLA-RELEASE']: 163 for o_type in ['RELEASE', 'LVLA-RELEASE']:
@@ -162,7 +175,7 @@ def plot_release(data_dir, ycol, title, fname):
162 ycol=ycol, title=ti)] 175 ycol=ycol, title=ti)]
163 p.xlabel = 'number of tasks' 176 p.xlabel = 'number of tasks'
164 p.ylabel = 'overhead (microseconds)' 177 p.ylabel = 'overhead (microseconds)'
165 set_plot_opts(p) 178 set_plot_opts(opts, p)
166 if gnuplot_col('avg') == ycol: 179 if gnuplot_col('avg') == ycol:
167 # make this graph's y-scale match the scale on the average-case 180 # make this graph's y-scale match the scale on the average-case
168 # scheduling overhead graph because they are next to each other 181 # scheduling overhead graph because they are next to each other
@@ -171,10 +184,9 @@ def plot_release(data_dir, ycol, title, fname):
171 p.key = 'top left' 184 p.key = 'top left'
172 p.gnuplot_exec() 185 p.gnuplot_exec()
173 186
174def plot_sched(data_dir, ycol, title, fname): 187def plot_sched(opts, data_dir, ycol, title, fname):
175 p = Plot() 188 p = Plot()
176 p.output = '{0}/{1}'.format(data_dir, fname) 189 p.output = '{0}/{1}'.format(data_dir, fname)
177 p.format = 'pdf'
178 190
179 for o_type in ['SCHED', 'LVLA-SCHED']: 191 for o_type in ['SCHED', 'LVLA-SCHED']:
180 for sched in SCHEDULERS: 192 for sched in SCHEDULERS:
@@ -184,19 +196,22 @@ def plot_sched(data_dir, ycol, title, fname):
184 ycol=ycol, title=ti)] 196 ycol=ycol, title=ti)]
185 p.xlabel = 'number of tasks' 197 p.xlabel = 'number of tasks'
186 p.ylabel = 'overhead (microseconds)' 198 p.ylabel = 'overhead (microseconds)'
187 set_plot_opts(p) 199 set_plot_opts(opts, p)
188 p.gnuplot_exec() 200 p.gnuplot_exec()
189 201
190 202
191def main(): 203def main():
192 if len(sys.argv) < 2: 204
205 opts, extra = parse_args()
206
207 if len(extra) < 1:
193 usage('missing args') 208 usage('missing args')
194 209
195 data_dir = sys.argv[1] 210 data_dir = extra[0]
196 plot_sched(data_dir, gnuplot_col('max'), 'worst-case scheduling overhead', 'overhead=SCHED_type=MAX.pdf') 211 plot_sched(opts, data_dir, gnuplot_col('max'), 'worst-case scheduling overhead', 'overhead=SCHED_type=MAX')
197 plot_release(data_dir, gnuplot_col('max'), 'worst-case release overhead', 'overhead=RELEASE_type=MAX.pdf') 212 plot_release(opts, data_dir, gnuplot_col('max'), 'worst-case release overhead', 'overhead=RELEASE_type=MAX')
198 plot_sched(data_dir, gnuplot_col('avg'), 'average-case scheduling overhead', 'overhead=SCHED_type=AVG.pdf') 213 plot_sched(opts, data_dir, gnuplot_col('avg'), 'average-case scheduling overhead', 'overhead=SCHED_type=AVG')
199 plot_release(data_dir, gnuplot_col('avg'), 'average-case release overhead', 'overhead=RELEASE_type=AVG.pdf') 214 plot_release(opts, data_dir, gnuplot_col('avg'), 'average-case release overhead', 'overhead=RELEASE_type=AVG')
200 215
201if __name__ == '__main__': 216if __name__ == '__main__':
202 main() 217 main()
diff --git a/plot_rtas12_betaexp.py b/plot_rtas12_betaexp.py
index 11f29b3..2153222 100755
--- a/plot_rtas12_betaexp.py
+++ b/plot_rtas12_betaexp.py
@@ -43,11 +43,18 @@ def get_y_label(metric):
43 return LABELS[metric] 43 return LABELS[metric]
44 44
45 45
46def set_plot_opts(p): 46def set_plot_opts(opts, p):
47 p.rounded_caps = True 47 p.rounded_caps = True
48 p.font = 'Helvetica' 48 p.font = 'Helvetica'
49 p.font_size = '5pt' 49 if opts.paper:
50 p.size = ('8.5cm', '5.25cm') 50 ext = 'pdf'
51 p.size = ('8.5cm', '5.25cm')
52 p.font_size = '5pt'
53 else:
54 ext = 'png'
55 p.size = (1024, 768)
56 p.output = '{0}.{1}'.format(p.output, ext)
57 p.format = ext
51 p.default_style = 'linespoints lw 2.5' 58 p.default_style = 'linespoints lw 2.5'
52 p.default_style += ' smooth bezier' 59 p.default_style += ' smooth bezier'
53 p.monochrome = False 60 p.monochrome = False
@@ -66,16 +73,13 @@ def plot_metric(opts, dat_dir, metric, coin_prob, xr=None):
66 """Plot metric for each level, enforcement pair at the specified 73 """Plot metric for each level, enforcement pair at the specified
67 probability. 74 probability.
68 75
69 .""" 76 """
70 # each coin value gets a plot 77 # each coin value gets a plot
71 p = Plot() 78 p = Plot()
72 p.output = '{0}/beta-exp-metric={1}-prob={2}'.format( 79 p.output = '{0}/beta-exp-metric={1}-prob={2}'.format(
73 dat_dir, metric, str(coin_prob).replace('.', '')) 80 dat_dir, metric, str(coin_prob).replace('.', ''))
74 if xr is not None: 81 if xr is not None:
75 p.output = '{0}-zoom=1'.format(p.output) 82 p.output = '{0}-zoom=1'.format(p.output)
76 p.output = '{0}.pdf'.format(p.output)
77
78 p.format = 'pdf'
79 83
80 for (level, enforcement) in [(l, e) for l in ('c', 'b') for e in (1, 0)]: 84 for (level, enforcement) in [(l, e) for l in ('c', 'b') for e in (1, 0)]:
81 fname = '{0}/beta_be={1}_prob={2}.csv'.format(dat_dir, enforcement, coin_prob) 85 fname = '{0}/beta_be={1}_prob={2}.csv'.format(dat_dir, enforcement, coin_prob)
@@ -88,7 +92,7 @@ def plot_metric(opts, dat_dir, metric, coin_prob, xr=None):
88 p.curves += [c] 92 p.curves += [c]
89 p.xlabel = 'beta mean with probability {0}'.format(coin_prob) 93 p.xlabel = 'beta mean with probability {0}'.format(coin_prob)
90 p.ylabel = get_y_label(metric) 94 p.ylabel = get_y_label(metric)
91 set_plot_opts(p) 95 set_plot_opts(opts, p)
92 if xr is not None: 96 if xr is not None:
93 p.xrange = xr 97 p.xrange = xr
94 98