diff options
| author | Björn B. Brandenburg <bbb@cs.unc.edu> | 2010-03-26 09:48:09 -0400 |
|---|---|---|
| committer | Björn B. Brandenburg <bbb@cs.unc.edu> | 2010-03-26 09:48:09 -0400 |
| commit | 0c6cb5129ccce032fcc5aea0859b46129c180c5c (patch) | |
| tree | af209855c288a11e064ef2e83cd6d08efd7eaf8f /plot_pm.py | |
| parent | 174498f1daa9ccd46323c63b030175e4646afcd9 (diff) | |
| parent | a048bb28a4f1377e81cecdefc3f9fb64f4bab7ed (diff) | |
Merge branch 'master' of cvs.cs.unc.edu:/cvs/proj/litmus/repo/simple-gnuplot-wrapper
Diffstat (limited to 'plot_pm.py')
| -rwxr-xr-x | plot_pm.py | 62 |
1 files changed, 3 insertions, 59 deletions
| @@ -4,6 +4,7 @@ from os.path import splitext, basename | |||
| 4 | from optparse import make_option as o | 4 | from optparse import make_option as o |
| 5 | from tempfile import NamedTemporaryFile as Tmp | 5 | from tempfile import NamedTemporaryFile as Tmp |
| 6 | 6 | ||
| 7 | from plot import decode, scenario_heading, get_data_tmpfile | ||
| 7 | from gnuplot import gnuplot, FORMATS | 8 | from gnuplot import gnuplot, FORMATS |
| 8 | 9 | ||
| 9 | options = [ | 10 | options = [ |
| @@ -26,8 +27,8 @@ defaults = { | |||
| 26 | 'alloh' : False, | 27 | 'alloh' : False, |
| 27 | 'type' : 'hard', | 28 | 'type' : 'hard', |
| 28 | 'format' : 'show', | 29 | 'format' : 'show', |
| 29 | 'xrange' : (74.5, 250.5), | 30 | 'xrange' : (99.5, 200.5), |
| 30 | 'yrange' : (0, 4350.05), | 31 | 'yrange' : (0, 5300.05), |
| 31 | 'xticks' : (0, 10), | 32 | 'xticks' : (0, 10), |
| 32 | 'yticks' : (0, 100), | 33 | 'yticks' : (0, 100), |
| 33 | 'title' : None, | 34 | 'title' : None, |
| @@ -38,63 +39,6 @@ defaults = { | |||
| 38 | 'wide' : False, | 39 | 'wide' : False, |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | def decode(name): | ||
| 42 | params = {} | ||
| 43 | parts = name.split('_') | ||
| 44 | for p in parts: | ||
| 45 | kv = p.split('=') | ||
| 46 | k = kv[0] | ||
| 47 | v = kv[1] if len(kv) > 1 else None | ||
| 48 | params[k] = v | ||
| 49 | return params | ||
| 50 | |||
| 51 | def get_data_tmpfile(datafile): | ||
| 52 | """Removes all comments form datafile, stores result in a temp file. | ||
| 53 | The temp file is returned.""" | ||
| 54 | count = 0 | ||
| 55 | f = open(datafile, 'r') | ||
| 56 | d = Tmp() | ||
| 57 | for line in f: | ||
| 58 | if len(line) > 1 and line[0] != '#': | ||
| 59 | d.write(line) | ||
| 60 | count += 1 | ||
| 61 | f.close() | ||
| 62 | d.flush() | ||
| 63 | if count > 0: | ||
| 64 | return d | ||
| 65 | else: | ||
| 66 | del d # removes temp file | ||
| 67 | return None | ||
| 68 | |||
| 69 | def scenario_heading(conf, want_period=False): | ||
| 70 | dist = 'unknown distribution' | ||
| 71 | if 'dist' in conf: | ||
| 72 | if conf['dist'] == 'uni': | ||
| 73 | dist = 'utilization uniformly ' | ||
| 74 | if 'light' in conf: | ||
| 75 | dist = dist + 'in [0.001, 0.1]' | ||
| 76 | elif 'medium' in conf: | ||
| 77 | dist = dist + 'in [0.1, 0.4]' | ||
| 78 | elif 'heavy' in conf: | ||
| 79 | dist = dist + 'in [0.5, 0.9]' | ||
| 80 | elif conf['dist'] == 'bimo': | ||
| 81 | dist = 'util. bimodially ' | ||
| 82 | if 'light' in conf: | ||
| 83 | dist = dist + 'in [0.001, 0.5] (8/9) and [0.5, 0.9] (1/9)' | ||
| 84 | elif 'medium' in conf: | ||
| 85 | dist = dist + 'in [0.001, 0.5] (6/9) and [0.5, 0.9] (3/9)' | ||
| 86 | elif 'heavy' in conf: | ||
| 87 | dist = dist + 'in [0.001, 0.5] (4/9) and [0.5, 0.9] (5/9)' | ||
| 88 | if want_period: | ||
| 89 | if '33' in conf: | ||
| 90 | dist += '; period uniformly in [3, 33]' | ||
| 91 | elif '250' in conf: | ||
| 92 | dist += '; period uniformly in [50, 250]' | ||
| 93 | else: | ||
| 94 | dist += '; period uniformly in [10, 100]' | ||
| 95 | |||
| 96 | return dist | ||
| 97 | |||
| 98 | def overhead_heading(conf, sharedL3=False): | 42 | def overhead_heading(conf, sharedL3=False): |
| 99 | ovd_type = 'unknowkn overhead' | 43 | ovd_type = 'unknowkn overhead' |
| 100 | if 'ovd' in conf: | 44 | if 'ovd' in conf: |
