Signed-off-by: Rhys Perry <pendingchao...@gmail.com> --- nv-report.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/nv-report.py b/nv-report.py index 487074fdd6..079b2e08a3 100644 --- a/nv-report.py +++ b/nv-report.py @@ -46,11 +46,13 @@ class Stats(object): assert name not in self.stats, name self.stats[name] = stat - def create_totals(self): + def create_totals(self, exclude=set()): for attr in STATS: setattr(self, attr, 0) for key, stat in self.stats.iteritems(): + if key in exclude: + continue for attr in STATS: setattr(self, attr, getattr(self, attr) + getattr(stat, attr)) @@ -83,14 +85,20 @@ def diff(a, b): percentage = float('inf') return "%d -> %d (%.2f%%)" % (a, b, percentage) -def print_summary(before, after): - before.create_totals() - after.create_totals() +def print_summary(before, after, keys, only_affected): + exclude = set() + for key in keys if only_affected else []: + if before.stats[key] == after.stats[key]: + exclude.add(key) + before.create_totals(exclude) + after.create_totals(exclude) + + programs = "affected" if only_affected else "shared" - print "total instructions in shared programs :", diff(before.inst, after.inst) - print "total gprs used in shared programs :", diff(before.gpr, after.gpr) - print "total shared used in shared programs :", diff(before.shared, after.shared) - print "total local used in shared programs :", diff(before.local, after.local) + print "total instructions in %s programs :" % programs, diff(before.inst, after.inst) + print "total gprs used in %s programs :" % programs, diff(before.gpr, after.gpr) + print "total shared used in %s programs :" % programs, diff(before.shared, after.shared) + print "total local used in %s programs :" % programs, diff(before.local, after.local) def print_helped_hurt(keys, before, after): helped = Stat() @@ -132,7 +140,9 @@ def main(argv): continue keys.add(key) - print_summary(before, after) + print_summary(before, after, keys, False) + print + print_summary(before, after, keys, True) print print_helped_hurt(keys, before, after) -- 2.14.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev