From: Ian Romanick <[email protected]> This is useful for preparing data to go in a Mesa commit message.
Signed-off-by: Ian Romanick <[email protected]> --- report.py | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/report.py b/report.py index e0068bc..72752c1 100755 --- a/report.py +++ b/report.py @@ -62,6 +62,8 @@ def main(): help="comma-separated list of measurements to report") parser.add_argument("--summary-only", "-s", action="store_true", default=False, help="do not show the per-shader helped / hurt data") + parser.add_argument("--changes-only", "-c", action="store_true", default=False, + help="only show measurements that have changes") parser.add_argument("before", type=get_results, help="the output of the original code") parser.add_argument("after", type=get_results, help="the output of the new code") args = parser.parse_args() @@ -116,14 +118,14 @@ def main(): if len(helped) > 0: print("") - hurt.sort( - key=lambda k: args.after[k][m] if args.before[k][m] == 0 else float(args.after[k][m] - args.before[k][m]) / args.before[k][m]) - for p in hurt: - namestr = p[0] + " " + p[1] - print(m + " HURT: " + get_result_string( - namestr, args.before[p][m], args.after[p][m])) - if len(hurt) > 0: - print("") + hurt.sort( + key=lambda k: args.after[k][m] if args.before[k][m] == 0 else float(args.after[k][m] - args.before[k][m]) / args.before[k][m]) + for p in hurt: + namestr = p[0] + " " + p[1] + print(m + " HURT: " + get_result_string( + namestr, args.before[p][m], args.after[p][m])) + if len(hurt) > 0: + print("") num_helped[m] = len(helped) num_hurt[m] = len(hurt) @@ -153,21 +155,28 @@ def main(): if len(gained) > 0: print("") + any_helped_or_hurt = False for m in args.measurements: - print("total {0} in shared programs: {1}\n" - "{0} in affected programs: {2}\n" - "helped: {3}\n" - "HURT: {4}\n".format( - m, - change(total_before[m], total_after[m]), - change(affected_before[m], affected_after[m]), - num_helped[m], - num_hurt[m])) - - - print("LOST: " + str(len(lost))) - print("GAINED: " + str(len(gained))) - + if num_helped[m] > 0 or num_hurt[m] > 0: + any_helped_or_hurt = True + + if num_helped[m] > 0 or num_hurt[m] > 0 or not args.changes_only: + print("total {0} in shared programs: {1}\n" + "{0} in affected programs: {2}\n" + "helped: {3}\n" + "HURT: {4}\n".format( + m, + change(total_before[m], total_after[m]), + change(affected_before[m], affected_after[m]), + num_helped[m], + num_hurt[m])) + + if len(lost) > 0 or len(gained) > 0 or not args.changes_only: + print("LOST: " + str(len(lost))) + print("GAINED: " + str(len(gained))) + + if args.changes_only and len(lost) == 0 and len(gained) == 0 and not any_helped_or_hurt: + print("No changes.") if __name__ == "__main__": main() -- 2.9.5 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
