From 84cb8f63d0d96ede1a6a10940112ae5a087029fc Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Thu, 9 Feb 2012 23:23:36 -0500
Subject: volk: better args for benchmarking volk tests; can specify a list of
 test numbers.

---
 .../python/volk_benchmark/volk_math.py             |  9 ++++----
 .../python/volk_benchmark/volk_types.py            | 24 +++++++++++-----------
 2 files changed, 17 insertions(+), 16 deletions(-)

(limited to 'gnuradio-examples/python')

diff --git a/gnuradio-examples/python/volk_benchmark/volk_math.py b/gnuradio-examples/python/volk_benchmark/volk_math.py
index 42f3ffa4b5..8b00813872 100755
--- a/gnuradio-examples/python/volk_benchmark/volk_math.py
+++ b/gnuradio-examples/python/volk_benchmark/volk_math.py
@@ -100,8 +100,8 @@ def main():
           implementation. The results are stored to an SQLite database \
           that can then be read by volk_plot.py to plot the differences.'
     parser = argparse.ArgumentParser(description=desc)
-    parser.add_argument('label', type=str,
-                        default=None,
+    parser.add_argument('-L', '--label', type=str,
+                        required=True, default=None,
                         help='Label of database table [default: %(default)s]')
     parser.add_argument('-D', '--database', type=str,
                         default="volk_results.db",
@@ -112,9 +112,10 @@ def main():
     parser.add_argument('-I', '--iterations', type=int,
                         default=20,
                         help='Number of iterations [default: %(default)s]')
-    parser.add_argument('--test', type=int,
+    parser.add_argument('--tests', type=int, nargs='*',
                         choices=xrange(len(avail_tests)),
-                        help='Test to run')
+                        help='A list of tests to run; can be a single test or a \
+                              space-separated list.')
     parser.add_argument('--list', action='store_true',
                         help='List the available tests')
     parser.add_argument('--all', action='store_true',
diff --git a/gnuradio-examples/python/volk_benchmark/volk_types.py b/gnuradio-examples/python/volk_benchmark/volk_types.py
index 8041ccac1b..893318dddc 100755
--- a/gnuradio-examples/python/volk_benchmark/volk_types.py
+++ b/gnuradio-examples/python/volk_benchmark/volk_types.py
@@ -138,8 +138,8 @@ def main():
           implementation. The results are stored to an SQLite database \
           that can then be read by volk_plot.py to plot the differences.'
     parser = argparse.ArgumentParser(description=desc)
-    parser.add_argument('label', type=str,
-                        default=None,
+    parser.add_argument('-L', '--label', type=str,
+                        required=True, default=None,
                         help='Label of database table [default: %(default)s]')
     parser.add_argument('-D', '--database', type=str,
                         default="volk_results.db",
@@ -150,9 +150,10 @@ def main():
     parser.add_argument('-I', '--iterations', type=int,
                         default=20,
                         help='Number of iterations [default: %(default)s]')
-    parser.add_argument('--test', type=int,
+    parser.add_argument('--tests', type=int, nargs='*',
                         choices=xrange(len(avail_tests)),
-                        help='Test to run')
+                        help='A list of tests to run; can be a single test or a \
+                              space-separated list.')
     parser.add_argument('--list', action='store_true',
                         help='List the available tests')
     parser.add_argument('--all', action='store_true',
@@ -171,16 +172,15 @@ def main():
     conn = create_connection(args.database)
     new_table(conn, label)
 
-    if not args.all:
-        func = avail_tests[args.test]
-        res = run_tests(func, N, iters)
+    if args.all:
+        tests = xrange(len(avail_tests))
+    else:
+        tests = args.tests
+
+    for test in tests:
+        res = run_tests(avail_tests[test], N, iters)
         if res is not None:
             replace_results(conn, label, N, iters, res)
-    else:
-        for f in avail_tests:
-            res = run_tests(f, N, iters)
-            if res is not None:
-                replace_results(conn, label, N, iters, res)
             
 if __name__ == "__main__":
     try:
-- 
cgit v1.2.3