aboutsummaryrefslogtreecommitdiffstats
path: root/plot_pm.py
diff options
context:
space:
mode:
Diffstat (limited to 'plot_pm.py')
-rwxr-xr-xplot_pm.py62
1 files changed, 3 insertions, 59 deletions
diff --git a/plot_pm.py b/plot_pm.py
index 9190d8e..22f6d6e 100755
--- a/plot_pm.py
+++ b/plot_pm.py
@@ -4,6 +4,7 @@ from os.path import splitext, basename
4from optparse import make_option as o 4from optparse import make_option as o
5from tempfile import NamedTemporaryFile as Tmp 5from tempfile import NamedTemporaryFile as Tmp
6 6
7from plot import decode, scenario_heading, get_data_tmpfile
7from gnuplot import gnuplot, FORMATS 8from gnuplot import gnuplot, FORMATS
8 9
9options = [ 10options = [
@@ -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
41def 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
51def 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
69def 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
98def overhead_heading(conf, sharedL3=False): 42def 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: