[Mesa-dev] [PATCH shader-db 4/5] nv-report: make use of argparse

Rhys Perry pendingchaos02 at gmail.com
Fri Aug 3 19:53:42 UTC 2018


Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
---
 nv-report.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/nv-report.py b/nv-report.py
index 079b2e08a3..1c1491af0a 100644
--- a/nv-report.py
+++ b/nv-report.py
@@ -12,11 +12,15 @@ fields, except for the type, are optional.
 
 import re
 import sys
+import argparse
 
 
 STATS = ["local", "shared", "gpr", "inst", "bytes"]
 ATTRS = ["name", "type"] + STATS
 
+DESCRIPTION = """Shows changes between two shader-db runs for the nouveau
+drivers."""
+
 def getgroupvalue(m, groupname):
     if not m[groupname]:
         return 0
@@ -130,8 +134,13 @@ def print_helped_hurt(keys, before, after):
     print
 
 def main(argv):
-    before = read_stats(argv[1])
-    after = read_stats(argv[2])
+    parser = argparse.ArgumentParser(description=DESCRIPTION)
+    parser.add_argument('before', help="the baseline run")
+    parser.add_argument('after', help="the run to compare against the baseline")
+    args = parser.parse_args(argv[1:])
+
+    before = read_stats(args.before)
+    after = read_stats(args.after)
 
     keys = set()
     for key in set(before.stats.keys()) | set(after.stats.keys()):
-- 
2.14.4



More information about the mesa-dev mailing list