forked from ZebinRen/hotcloudperf24-kyber-artifact-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_fs.py
385 lines (320 loc) · 10.6 KB
/
plot_fs.py
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
import os.path
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# Switch to type 1 fonts
matplotlib.rcParams['text.usetex'] = True
plt.rc('font', **{'family': 'serif', 'serif': ['Times']})
m_color_index = 0
matplotlib_color = [
'#0077BB', '#009988', '#EE7733', '#CC3311', '#EE3377', '#BBBBBB', '#000000'
]
dot_style = [
'+',
'X',
'o',
'v',
's',
'P',
]
def get_next_color():
global m_color_index
c = matplotlib_color[m_color_index]
m_color_index += 1
return c
def reset_color():
global m_color_index
m_color_index = 0
# Parameters
bar_width = 0.15
datalabel_size = 24
datalabel_va = 'bottom'
axis_tick_font_size = 36
axis_label_font_size = 44
legend_font_size = 30
group_list = ['50us-20us', '50us-100ms', '100ms-20us', '100ms-100ms']
r_lat_r1_w256 = {
'50us-20us': [194.8, 178.4, 201.7],
'50us-100ms': [160.4, 160.8, 160.8],
'100ms-20us': [249.9, 184.9, 248.0],
'100ms-100ms': [228.8, 182.9, 249.9],
}
w_thr_r1_w256 = {
'50us-20us': [118.2, 105.3, 126.4],
'50us-100ms': [72.9, 75.5, 73.3],
'100ms-20us': [143.8, 116.0, 147.0],
'100ms-100ms': [140.1, 113.9, 146.0],
}
r_thr_r256_w256 = {
'50us-20us': [227.7, 234.4, 228.1],
'50us-100ms': [231.0, 239.3, 234.6],
'100ms-20us': [93.2, 229.7, 132.6],
'100ms-100ms': [230.5, 239.1, 230.9],
}
w_thr_r256_w256 = {
'50us-20us': [115.5, 104.3, 122.9],
'50us-100ms': [65.6, 67.9, 65.6],
'100ms-20us': [127.6, 107.8, 132.6],
'100ms-100ms': [119.0, 108.7, 128.2],
}
x_ticks = [r'\textbf{ext4}', r'\textbf{f2fs}', r'\textbf{xfs}']
reset_color()
# rw-w256 read latency
if True:
y_values = r_lat_r1_w256
std_dev = None
legend_label = {i: i for i in group_list}
title = None
xlabel = None
ylabel = 'P99 latency~($\mu$s)'
fig_save_path = 'samsung-r-lat-r1-w256.pdf'
# plot
fig, ax = plt.subplots(figsize=(12, 8))
plt.grid(axis='y') # x, y, both
# x, y axis limit
# ax.set_xlim(0, 2)
# ax.set_ylim(0, 1.25)
# set ticks
plt.xticks(list(np.arange(len(x_ticks))), x_ticks)
if title:
plt.title(title)
if xlabel:
plt.xlabel(xlabel, fontsize=axis_label_font_size)
if ylabel:
plt.ylabel(ylabel, fontsize=axis_label_font_size)
ax.tick_params(axis='both', which='major', labelsize=axis_tick_font_size)
# compute bar offset, with respect to center
bar_offset = []
mid_point = (len(group_list) * bar_width) / 2
for i in range(len(group_list)):
bar_offset.append(bar_width * i + 0.5 * bar_width - mid_point)
x_axis = np.arange(len(x_ticks))
# draw figure by column
for (index, group_name) in zip(range(len(group_list)), group_list):
y = y_values[group_name]
yerr = None
if std_dev:
yerr = std_dev[group_name]
bar_pos = x_axis + bar_offset[index]
plt.bar(bar_pos,
y,
width=bar_width,
label=legend_label[group_name],
yerr=yerr,
color=get_next_color())
# print data label
for (x, y) in zip(bar_pos, y):
text = '{:.0f}'.format(y)
plt.text(
x,
y,
text,
size=datalabel_size,
ha='center',
va=
datalabel_va, # 'bottom', 'baseline', 'center', 'center_baseline', 'top'
)
# Legend: Change the ncol and loc to fine-tune the location of legend
# if legend_label != None:
# plt.legend(fontsize=legend_font_size, loc='lower left', ncol=2)
# # plt.legend(fontsize=legend_font_size,
# # ncol=2,
# # loc='upper left',
# # bbox_to_anchor=(0, 1.2),
# # columnspacing=0.3)
plt.savefig(fig_save_path, bbox_inches='tight')
reset_color()
# rw-w256 write throughput
if True:
y_values = w_thr_r1_w256
std_dev = None
legend_label = {i: i for i in group_list}
title = None
xlabel = None
ylabel = 'Throughput~(K IOPS)'
fig_save_path = 'samsung-w-thr-r1-w256.pdf'
# plot
fig, ax = plt.subplots(figsize=(12, 8))
plt.grid(axis='y') # x, y, both
# x, y axis limit
# ax.set_xlim(0, 2)
ax.set_ylim(0, 265)
# set ticks
plt.xticks(list(np.arange(len(x_ticks))), x_ticks)
if title:
plt.title(title)
if xlabel:
plt.xlabel(xlabel, fontsize=axis_label_font_size)
if ylabel:
plt.ylabel(ylabel, fontsize=axis_label_font_size)
ax.tick_params(axis='both', which='major', labelsize=axis_tick_font_size)
# compute bar offset, with respect to center
bar_offset = []
mid_point = (len(group_list) * bar_width) / 2
for i in range(len(group_list)):
bar_offset.append(bar_width * i + 0.5 * bar_width - mid_point)
x_axis = np.arange(len(x_ticks))
# draw figure by column
for (index, group_name) in zip(range(len(group_list)), group_list):
y = y_values[group_name]
yerr = None
if std_dev:
yerr = std_dev[group_name]
bar_pos = x_axis + bar_offset[index]
plt.bar(bar_pos,
y,
width=bar_width,
label=legend_label[group_name],
yerr=yerr,
color=get_next_color())
# print data label
for (x, y) in zip(bar_pos, y):
text = '{:.0f}'.format(y)
plt.text(
x,
y,
text,
size=datalabel_size,
ha='center',
va=
datalabel_va, # 'bottom', 'baseline', 'center', 'center_baseline', 'top'
)
# Legend: Change the ncol and loc to fine-tune the location of legend
# if legend_label != None:
# plt.legend(fontsize=legend_font_size, loc='lower left', ncol=2)
# # plt.legend(fontsize=legend_font_size,
# # ncol=2,
# # loc='upper left',
# # bbox_to_anchor=(0, 1.2),
# # columnspacing=0.3)
plt.savefig(fig_save_path, bbox_inches='tight')
reset_color()
# r256-w256 read thr
if True:
y_values = r_thr_r256_w256
std_dev = None
legend_label = {i: i for i in group_list}
title = None
xlabel = None
ylabel = 'Throughput~(K IOPS)'
fig_save_path = 'samsung-r-thr-r256-w256.pdf'
# plot
fig, ax = plt.subplots(figsize=(12, 8))
plt.grid(axis='y') # x, y, both
# x, y axis limit
# ax.set_xlim(0, 2)
ax.set_ylim(0, 265)
# set ticks
plt.xticks(list(np.arange(len(x_ticks))), x_ticks)
if title:
plt.title(title)
if xlabel:
plt.xlabel(xlabel, fontsize=axis_label_font_size)
if ylabel:
plt.ylabel(ylabel, fontsize=axis_label_font_size)
ax.tick_params(axis='both', which='major', labelsize=axis_tick_font_size)
# compute bar offset, with respect to center
bar_offset = []
mid_point = (len(group_list) * bar_width) / 2
for i in range(len(group_list)):
bar_offset.append(bar_width * i + 0.5 * bar_width - mid_point)
x_axis = np.arange(len(x_ticks))
# draw figure by column
for (index, group_name) in zip(range(len(group_list)), group_list):
y = y_values[group_name]
yerr = None
if std_dev:
yerr = std_dev[group_name]
bar_pos = x_axis + bar_offset[index]
plt.bar(bar_pos,
y,
width=bar_width,
label=legend_label[group_name],
yerr=yerr,
color=get_next_color())
# print data label
for (x, y) in zip(bar_pos, y):
text = '{:.0f}'.format(y)
plt.text(
x,
y,
text,
size=datalabel_size,
ha='center',
va=
datalabel_va, # 'bottom', 'baseline', 'center', 'center_baseline', 'top'
)
# Legend: Change the ncol and loc to fine-tune the location of legend
# if legend_label != None:
# plt.legend(fontsize=legend_font_size, loc='lower left', ncol=2)
# # plt.legend(fontsize=legend_font_size,
# # ncol=2,
# # loc='upper left',
# # bbox_to_anchor=(0, 1.2),
# # columnspacing=0.3)
plt.savefig(fig_save_path, bbox_inches='tight')
reset_color()
# r256-w256 write thr
if True:
y_values = w_thr_r256_w256
std_dev = None
legend_label = {i: i for i in group_list}
title = None
xlabel = None
ylabel = 'Throughput~(K IOPS)'
fig_save_path = 'samsung-w-thr-r256-w256.pdf'
# plot
fig, ax = plt.subplots(figsize=(12, 8))
plt.grid(axis='y') # x, y, both
# x, y axis limit
# ax.set_xlim(0, 2)
ax.set_ylim(0, 265)
# set ticks
plt.xticks(list(np.arange(len(x_ticks))), x_ticks)
if title:
plt.title(title)
if xlabel:
plt.xlabel(xlabel, fontsize=axis_label_font_size)
if ylabel:
plt.ylabel(ylabel, fontsize=axis_label_font_size)
ax.tick_params(axis='both', which='major', labelsize=axis_tick_font_size)
# compute bar offset, with respect to center
bar_offset = []
mid_point = (len(group_list) * bar_width) / 2
for i in range(len(group_list)):
bar_offset.append(bar_width * i + 0.5 * bar_width - mid_point)
x_axis = np.arange(len(x_ticks))
# draw figure by column
for (index, group_name) in zip(range(len(group_list)), group_list):
y = y_values[group_name]
yerr = None
if std_dev:
yerr = std_dev[group_name]
bar_pos = x_axis + bar_offset[index]
plt.bar(bar_pos,
y,
width=bar_width,
label=legend_label[group_name],
yerr=yerr,
color=get_next_color())
# print data label
for (x, y) in zip(bar_pos, y):
text = '{:.0f}'.format(y)
plt.text(
x,
y,
text,
size=datalabel_size,
ha='center',
va=
datalabel_va, # 'bottom', 'baseline', 'center', 'center_baseline', 'top'
)
# Legend: Change the ncol and loc to fine-tune the location of legend
if legend_label != None:
plt.legend(fontsize=legend_font_size, loc='upper left', ncol=2)
# plt.legend(fontsize=legend_font_size,
# ncol=2,
# loc='upper left',
# bbox_to_anchor=(0, 1.2),
# columnspacing=0.3)
plt.savefig(fig_save_path, bbox_inches='tight')