From ba08d9ff8ccfd274a88b9b8a5a4a98c267236f28 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Mon, 28 Feb 2022 21:59:48 -0800 Subject: report.py: Add support for nouveau-formatted shader-db output. imirkin wants the current format for shader-db for nouveau, but I really want the current report.py script to work because it helps me dig into which shaders are the problem. --- report.py | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/report.py b/report.py index a48c60a..595ddb2 100755 --- a/report.py +++ b/report.py @@ -19,15 +19,20 @@ def get_results(filename, args): time_match = re.compile(r"Thread \S+ took (\S+) seconds") re_match = re.compile(r"(\S+) - (.*) shader: (.*)") + nv_match = re.compile(r"(\S+) - type: ([^,]*), (.*)") for line in lines: match = re.search(time_match, line) if match is not None: results["time"] = results["time"] + float(match.group(1)) continue + nv_format = False match = re.search(re_match, line) if match is None: - continue + match = re.search(nv_match, line) + if match is None: + continue + nv_format = True groups = match.groups() @@ -35,24 +40,35 @@ def get_results(filename, args): stage = groups[1] stats = groups[2] + if nv_format and stage.isdecimal(): + stage = ["VS", "FS", "GS", "TCS", "TES", "CS"][int(stage)] + if args.stage and args.stage != stage: continue result_group = {} for stat in stats.split(', '): - stat_split_spaces = stat.split(' ') + name = "" + val = 0 + if nv_format: + stat_split = stat.split(": ") + name = stat_split[0] + val = stat_split[1] + else: + stat_split_spaces = stat.split(' ') - if stat_split_spaces[0] == "scheduled": - name = stat_split_spaces[0] - val = stat_split_spaces[3] + if stat_split_spaces[0] == "scheduled": + name = stat_split_spaces[0] + val = stat_split_spaces[3] + + # Skipping "Promoted 0 constants" and "compacted..." on i965. + # We should probably change "compacted" to just a shader size + # in bytes. + elif len(stat_split_spaces) != 2: + continue + else: + name = stat_split_spaces[1] - # Skipping "Promoted 0 constants" and "compacted..." on i965. - # We should probably change "compacted" to just a shader size - # in bytes. - elif len(stat_split_spaces) != 2: - continue - else: - name = stat_split_spaces[1] val = stat_split_spaces[0] if name == "inst": -- cgit v1.2.3