diff options
| -rwxr-xr-x | plot_rtas12.py | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/plot_rtas12.py b/plot_rtas12.py new file mode 100755 index 0000000..abfa8b2 --- /dev/null +++ b/plot_rtas12.py | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | #!/usr/bin/env python | ||
| 2 | |||
| 3 | import sys | ||
| 4 | |||
| 5 | from os.path import basename | ||
| 6 | from os import listdir | ||
| 7 | |||
| 8 | from plot import decode, Plot | ||
| 9 | from gnuplot import curve | ||
| 10 | |||
| 11 | SCHEDULERS = ['MC', 'MC-MERGE', 'MC-MERGE-REDIR'] | ||
| 12 | OVERHEADS = ['SCHED', 'RELEASE', 'LVLA-RELEASE'] | ||
| 13 | COLS = {'plugin': 0, | ||
| 14 | 'overhead': 1, | ||
| 15 | 'n_tasks': 2, | ||
| 16 | 'samples': 3, | ||
| 17 | 'filtered': 4, | ||
| 18 | 'max': 5, | ||
| 19 | 'avg': 6, | ||
| 20 | 'min': 7, | ||
| 21 | 'med': 8, | ||
| 22 | 'std': 9, | ||
| 23 | 'var': 10, | ||
| 24 | 'iqr_max': 11, | ||
| 25 | 'iqr_min': 12} | ||
| 26 | |||
| 27 | |||
| 28 | def usage(msg): | ||
| 29 | print >>sys.stderr, msg | ||
| 30 | sys.exit(1) | ||
| 31 | |||
| 32 | def get_csv_files(directory): | ||
| 33 | a = [] | ||
| 34 | for f in listdir(directory): | ||
| 35 | bn = basename(f) | ||
| 36 | if f.startswith('scheduler') and f.endswith('.csv'): | ||
| 37 | a.append(f) | ||
| 38 | return a | ||
| 39 | |||
| 40 | def gnuplot_col(col_name): | ||
| 41 | # gnuplot is 1-indexed | ||
| 42 | return 1 + COLS[col_name] | ||
| 43 | |||
| 44 | def plot_release(data_dir): | ||
| 45 | p = Plot() | ||
| 46 | p.output = '{0}/overhead=RELEASE.pdf'.format(data_dir) | ||
| 47 | p.format = 'pdf' | ||
| 48 | p.key = 'top left' | ||
| 49 | |||
| 50 | for rel_type in ['RELEASE', 'LVLA-RELEASE']: | ||
| 51 | for sched in SCHEDULERS: | ||
| 52 | fname = '{0}/scheduler={1}_overhead={2}.csv'.format(data_dir, sched, rel_type) | ||
| 53 | p.curves += [curve(fname=fname, xcol=gnuplot_col('n_tasks'), | ||
| 54 | ycol=gnuplot_col('avg'), title='{0} {1}'.format(sched, rel_type))] | ||
| 55 | p.xlabel = 'number of tasks' | ||
| 56 | p.ylabel = 'overhead (microseconds)' | ||
| 57 | p.title = 'release overheads' | ||
| 58 | p.gnuplot_exec() | ||
| 59 | |||
| 60 | def plot_sched(data_dir): | ||
| 61 | p = Plot() | ||
| 62 | p.output = '{0}/overhead=SCHED.pdf'.format(data_dir) | ||
| 63 | p.format = 'pdf' | ||
| 64 | p.key = 'top left' | ||
| 65 | |||
| 66 | for sched in SCHEDULERS: | ||
| 67 | fname = '{0}/scheduler={1}_overhead=SCHED.csv'.format(data_dir, sched) | ||
| 68 | p.curves += [curve(fname=fname, xcol=gnuplot_col('n_tasks'), | ||
| 69 | ycol=gnuplot_col('avg'), title='{0}'.format(sched))] | ||
| 70 | p.xlabel = 'number of tasks' | ||
| 71 | p.ylabel = 'overhead (microseconds)' | ||
| 72 | p.title = 'scheduling overheads' | ||
| 73 | p.gnuplot_exec() | ||
| 74 | |||
| 75 | |||
| 76 | def main(): | ||
| 77 | if len(sys.argv) < 2: | ||
| 78 | usage('missing args') | ||
| 79 | |||
| 80 | data_dir = sys.argv[1] | ||
| 81 | plot_sched(data_dir) | ||
| 82 | plot_release(data_dir) | ||
| 83 | |||
| 84 | if __name__ == '__main__': | ||
| 85 | main() | ||
