in scripts/throughput.py [0:0]
def plot(parsed_log_file, x_label='Number of shards', z_label='tx in-flight', legend_position='lower right', style='plot'):
with open(parsed_log_file, 'r') as f:
orders = eval(f.read())
for (orders_type, order) in orders.items():
fig = plt.figure()
width = 2
i = -3
for (z_value, items) in sorted(order.items(), reverse=True):
x_values = []
y_values = []
y_err = []
for item in items:
x, y = list(zip(*item))
x = int(x[0])
y = np.array(y).astype(np.int)
x_values.append(x)
y_values.append(np.mean(y))
y_err.append(np.std(y))
if style == 'bar':
plt.bar(np.array(x_values) + i, y_values, width, yerr=y_err,
label='%s %s' % (z_value, z_label))
i = i + width
plt.xticks(x_values, x_values)
else:
#plt.plot(x_values, y_values)
plt.ylim(0, 180000)
plt.errorbar(x_values, y_values, yerr=y_err, uplims=True, lolims=True,
label='%s %s' % (z_value, z_label), marker='.', alpha=1, dashes=None)
plt.legend(loc=legend_position)
plt.xlabel(x_label)
plt.ylabel('Observed throughput (tx / sec)')
plt.savefig('%s.pdf' % orders_type)
print('created figure "%s.pdf".' % orders_type)