[PATCH v4] benchtests: Fix validate_benchout.py exceptions
Siddhesh Poyarekar
siddhesh@gotplt.org
Thu Sep 16 01:41:54 GMT 2021
On 9/16/21 6:42 AM, naohirot@fujitsu.com wrote:
> Hi Siddhesh,
>
> Thank you for the comment.
>
>> From: Siddhesh Poyarekar <siddhesh@gotplt.org>
>> Sent: Wednesday, September 15, 2021 12:23 PM
>>
>> This will break the original use case, i.e. bench.out, since it doesn't
>> have the 'results' nesting timings. The sorting doesn't seem necessary
>> for validation, it's only necessary for compare_bench.py. You could
>> move the do_for_all_timings call into compare_bench.py, which is
>> specific to bench.out so that you don't have to modify do_for_all_timings.
>
> If do_for_all_timings is moved to compare_bench.py, parse_bench also has
> to be moved to compare_bench.py and compare_strings.py.
>
Ahh no, I didn't suggest moving the implementation, only the call, like
below. This way import_bench.parse_bench does not have to know about
the specific json format.
diff --git a/benchtests/scripts/compare_bench.py
b/benchtests/scripts/compare_bench.py
index 6fcbd08038..fa7481c76e 100755
--- a/benchtests/scripts/compare_bench.py
+++ b/benchtests/scripts/compare_bench.py
@@ -163,7 +163,11 @@ def plot_graphs(bench1, bench2):
def main(bench1, bench2, schema, threshold, stats):
bench1 = bench.parse_bench(bench1, schema)
+ bench.do_for_all_timings(bench1, lambda b, f, v:
+ b['functions'][f][v]['timings'].sort())
bench2 = bench.parse_bench(bench2, schema)
+ bench.do_for_all_timings(bench2, lambda b, f, v:
+ b['functions'][f][v]['timings'].sort())
plot_graphs(bench1, bench2)
diff --git a/benchtests/scripts/import_bench.py
b/benchtests/scripts/import_bench.py
index a799b4e1b7..362c990fe1 100644
--- a/benchtests/scripts/import_bench.py
+++ b/benchtests/scripts/import_bench.py
@@ -136,6 +136,4 @@ def parse_bench(filename, schema_filename):
with open(filename, 'r') as benchfile:
bench = json.load(benchfile)
validator.validate(bench, schema)
- do_for_all_timings(bench, lambda b, f, v:
- b['functions'][f][v]['timings'].sort())
return bench
More information about the Libc-alpha
mailing list