summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xreport-fossil.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/report-fossil.py b/report-fossil.py
index 058f2ab..ab4dfca 100755
--- a/report-fossil.py
+++ b/report-fossil.py
@@ -44,6 +44,7 @@ if typing.TYPE_CHECKING:
class ReportProtocol(typing_extensions.Protocol):
+ statistics: typing.List[Statistic]
num_shaders: int
num_affected_shaders: int
else:
@@ -340,6 +341,7 @@ class Diff(DiffProtocol):
report_attrs: typing.Dict[str, object] = {}
+report_attrs['statistics'] = attr.ib()
for stat in statistics:
if stat.is_hash:
continue
@@ -367,7 +369,7 @@ class Report(ReportProtocol):
affected = False
stats: typing.List[typing.Tuple[Diff, int, int]] = []
- for stat in statistics:
+ for stat in self.statistics:
m = stat.internal_name
d0_m = getattr(d0, m)
@@ -417,13 +419,14 @@ class Report(ReportProtocol):
diffs = {}
for diff in self.get_diffs():
diffs[diff.stat.internal_name] = diff.get_only_affected()
- return Report(num_shaders = self.num_affected_shaders,
+ return Report(statistics = self.statistics,
+ num_shaders = self.num_affected_shaders,
num_affected_shaders = self.num_affected_shaders,
**diffs)
def read_csv(csv_file: pathlib.Path, inc_statistics: typing.Optional[typing.Set[Statistic]],
- all_apps: typing.Set[str]) -> typing.Dict[typing.Tuple[str, str], Result]:
+ all_apps: typing.Set[str], stats: typing.Set[Statistic]) -> typing.Dict[typing.Tuple[str, str], Result]:
data: typing.Dict[typing.Tuple[str, str], Result] = {}
with csv_file.open('rt') as f:
@@ -432,6 +435,7 @@ def read_csv(csv_file: pathlib.Path, inc_statistics: typing.Optional[typing.Set[
for row in reader:
if 'Database' in row:
factory = ResultFactory.from_column_names(row, inc_statistics)
+ stats.update(set(s for s in factory.column_to_stat if s))
db_index = row.index('Database')
hash_index = row.index('Pipeline hash')
exec_index = row.index('Executable name')
@@ -708,8 +712,9 @@ def main():
inc_statistics = set(stat for stat in statistics if stat.display_name in args.stats)
all_apps: typing.Set[str] = set()
- before = read_csv(args.csv[0], inc_statistics, all_apps)
- after = read_csv(args.csv[1], inc_statistics, all_apps) if len(args.csv) >= 2 else None
+ before_stats, after_stats = set(), set()
+ before = read_csv(args.csv[0], inc_statistics, all_apps, before_stats)
+ after = read_csv(args.csv[1], inc_statistics, all_apps, after_stats) if len(args.csv) >= 2 else None
app_mapping = shorten_app_names(all_apps)
app_filter = args.apps or app_mapping.values()
@@ -733,8 +738,9 @@ def main():
report_ignored(only_in_before, 'Shaders only in \'before\' results')
if after is not None:
- apps = {app: Report() for app in app_filter}
- total = Report()
+ stats_in_csv = list(before_stats | after_stats)
+ apps = {app: Report(stats_in_csv) for app in app_filter}
+ total = Report(stats_in_csv)
for name in names:
d0 = before.get(name)
d1 = after.get(name)