diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2013-08-16 00:00:37 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2013-09-25 02:03:17 -0300 |
commit | e8a479d4aa3414b1bc68d5f94f390874a11fdc46 (patch) | |
tree | df780b830bfde31025b4a81416fe031dc73ea339 | |
parent | b90ef3a1b889dcfef8c1c7ca40d85634b0c8919e (diff) | |
download | kmod-e8a479d4aa3414b1bc68d5f94f390874a11fdc46.tar.gz |
scritps/plot-timing: Allow to give a name to chart
-rwxr-xr-x | scripts/plot-timing | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/plot-timing b/scripts/plot-timing index 1b67e6a..297cf6e 100755 --- a/scripts/plot-timing +++ b/scripts/plot-timing @@ -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() |