Commit fcfc7f70 by Sebastian Renner

Added support for splitting data into multiple plots

parent 32c851e3
...@@ -68,12 +68,26 @@ def read_log(d): ...@@ -68,12 +68,26 @@ def read_log(d):
return (algorithm, dicts) return (algorithm, dicts)
def gen_graph_chunks(bp_data, bp_labels, size):
l = len(bp_data)
for i in range(0, (l//size) * size, size):
chunk = bp_data[i:i+size]
labels = bp_labels[i:i+size]
plt.boxplot(chunk, labels=labels)
plt.xticks(rotation=90)
plt.show()
# Let's also plot the leftover
rest = l % size
if rest != 0:
plt.boxplot(bp_data[(rest-2*rest):])
plt.show()
def main(): def main():
print('THE LWC BENCHMARK SPLITTER') print('THE LWC BENCHMARK SPLITTER')
print('powered by Deutsche Bahn') print('powered by Deutsche Bahn')
build_dir = 'build/new/' build_dir = 'build/new/'
box_plot_data = [] bp_data = []
box_plot_labels = [] bp_labels = []
for d in os.listdir(build_dir): for d in os.listdir(build_dir):
#dicts[0] --> algo #dicts[0] --> algo
#dicts[1][0] --> enc #dicts[1][0] --> enc
...@@ -82,8 +96,8 @@ def main(): ...@@ -82,8 +96,8 @@ def main():
enc_values = dicts[1][0].values() enc_values = dicts[1][0].values()
dec_values = dicts[1][1].values() dec_values = dicts[1][1].values()
box_plot_data.append(list(enc_values)) bp_data.append(list(enc_values))
box_plot_labels.append(dicts[0]) bp_labels.append(dicts[0])
print("Average enc time[s] = %f" % (statistics.mean(enc_values))) print("Average enc time[s] = %f" % (statistics.mean(enc_values)))
print("Median enc time[s] = %f" % (statistics.median(enc_values))) print("Median enc time[s] = %f" % (statistics.median(enc_values)))
...@@ -100,9 +114,10 @@ def main(): ...@@ -100,9 +114,10 @@ def main():
if dec_len != 1089 or enc_len != 1089: if dec_len != 1089 or enc_len != 1089:
raise Exception("#Number of encrypted test vectors (%d)/ decrypted test vectors (%d) does not match guidelines (1089)" % (enc_len, dec_len)) raise Exception("#Number of encrypted test vectors (%d)/ decrypted test vectors (%d) does not match guidelines (1089)" % (enc_len, dec_len))
plt.boxplot(box_plot_data, labels=box_plot_labels) gen_graph_chunks(bp_data, bp_labels, 5)
plt.xticks(rotation=90) #plt.boxplot(bp_data, labels=bp_labels)
plt.show() #plt.xticks(rotation=90)
#plt.show()
if __name__ == "__main__": if __name__ == "__main__":
main() main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment