This repository was archived by the owner on Aug 29, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathplot.py
More file actions
executable file
·141 lines (108 loc) · 3.06 KB
/
Copy pathplot.py
File metadata and controls
executable file
·141 lines (108 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.annotate(str(round(float(height), 1)),
xy=(rect.get_x() + rect.get_width() / 2, height),
xytext=(0, 1),
textcoords="offset points",
ha='center', va='bottom')
titles = {
"results/zplug-inst.txt": "zplug",
"results/zgen-inst.txt": "zgen",
"results/zi-light-inst.txt": "ZI light",
"results/zi-load-inst.txt": "ZI load",
"results/zi-turbo-inst.txt": "ZI (Turbo) load",
"results/zplug.txt": "zplug",
"results/zgen.txt": "zgen",
"results/zi-light.txt": "ZI light",
"results/zi-load.txt": "ZI load",
"results/zi-turbo.txt": "ZI (Turbo) load",
}
files_inst = [
"results/zplug-inst.txt",
"results/zgen-inst.txt",
"results/zi-light-inst.txt",
"results/zi-load-inst.txt",
"results/zi-turbo-inst.txt",
]
files_startup = [
"results/zplug.txt",
"results/zgen.txt",
"results/zi-light.txt",
"results/zi-load.txt",
"results/zi-turbo.txt",
]
#
# Installation-times plot
#
data = {}
for fname in files_inst:
odd = 0
file = open(fname, "r")
lines = file.readlines()
file.close()
idata = []
for line in lines:
if fname == "results/zplug-inst.txt" or fname == "results/zi-turbo-inst.txt":
odd = 1 - odd
if not odd:
fields = line.split()
idata.append(float(fields[-2]) / 1000.0)
else:
fields = line.split()
idata.append(float(fields[-2]) / 1000.0)
mean = np.mean(idata)
data[titles[fname]] = mean
group_data = list(data.values())
group_names = list(data.keys())
fig, ax = plt.subplots(figsize=(8.2, 5))
rects = ax.bar(group_names, group_data)
# Add a vertical line, here we set the style in the function call
#ax.axhline(mean, ls='--', color='r')
# Now we'll move our title up since it's getting a little cramped
ax.title.set(y=1.05)
autolabel(rects)
# fig.tight_layout()
plt.title("Installation time, in seconds")
fig.savefig('docs/plots/installation-times.png',
transparent=False, dpi=140, bbox_inches="tight")
plt.show()
#
# Startup-times plot
#
data = {}
for fname in files_startup:
odd = 0
file = open(fname, "r")
lines = file.readlines()
file.close()
idata = []
for line in lines:
if fname == "results/zi.txt":
odd = 1 - odd
if not odd:
fields = line.split()
idata.append(float(fields[-2]))
else:
fields = line.split()
idata.append(float(fields[-2]))
mean = np.mean(idata)
data[titles[fname]] = mean
group_data = list(data.values())
group_names = list(data.keys())
fig, ax = plt.subplots(figsize=(8.2, 5))
rects = ax.bar(group_names, group_data)
autolabel(rects)
# fig.tight_layout()
# Add a vertical line, here we set the style in the function call
#ax.axhline(mean, ls='--', color='r')
# Now we'll move our title up since it's getting a little cramped
ax.title.set(y=1.05)
plt.title("Startup time, in milliseconds")
fig.savefig('docs/plots/startup-times.png', transparent=False,
dpi=140, bbox_inches="tight")
plt.show()