[Mesa-dev] [PATCH 5/7] report.py: Add option to only display measurements that have changes
Ian Romanick
idr at freedesktop.org
Mon Jan 22 08:52:19 UTC 2018
On 01/13/2018 04:23 AM, Dylan Baker wrote:
> Quoting Ian Romanick (2018-01-12 12:06:59)
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> This is useful for preparing data to go in a Mesa commit message.
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> ---
>> 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:
>
> Couldn't this be: `if any_helped_or_hurt or not args.changes_only:`
After running on that change for a few days... no. any_helped_or_hurt
applies across all data where as num_helped[m] > 0 or num_hurt[m] > 0
applies only to a single, specific piece of data. I don't want to log
information for loops just because instructions were changed.
>> + 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:
>
> Don't use len() for checking if a list has members:
> `if lost or gained 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:
>
> same here:
> `if args.changes_only and not lost and not gained and not any_helped_or_hurt`:
>
>> + print("No changes.")
>>
>> if __name__ == "__main__":
>> main()
>> --
>> 2.9.5
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180122/f5aff960/attachment-0001.sig>
More information about the mesa-dev
mailing list