summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdiel Janulgue <abdiel.janulgue@linux.intel.com>2014-10-29 19:02:35 -0700
committerKenneth Graunke <kenneth@whitecape.org>2014-10-29 19:05:02 -0700
commit2001e6b5a1a78f2164df0914df00ec15e1fcb380 (patch)
tree21a3cf8ee2c78e280c79caf511a17904b570f12b
parent6203cea7eb14b20842a9214ac83556bddddc75ab (diff)
shader-db: Count and summarize loops exported my Mesaloops
-rwxr-xr-xreport.py36
-rwxr-xr-xrun.py8
2 files changed, 29 insertions, 15 deletions
diff --git a/report.py b/report.py
index 06844a2..d420bd6 100755
--- a/report.py
+++ b/report.py
@@ -10,7 +10,7 @@ def get_results(filename):
results = {}
- re_match = re.compile(r"(\S*)\s*(\S*)\s*:\s*(\S*)")
+ re_match = re.compile(r"(\S*)\s*(\S*)\s*:\s*(\S*)\s*(\S*)")
for line in lines:
match = re.search(re_match, line)
if match is None:
@@ -18,8 +18,9 @@ def get_results(filename):
groups = match.groups()
count = int(groups[2])
+ loop = int(groups[3])
if count != 0:
- results[(groups[0], groups[1])] = count
+ results[(groups[0], groups[1])] = count, loop
return results
@@ -51,6 +52,8 @@ def main():
total_before = 0
total_after = 0
+ total_loop_before = 0;
+ total_loop_after = 0;
affected_before = 0
affected_after = 0
@@ -62,25 +65,30 @@ def main():
for p in args.before:
(name, type) = p
namestr = name + " " + type
- before_count = args.before[p]
+ before_count = args.before[p][0]
+ before_loop_count = args.before[p][1]
if args.after.get(p) is not None:
- after_count = args.after[p]
+ after_count = args.after[p][0]
+ after_loop_count = args.after[p][1]
total_before += before_count
+ total_loop_before += before_loop_count
total_after += after_count
+ total_loop_after += after_loop_count
if before_count != after_count:
affected_before += before_count
affected_after += after_count
result = get_result_string(namestr, before_count, after_count)
- if after_count > before_count:
+ if after_count > before_count and after_loop_count >= before_loop_count:
hurt.append(p)
elif after_count == before_count:
unchanged.append(result)
else:
- helped.append(result)
+ res = (result, before_loop_count, after_loop_count)
+ helped.append(res)
else:
lost.append(namestr)
@@ -90,7 +98,10 @@ def main():
helped.sort()
for r in helped:
- print("helped: " + r)
+ if (r[1] > r[2]):
+ print("helped: " + r[0] + " loop: " + change(r[1], r[2]))
+ else:
+ print("helped: " + r[0])
if len(helped) > 0:
print("")
@@ -101,11 +112,12 @@ def main():
print("")
hurt.sort(
- key=lambda k: float(args.after[k] - args.before[k]) / args.before[k])
+ key=lambda k: float(args.after[k][0] - args.before[k][0]) / args.before[k][0])
for p in hurt:
namestr = p[0] + " " + p[1]
print("HURT: " + get_result_string(
- namestr, args.before[p], args.after[p]))
+ namestr, args.before[p][0], args.after[p][0]) +
+ " loop: " + change(args.before[p][1], args.after[p][1]))
if len(hurt) > 0:
print("")
@@ -123,10 +135,12 @@ def main():
print("total instructions in shared programs: {0}\n"
"instructions in affected programs: {1}\n"
- "GAINED: {2}\n"
- "LOST: {3}".format(
+ "total loops in shared programs: {2}\n"
+ "GAINED: {3}\n"
+ "LOST: {4}".format(
change(total_before, total_after),
change(affected_before, affected_after),
+ change(total_loop_before, total_loop_after),
len(gained),
len(lost)))
diff --git a/run.py b/run.py
index 2c7ba9e..7b846ad 100755
--- a/run.py
+++ b/run.py
@@ -57,19 +57,19 @@ def run_test(filename):
raise Exception('Only shader 0 found. {}'.format(filename))
re_search = re.compile(
- r'(?P<stage>[A-Za-z0-9]+) shader\: (?P<count>\d+) instructions.')
+ r'(?P<stage>[A-Za-z0-9]+) shader\: (?P<count>\d+) instructions. (?P<loop>\d+) loops.')
for line in lines:
match = re_search.match(line)
if match is not None:
- counts[match.group('stage')] = int(match.group('count'))
+ counts[match.group('stage')] = int(match.group('count')), int(match.group('loop'))
assert counts, 'File: {} does not have any shaders'.format(filename)
timestr = " {:.3f} secs".format(timeafter - timebefore)
out = ''
for k, v in counts.items():
- if v != 0:
- out += "{0:40} {1} : {2:6}{3}\n".format(filename, k, v, timestr)
+ if v[0] != 0:
+ out += "{0:40} {1:6} : {2:6}{3:6} loops {4}\n".format(filename, k, v[0], v[1],timestr)
timestr = ""
return out