diff options
| -rwxr-xr-x | plot_rtas12.py | 127 |
1 files changed, 69 insertions, 58 deletions
diff --git a/plot_rtas12.py b/plot_rtas12.py index d5e9ed9..d65534e 100755 --- a/plot_rtas12.py +++ b/plot_rtas12.py | |||
| @@ -50,26 +50,38 @@ 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 = {'SCHED': '(A, B, C)', | 59 | OV = {'LVLA-SCHED': 'A', |
| 60 | 'LVLA-SCHED': '(A)', | 60 | 'LVLB-SCHED': 'B', |
| 61 | 'RELEASE': '(A, B, C)', | 61 | 'LVLC-SCHED': 'C', |
| 62 | 'LVLA-RELEASE': '(A)'} | 62 | 'LVLA-RELEASE': 'A', |
| 63 | 'LVLB-RELEASE': 'B', | ||
| 64 | 'LVLC-RELEASE': 'C', | ||
| 65 | } | ||
| 63 | return OV[ov] | 66 | return OV[ov] |
| 64 | 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 | |||
| 65 | def set_plot_opts(opts, p): | 79 | def set_plot_opts(opts, p): |
| 66 | p.rounded_caps = True | 80 | p.rounded_caps = True |
| 67 | p.font = 'Helvetica' | 81 | p.font = 'Helvetica' |
| 68 | p.default_style = 'linespoints lw 2.5' | ||
| 69 | p.default_style += ' smooth bezier' | ||
| 70 | p.key = 'off' | 82 | p.key = 'off' |
| 71 | p.monochrome = False | 83 | p.monochrome = False |
| 72 | p.dashed_lines = False | 84 | p.dashed_lines = True |
| 73 | p.xrange = (18, 122) | 85 | p.xrange = (18, 122) |
| 74 | p.yrange = (0, '') | 86 | p.yrange = (0, '') |
| 75 | 87 | ||
| @@ -88,27 +100,18 @@ def set_plot_opts(opts, p): | |||
| 88 | p.output = '{0}.{1}'.format(p.output, ext) | 100 | p.output = '{0}.{1}'.format(p.output, ext) |
| 89 | p.format = ext | 101 | p.format = ext |
| 90 | 102 | ||
| 91 | for i, c in enumerate(p.curves): | ||
| 92 | c.style = "linespoints ls %d" % (i + 1) | ||
| 93 | |||
| 94 | try: | ||
| 95 | # don't use yellow if we have this curve | ||
| 96 | p.curves[5].style = "linespoints ls 7" | ||
| 97 | except IndexError: | ||
| 98 | pass | ||
| 99 | |||
| 100 | p.line_styles = [ | 103 | p.line_styles = [ |
| 101 | (1, "lw {0} ps {1}".format(line_width, point_size)), | 104 | (1, 'lt 1 pt 1 lw {0} ps {1} lc rgbcolor "#ff0000"'.format(line_width, point_size)), |
| 102 | (2, "lw {0} ps {1}".format(line_width, point_size)), | 105 | (2, 'lt 1 pt 4 lw {0} ps {1} lc rgbcolor "#00ff00"'.format(line_width, point_size)), |
| 103 | (3, "lw {0} ps {1}".format(line_width, point_size)), | 106 | (3, 'lt 1 pt 7 lw {0} ps {1} lc rgbcolor "#0000ff"'.format(line_width, point_size)), |
| 104 | (4, "lw {0} ps {1}".format(line_width, point_size)), | 107 | (4, 'lt 2 pt 1 lw {0} ps {1} lc rgbcolor "#ff0000"'.format(line_width, point_size)), |
| 105 | (5, 'pt 6 lw {0} ps {1} lc rgbcolor "#ff910d"'.format(line_width, point_size)), | 108 | (5, 'lt 2 pt 4 lw {0} ps {1} lc rgbcolor "#00ff00"'.format(line_width, point_size)), |
| 106 | (6, "pt 7 lw {0} ps {1}".format(line_width, point_size)), | 109 | (6, 'lt 2 pt 7 lw {0} ps {1} lc rgbcolor "#0000ff"'.format(line_width, point_size)), |
| 107 | (7, 'lw {0} ps {1} lc rgbcolor "#000000"'.format(line_width, point_size)), | 110 | (7, 'lt 3 pt 1 lw {0} ps {1} lc rgbcolor "#ff0000"'.format(line_width, point_size)), |
| 108 | (8, "lw {0} ps {1}".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)), | ||
| 109 | ] | 113 | ] |
| 110 | 114 | ||
| 111 | |||
| 112 | def get_data_matrix(fname): | 115 | def get_data_matrix(fname): |
| 113 | ret = [] | 116 | ret = [] |
| 114 | with open(fname, 'r') as f: | 117 | with open(fname, 'r') as f: |
| @@ -162,34 +165,36 @@ def include_level_a_releases(data_dir, o_type, scheduler, ycol): | |||
| 162 | f.file.flush() | 165 | f.file.flush() |
| 163 | return (f.name, f) | 166 | return (f.name, f) |
| 164 | 167 | ||
| 168 | def add_key_to_plot(p): | ||
| 169 | p.key = 'on tmargin center horizontal maxcolumns 3' | ||
| 170 | p.size = ('8.5cm', '6.25cm') | ||
| 165 | 171 | ||
| 166 | def plot_release(opts, data_dir, ycol, title, fname): | 172 | def plot_release(opts, data_dir, ycol_name, title, levels): |
| 167 | p = Plot() | 173 | levels = levels.upper() |
| 168 | p.output = '{0}/{1}'.format(data_dir, fname) | ||
| 169 | 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) | ||
| 170 | 177 | ||
| 171 | for o_type in ['RELEASE', 'LVLA-RELEASE']: | 178 | for o_type in ['LVL{0}-RELEASE'.format(l) for l in levels]: |
| 172 | for sched in SCHEDULERS: | 179 | for sched in SCHEDULERS: |
| 173 | if o_type == 'RELEASE': | 180 | # if o_type == 'RELEASE': |
| 174 | # we have to make the regular release include the level-A | 181 | # # we have to make the regular release include the level-A |
| 175 | # releases | 182 | # # releases |
| 176 | fname, ref = include_level_a_releases(data_dir, o_type, | 183 | # fname, ref = include_level_a_releases(data_dir, o_type, |
| 177 | sched, ycol) | 184 | # sched, ycol) |
| 178 | refs.append(ref) | 185 | # refs.append(ref) |
| 179 | else: | 186 | # else: |
| 180 | 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) |
| 181 | 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)) |
| 182 | p.curves += [curve(fname=fname, xcol=gnuplot_col('n_tasks'), | 189 | c = curve(fname=fname, xcol=gnuplot_col('n_tasks'), |
| 183 | ycol=ycol, title=ti)] | 190 | ycol=gnuplot_col(ycol_name), title=ti, |
| 191 | style=get_line_style(sched, o_type)) | ||
| 192 | p.curves += [c] | ||
| 184 | p.xlabel = 'number of tasks' | 193 | p.xlabel = 'number of tasks' |
| 185 | p.ylabel = 'overhead (microseconds)' | 194 | p.ylabel = 'overhead (microseconds)' |
| 186 | set_plot_opts(opts, p) | 195 | set_plot_opts(opts, p) |
| 187 | if gnuplot_col('avg') == ycol: | 196 | if 'avg' == ycol_name and 'ABC' == levels: |
| 188 | # make this graph's y-scale match the scale on the average-case | 197 | add_key_to_plot(p) |
| 189 | # scheduling overhead graph because they are next to each other | ||
| 190 | p.yrange = (0, 16) | ||
| 191 | # it gets the key | ||
| 192 | p.key = 'top left' | ||
| 193 | p.gnuplot_exec() | 198 | p.gnuplot_exec() |
| 194 | 199 | ||
| 195 | def plot_release_jim(opts, data_dir, ycol, title, fname): | 200 | def plot_release_jim(opts, data_dir, ycol, title, fname): |
| @@ -210,19 +215,24 @@ def plot_release_jim(opts, data_dir, ycol, title, fname): | |||
| 210 | p.title = 'level-A worst-case release overhead' | 215 | p.title = 'level-A worst-case release overhead' |
| 211 | p.gnuplot_exec() | 216 | p.gnuplot_exec() |
| 212 | 217 | ||
| 213 | def plot_sched(opts, data_dir, ycol, title, fname): | 218 | def plot_sched(opts, data_dir, ycol_name, title, levels): |
| 219 | levels = levels.upper() | ||
| 214 | p = Plot() | 220 | p = Plot() |
| 215 | p.output = '{0}/{1}'.format(data_dir, fname) | 221 | p.output = get_graph_fname(data_dir, 'SCHED', levels, ycol_name) |
| 216 | 222 | ||
| 217 | for o_type in ['SCHED', 'LVLA-SCHED']: | 223 | for o_type in ['LVL{0}-SCHED'.format(l) for l in levels]: |
| 218 | for sched in SCHEDULERS: | 224 | for sched in SCHEDULERS: |
| 219 | 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) |
| 220 | 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)) |
| 221 | p.curves += [curve(fname=fname, xcol=gnuplot_col('n_tasks'), | 227 | c = curve(fname=fname, xcol=gnuplot_col('n_tasks'), |
| 222 | ycol=ycol, title=ti)] | 228 | ycol=gnuplot_col(ycol_name), title=ti, |
| 229 | style=get_line_style(sched, o_type)) | ||
| 230 | p.curves += [c] | ||
| 223 | p.xlabel = 'number of tasks' | 231 | p.xlabel = 'number of tasks' |
| 224 | p.ylabel = 'overhead (microseconds)' | 232 | p.ylabel = 'overhead (microseconds)' |
| 225 | 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) | ||
| 226 | p.gnuplot_exec() | 236 | p.gnuplot_exec() |
| 227 | 237 | ||
| 228 | 238 | ||
| @@ -234,11 +244,12 @@ def main(): | |||
| 234 | usage('missing args') | 244 | usage('missing args') |
| 235 | 245 | ||
| 236 | data_dir = extra[0] | 246 | data_dir = extra[0] |
| 237 | plot_sched(opts, data_dir, gnuplot_col('max'), 'worst-case scheduling overhead', 'overhead=SCHED_type=MAX') | 247 | for levels in ('ABC', 'AC', 'BC'): |
| 238 | 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) |
| 239 | 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) |
| 240 | 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) |
| 241 | 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') | ||
| 242 | 253 | ||
| 243 | if __name__ == '__main__': | 254 | if __name__ == '__main__': |
| 244 | main() | 255 | main() |
