aboutsummaryrefslogtreecommitdiffstats
path: root/plot_rtas12.py
diff options
context:
space:
mode:
Diffstat (limited to 'plot_rtas12.py')
-rwxr-xr-xplot_rtas12.py45
1 files changed, 30 insertions, 15 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()