]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
scritps/plot-timing: Allow to give a name to chart
authorLucas De Marchi <lucas.demarchi@intel.com>
Fri, 16 Aug 2013 03:00:37 +0000 (00:00 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 25 Sep 2013 05:03:17 +0000 (02:03 -0300)
scripts/plot-timing

index 1b67e6aee1f4225420f97ceb7c5e2940cc131e3e..297cf6e9a68c1fd0bbb270cca2e50825cc305d66 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/python
 
+import argparse
 import os.path
 import sys
 import numpy as np
@@ -20,11 +21,15 @@ def parse_table(f):
 
     return x, y
 
+parser = argparse.ArgumentParser()
+parser.add_argument('--name', type=str, default='')
+parser.add_argument('file', nargs='*')
+args = parser.parse_args()
 
 fig = plt.figure()
 ax = fig.add_subplot(111, axisbg='#f6f6f6')
 
-for fn in sys.argv[1:]:
+for fn in args.file:
     with open(fn) as f:
         x, y = parse_table(f)
         ax.plot(x, y, label=os.path.splitext(os.path.basename(fn))[0])
@@ -35,7 +40,8 @@ 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.suptitle('Hash function timings: %s' % args.name, weight='bold',
+             size='large')
 fig.tight_layout()
 plt.subplots_adjust(top=0.9)
 plt.show()