summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2013-08-15 01:40:47 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2013-09-20 14:35:52 -0500
commit15fe2128f8bded2f8b8db4d1274597fee1ef9f74 (patch)
treed3f7ab23cee1da6cd7f6a1736fcbcf42b1107e7c
parent7862f1158b17e2084ce2450a3f8d88a3c8d75d31 (diff)
downloadkmod-15fe2128f8bded2f8b8db4d1274597fee1ef9f74.tar.gz
scripts: Plot hashfunc timings
-rwxr-xr-xscripts/plot-timing41
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/plot-timing b/scripts/plot-timing
new file mode 100755
index 0000000..1b67e6a
--- /dev/null
+++ b/scripts/plot-timing
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+import os.path
+import sys
+import numpy as np
+import matplotlib.pyplot as plt
+from mpl_toolkits.axes_grid.anchored_artists import AnchoredText
+
+
+def parse_table(f):
+ x = []
+ y = []
+ for line in f:
+ if len(line) < 2 or not line[0].isdigit():
+ continue
+
+ val = line.split()[0:2]
+ x += [int(val[0])]
+ y += [float(val[1])]
+
+ return x, y
+
+
+fig = plt.figure()
+ax = fig.add_subplot(111, axisbg='#f6f6f6')
+
+for fn in sys.argv[1:]:
+ with open(fn) as f:
+ x, y = parse_table(f)
+ ax.plot(x, y, label=os.path.splitext(os.path.basename(fn))[0])
+
+ax.set_xlabel('length')
+ax.set_ylabel('clock cycles')
+ax.axis('tight')
+leg = ax.legend(loc=2, fancybox=True, shadow=True)
+leg.get_frame().set_alpha(0.5)
+
+fig.suptitle('Hash function timings', weight='bold', size='large')
+fig.tight_layout()
+plt.subplots_adjust(top=0.9)
+plt.show()