diff options
-rwxr-xr-x | plot_rtas12.py | 104 |
1 files changed, 50 insertions, 54 deletions
diff --git a/plot_rtas12.py b/plot_rtas12.py index 6d1d408..d65534e 100755 --- a/plot_rtas12.py +++ b/plot_rtas12.py | |||
@@ -50,26 +50,35 @@ def gnuplot_col(col_name): | |||
50 | return 1 + COLS[col_name] | 50 | return 1 + COLS[col_name] |
51 | 51 | ||
52 | def get_sched_title(sched): | 52 | def get_sched_title(sched): |
53 | SCHEDULERS = {'MC': 'Basic', | 53 | SCHEDULERS = {'MC': 'Basic:', |
54 | 'MC-MERGE': 'IM + TM', | 54 | 'MC-MERGE': 'IM + TM:', |
55 | 'MC-MERGE-REDIR': 'IM + TM + WR'} | 55 | 'MC-MERGE-REDIR': 'All:'} |
56 | return SCHEDULERS[sched] | 56 | return SCHEDULERS[sched] |
57 | 57 | ||
58 | def get_overhead_title(ov): | 58 | def get_overhead_title(ov): |
59 | OV = {'LVLA-SCHED': '(A)', | 59 | OV = {'LVLA-SCHED': 'A', |
60 | 'LVLB-SCHED': '(B)', | 60 | 'LVLB-SCHED': 'B', |
61 | 'LVLC-SCHED': '(C)', | 61 | 'LVLC-SCHED': 'C', |
62 | 'LVLA-RELEASE': '(A)', | 62 | 'LVLA-RELEASE': 'A', |
63 | 'LVLB-RELEASE': '(B)', | 63 | 'LVLB-RELEASE': 'B', |
64 | 'LVLC-RELEASE': '(C)', | 64 | 'LVLC-RELEASE': 'C', |
65 | } | 65 | } |
66 | return OV[ov] | 66 | return OV[ov] |
67 | 67 | ||
68 | def get_line_style(sched, o_type): | ||
69 | S = { 'MC' : {'LVLA': 1, 'LVLB': 4, 'LVLC': 7}, | ||
70 | 'MC-MERGE': {'LVLA': 2, 'LVLB': 5, 'LVLC': 8}, | ||
71 | 'MC-MERGE-REDIR': {'LVLA': 3, 'LVLB': 6, 'LVLC': 9}} | ||
72 | o = o_type.split('-')[0] | ||
73 | return 'linespoints linestyle {0}'.format(S[sched][o]) | ||
74 | |||
75 | def get_graph_fname(directory, o_type, levels, ycol_type): | ||
76 | return '{0}/overhead={1}-levels={2}-type={3}'.format(directory, o_type, | ||
77 | levels, ycol_type) | ||
78 | |||
68 | def set_plot_opts(opts, p): | 79 | def set_plot_opts(opts, p): |
69 | p.rounded_caps = True | 80 | p.rounded_caps = True |
70 | p.font = 'Helvetica' | 81 | p.font = 'Helvetica' |
71 | p.default_style = 'linespoints lw 2.5' | ||
72 | p.default_style += ' smooth bezier' | ||
73 | p.key = 'off' | 82 | p.key = 'off' |
74 | p.monochrome = False | 83 | p.monochrome = False |
75 | p.dashed_lines = True | 84 | p.dashed_lines = True |
@@ -91,15 +100,6 @@ def set_plot_opts(opts, p): | |||
91 | p.output = '{0}.{1}'.format(p.output, ext) | 100 | p.output = '{0}.{1}'.format(p.output, ext) |
92 | p.format = ext | 101 | p.format = ext |
93 | 102 | ||
94 | for i, c in enumerate(p.curves): | ||
95 | c.style = "linespoints ls %d" % (i + 1) | ||
96 | |||
97 | # try: | ||
98 | # # don't use yellow if we have this curve | ||
99 | # p.curves[5].style = "linespoints ls 7" | ||
100 | # except IndexError: | ||
101 | # pass | ||
102 | |||
103 | p.line_styles = [ | 103 | p.line_styles = [ |
104 | (1, 'lt 1 pt 1 lw {0} ps {1} lc rgbcolor "#ff0000"'.format(line_width, point_size)), | 104 | (1, 'lt 1 pt 1 lw {0} ps {1} lc rgbcolor "#ff0000"'.format(line_width, point_size)), |
105 | (2, 'lt 1 pt 4 lw {0} ps {1} lc rgbcolor "#00ff00"'.format(line_width, point_size)), | 105 | (2, 'lt 1 pt 4 lw {0} ps {1} lc rgbcolor "#00ff00"'.format(line_width, point_size)), |
@@ -110,18 +110,8 @@ def set_plot_opts(opts, p): | |||
110 | (7, 'lt 3 pt 1 lw {0} ps {1} lc rgbcolor "#ff0000"'.format(line_width, point_size)), | 110 | (7, 'lt 3 pt 1 lw {0} ps {1} lc rgbcolor "#ff0000"'.format(line_width, point_size)), |
111 | (8, 'lt 3 pt 4 lw {0} ps {1} lc rgbcolor "#00ff00"'.format(line_width, point_size)), | 111 | (8, 'lt 3 pt 4 lw {0} ps {1} lc rgbcolor "#00ff00"'.format(line_width, point_size)), |
112 | (9, 'lt 3 pt 7 lw {0} ps {1} lc rgbcolor "#0000ff"'.format(line_width, point_size)), | 112 | (9, 'lt 3 pt 7 lw {0} ps {1} lc rgbcolor "#0000ff"'.format(line_width, point_size)), |
113 | # (1, 'lw {0} ps {1} lc rgbcolor "#ff0000"'.format(line_width, point_size)), | ||
114 | # (2, "lw {0} ps {1} lt 2".format(line_width, point_size)), | ||
115 | # (3, "lw {0} ps {1} lt3 ".format(line_width, point_size)), | ||
116 | # (4, "lw {0} ps {1}".format(line_width, point_size)), | ||
117 | # (5, 'pt 6 lw {0} ps {1} lc rgbcolor "#ff910d"'.format(line_width, point_size)), | ||
118 | # (6, "pt 7 lw {0} ps {1}".format(line_width, point_size)), | ||
119 | # (7, 'lw {0} ps {1} lc rgbcolor "#000000"'.format(line_width, point_size)), | ||
120 | # (8, "lw {0} ps {1}".format(line_width, point_size)), | ||
121 | # (9, "lw {0} ps {1}".format(line_width, point_size)), | ||
122 | ] | 113 | ] |
123 | 114 | ||
124 | |||
125 | def get_data_matrix(fname): | 115 | def get_data_matrix(fname): |
126 | ret = [] | 116 | ret = [] |
127 | with open(fname, 'r') as f: | 117 | with open(fname, 'r') as f: |
@@ -175,14 +165,17 @@ def include_level_a_releases(data_dir, o_type, scheduler, ycol): | |||
175 | f.file.flush() | 165 | f.file.flush() |
176 | return (f.name, f) | 166 | return (f.name, f) |
177 | 167 | ||
168 | def add_key_to_plot(p): | ||
169 | p.key = 'on tmargin center horizontal maxcolumns 3' | ||
170 | p.size = ('8.5cm', '6.25cm') | ||
178 | 171 | ||
179 | def plot_release(opts, data_dir, ycol, title, fname): | 172 | def plot_release(opts, data_dir, ycol_name, title, levels): |
180 | p = Plot() | 173 | levels = levels.upper() |
181 | p.output = '{0}/{1}'.format(data_dir, fname) | ||
182 | refs = [] # need to save reference to file handle so it is not deleted | 174 | refs = [] # need to save reference to file handle so it is not deleted |
175 | p = Plot() | ||
176 | p.output = get_graph_fname(data_dir, 'RELEASE', levels, ycol_name) | ||
183 | 177 | ||
184 | # for o_type in ['LVLA-RELEASE','LVLB-RELEASE', 'LVLC-RELEASE']: | 178 | for o_type in ['LVL{0}-RELEASE'.format(l) for l in levels]: |
185 | for o_type in ['LVLA-RELEASE','LVLC-RELEASE']: | ||
186 | for sched in SCHEDULERS: | 179 | for sched in SCHEDULERS: |
187 | # if o_type == 'RELEASE': | 180 | # if o_type == 'RELEASE': |
188 | # # we have to make the regular release include the level-A | 181 | # # we have to make the regular release include the level-A |
@@ -193,17 +186,15 @@ def plot_release(opts, data_dir, ycol, title, fname): | |||
193 | # else: | 186 | # else: |
194 | fname = '{0}/scheduler={1}_overhead={2}.csv'.format(data_dir, sched, o_type) | 187 | fname = '{0}/scheduler={1}_overhead={2}.csv'.format(data_dir, sched, o_type) |
195 | ti = '{0} {1}'.format(get_sched_title(sched), get_overhead_title(o_type)) | 188 | ti = '{0} {1}'.format(get_sched_title(sched), get_overhead_title(o_type)) |
196 | p.curves += [curve(fname=fname, xcol=gnuplot_col('n_tasks'), | 189 | c = curve(fname=fname, xcol=gnuplot_col('n_tasks'), |
197 | ycol=ycol, title=ti)] | 190 | ycol=gnuplot_col(ycol_name), title=ti, |
191 | style=get_line_style(sched, o_type)) | ||
192 | p.curves += [c] | ||
198 | p.xlabel = 'number of tasks' | 193 | p.xlabel = 'number of tasks' |
199 | p.ylabel = 'overhead (microseconds)' | 194 | p.ylabel = 'overhead (microseconds)' |
200 | set_plot_opts(opts, p) | 195 | set_plot_opts(opts, p) |
201 | if gnuplot_col('avg') == ycol: | 196 | if 'avg' == ycol_name and 'ABC' == levels: |
202 | # make this graph's y-scale match the scale on the average-case | 197 | add_key_to_plot(p) |
203 | # scheduling overhead graph because they are next to each other | ||
204 | p.yrange = (0, 16) | ||
205 | # it gets the key | ||
206 | p.key = 'top left' | ||
207 | p.gnuplot_exec() | 198 | p.gnuplot_exec() |
208 | 199 | ||
209 | def plot_release_jim(opts, data_dir, ycol, title, fname): | 200 | def plot_release_jim(opts, data_dir, ycol, title, fname): |
@@ -224,20 +215,24 @@ def plot_release_jim(opts, data_dir, ycol, title, fname): | |||
224 | p.title = 'level-A worst-case release overhead' | 215 | p.title = 'level-A worst-case release overhead' |
225 | p.gnuplot_exec() | 216 | p.gnuplot_exec() |
226 | 217 | ||
227 | def plot_sched(opts, data_dir, ycol, title, fname): | 218 | def plot_sched(opts, data_dir, ycol_name, title, levels): |
219 | levels = levels.upper() | ||
228 | p = Plot() | 220 | p = Plot() |
229 | p.output = '{0}/{1}'.format(data_dir, fname) | 221 | p.output = get_graph_fname(data_dir, 'SCHED', levels, ycol_name) |
230 | 222 | ||
231 | # for o_type in ['LVLA-SCHED','LVLB-SCHED','LVLC-SCHED']: | 223 | for o_type in ['LVL{0}-SCHED'.format(l) for l in levels]: |
232 | for o_type in ['LVLA-SCHED','LVLC-SCHED']: | ||
233 | for sched in SCHEDULERS: | 224 | for sched in SCHEDULERS: |
234 | fname = '{0}/scheduler={1}_overhead={2}.csv'.format(data_dir, sched, o_type) | 225 | fname = '{0}/scheduler={1}_overhead={2}.csv'.format(data_dir, sched, o_type) |
235 | ti = '{0} {1}'.format(get_sched_title(sched), get_overhead_title(o_type)) | 226 | ti = '{0} {1}'.format(get_sched_title(sched), get_overhead_title(o_type)) |
236 | p.curves += [curve(fname=fname, xcol=gnuplot_col('n_tasks'), | 227 | c = curve(fname=fname, xcol=gnuplot_col('n_tasks'), |
237 | ycol=ycol, title=ti)] | 228 | ycol=gnuplot_col(ycol_name), title=ti, |
229 | style=get_line_style(sched, o_type)) | ||
230 | p.curves += [c] | ||
238 | p.xlabel = 'number of tasks' | 231 | p.xlabel = 'number of tasks' |
239 | p.ylabel = 'overhead (microseconds)' | 232 | p.ylabel = 'overhead (microseconds)' |
240 | set_plot_opts(opts, p) | 233 | set_plot_opts(opts, p) |
234 | if 'avg' == ycol_name and 'ABC' == levels: | ||
235 | add_key_to_plot(p) | ||
241 | p.gnuplot_exec() | 236 | p.gnuplot_exec() |
242 | 237 | ||
243 | 238 | ||
@@ -249,11 +244,12 @@ def main(): | |||
249 | usage('missing args') | 244 | usage('missing args') |
250 | 245 | ||
251 | data_dir = extra[0] | 246 | data_dir = extra[0] |
252 | plot_sched(opts, data_dir, gnuplot_col('max'), 'worst-case scheduling overhead', 'overhead=SCHED_type=MAX') | 247 | for levels in ('ABC', 'AC', 'BC'): |
253 | plot_release(opts, data_dir, gnuplot_col('max'), 'worst-case release overhead', 'overhead=RELEASE_type=MAX') | 248 | plot_sched(opts, data_dir, 'max', 'worst-case scheduling overhead', levels) |
254 | plot_sched(opts, data_dir, gnuplot_col('avg'), 'average-case scheduling overhead', 'overhead=SCHED_type=AVG') | 249 | plot_release(opts, data_dir, 'max', 'worst-case release overhead', levels) |
255 | plot_release(opts, data_dir, gnuplot_col('avg'), 'average-case release overhead', 'overhead=RELEASE_type=AVG') | 250 | plot_sched(opts, data_dir, 'avg', 'average-case scheduling overhead', levels) |
256 | plot_release_jim(opts, data_dir, gnuplot_col('max'), 'worst-case release overhead', 'overhead=RELEASE_type=MAX_for-jim=1') | 251 | plot_release(opts, data_dir, 'avg', 'average-case release overhead', levels) |
252 | #plot_release_jim(opts, data_dir, 'max', 'worst-case release overhead', 'overhead=RELEASE_type=MAX_for-jim=1') | ||
257 | 253 | ||
258 | if __name__ == '__main__': | 254 | if __name__ == '__main__': |
259 | main() | 255 | main() |