From 9a2b561a760155279ecc71f872ba3f67180693f8 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 14 Nov 2024 13:15:25 -0600 Subject: [PATCH] scripts: Adopted -c/--compare in make summary-diff This showcases the sort of high-level result printing where -c/--compare is useful: $ make summary-diff code data stack structs BEFORE 57057 0 3056 1476 AFTER 68864 (+20.7%) 0 (+0.0%) 3744 (+22.5%) 1520 (+3.0%) There was one hiccup though: how to hide the name of the first field. It may seem minor, but the missing field name really does help readability when you're staring at a wall of CLI output. It's a bit of a hack, but this can now be controlled with -Y/--summary, which has the sole purpose of disabling the first field name if mixed with -c/--compare. -c/--compare is already a weird case for the summary row anyways... --- Makefile | 55 ++++++++++++++++++++++++---------------------- scripts/code.py | 4 ++-- scripts/cov.py | 4 ++-- scripts/csv.py | 4 ++-- scripts/data.py | 4 ++-- scripts/perf.py | 4 ++-- scripts/perfbd.py | 4 ++-- scripts/stack.py | 4 ++-- scripts/structs.py | 4 ++-- 9 files changed, 45 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 15b45bec..a0bee969 100644 --- a/Makefile +++ b/Makefile @@ -344,13 +344,13 @@ summary sizes: \ $(BUILDDIR)/lfs.structs.csv $(strip ./scripts/csv.py \ <(./scripts/csv.py $(BUILDDIR)/lfs.code.csv \ - -fcode=size -q $(SUMMARYFLAGS) -o-) \ + -fcode=size -q -o-) \ <(./scripts/csv.py $(BUILDDIR)/lfs.data.csv \ - -fdata=size -q $(SUMMARYFLAGS) -o-) \ + -fdata=size -q -o-) \ <(./scripts/csv.py $(BUILDDIR)/lfs.stack.csv \ - -fstack='max(limit)' -q $(SUMMARYFLAGS) -o-) \ + -fstack='max(limit)' -q -o-) \ <(./scripts/csv.py $(BUILDDIR)/lfs.structs.csv \ - -fstructs=size -q $(SUMMARYFLAGS) -o-) \ + -fstructs=size -q -o-) \ -bfunction -fcode -fdata -fstack='max(stack)' -fstructs \ -Y $(SUMMARYFLAGS)) @@ -360,29 +360,32 @@ summary-diff sizes-diff: SHELL=/bin/bash summary-diff sizes-diff: $(OBJ) $(CI) $(strip ./scripts/csv.py \ <(./scripts/csv.py \ - <(./scripts/code.py $(OBJ) -q $(CODEFLAGS) -o-) \ - -fcode=size -q $(SUMMARYFLAGS) -o-) \ - <(./scripts/csv.py \ - <(./scripts/data.py $(OBJ) -q $(DATAFLAGS) -o-) \ - -fdata=size -q $(SUMMARYFLAGS) -o-) \ - <(./scripts/csv.py \ - <(./scripts/stack.py $(CI) -q $(STACKFLAGS) -o-) \ - -fstack='max(limit)' -q $(SUMMARYFLAGS) -o-) \ - <(./scripts/csv.py \ - <(./scripts/structs.py $(OBJ) -q $(STRUCTSFLAGS) -o-) \ - -fstructs=size -q $(SUMMARYFLAGS) -o-) \ - -bfunction -fcode -fdata -fstack='max(stack)' -fstructs \ - -Y -p $(SUMMARYFLAGS) -d <(./scripts/csv.py \ - <(./scripts/csv.py $(BUILDDIR)/lfs.code.csv \ - -fcode=size -q $(SUMMARYFLAGS) -o-) \ - <(./scripts/csv.py $(BUILDDIR)/lfs.data.csv \ - -fdata=size -q $(SUMMARYFLAGS) -o-) \ - <(./scripts/csv.py $(BUILDDIR)/lfs.stack.csv \ - -fstack='max(limit)' -q $(SUMMARYFLAGS) -o-) \ - <(./scripts/csv.py $(BUILDDIR)/lfs.structs.csv \ - -fstructs=size -q $(SUMMARYFLAGS) -o-) \ + <(./scripts/csv.py \ + <(./scripts/code.py $(OBJ) -q $(CODEFLAGS) -o-) \ + -fcode=size -q -o-) \ + <(./scripts/csv.py \ + <(./scripts/data.py $(OBJ) -q $(DATAFLAGS) -o-) \ + -fdata=size -q -o-) \ + <(./scripts/csv.py \ + <(./scripts/stack.py $(CI) -q $(STACKFLAGS) -o-) \ + -fstack='max(limit)' -q -o-) \ + <(./scripts/csv.py \ + <(./scripts/structs.py $(OBJ) -q $(STRUCTSFLAGS) -o-) \ + -fstructs=size -q -o-) \ -fcode -fdata -fstack='max(stack)' -fstructs \ - -q $(SUMMARYFLAGS) -o-)) + -bbuild='"AFTER"' -q -o-) \ + <(./scripts/csv.py \ + <(./scripts/csv.py $(BUILDDIR)/lfs.code.csv \ + -fcode=size -q -o-) \ + <(./scripts/csv.py $(BUILDDIR)/lfs.data.csv \ + -fdata=size -q -o-) \ + <(./scripts/csv.py $(BUILDDIR)/lfs.stack.csv \ + -fstack='max(limit)' -q -o-) \ + <(./scripts/csv.py $(BUILDDIR)/lfs.structs.csv \ + -fstructs=size -q -o-) \ + -fcode -fdata -fstack='max(stack)' -fstructs \ + -bbuild='"BEFORE"' -q -o-) \ + -bbuild -cBEFORE -Y $(SUMMARYFLAGS)) ## Build the test-runner .PHONY: test-runner build-tests diff --git a/scripts/code.py b/scripts/code.py index e776bebd..64fa5ced 100755 --- a/scripts/code.py +++ b/scripts/code.py @@ -537,7 +537,7 @@ def table(Result, results, diff_results=None, *, return entry # entries - if not summary: + if not summary or compare: for name in names: r = table.get(name) if diff_results is None: @@ -547,7 +547,7 @@ def table(Result, results, diff_results=None, *, lines.append(table_entry(name, r, diff_r)) # total, unless we're comparing - if summary or not (compare is not None and diff_results is None): + if not (compare is not None and diff_results is None): r = next(iter(fold(Result, results, by=[])), None) if diff_results is None: diff_r = None diff --git a/scripts/cov.py b/scripts/cov.py index 4ce0c742..17a2d7a3 100755 --- a/scripts/cov.py +++ b/scripts/cov.py @@ -547,7 +547,7 @@ def table(Result, results, diff_results=None, *, return entry # entries - if not summary: + if not summary or compare: for name in names: r = table.get(name) if diff_results is None: @@ -557,7 +557,7 @@ def table(Result, results, diff_results=None, *, lines.append(table_entry(name, r, diff_r)) # total, unless we're comparing - if summary or not (compare is not None and diff_results is None): + if not (compare is not None and diff_results is None): r = next(iter(fold(Result, results, by=[])), None) if diff_results is None: diff_r = None diff --git a/scripts/csv.py b/scripts/csv.py index be4c7e9e..6b12e6b6 100755 --- a/scripts/csv.py +++ b/scripts/csv.py @@ -1572,7 +1572,7 @@ def table(Result, results, diff_results=None, *, return entry # entries - if not summary: + if not summary or compare: for name in names: r = table.get(name) if diff_results is None: @@ -1582,7 +1582,7 @@ def table(Result, results, diff_results=None, *, lines.append(table_entry(name, r, diff_r)) # total, unless we're comparing - if summary or not (compare is not None and diff_results is None): + if not (compare is not None and diff_results is None): r = next(iter(fold(Result, results, by=[])), None) if diff_results is None: diff_r = None diff --git a/scripts/data.py b/scripts/data.py index 0af08061..d756e32b 100755 --- a/scripts/data.py +++ b/scripts/data.py @@ -537,7 +537,7 @@ def table(Result, results, diff_results=None, *, return entry # entries - if not summary: + if not summary or compare: for name in names: r = table.get(name) if diff_results is None: @@ -547,7 +547,7 @@ def table(Result, results, diff_results=None, *, lines.append(table_entry(name, r, diff_r)) # total, unless we're comparing - if summary or not (compare is not None and diff_results is None): + if not (compare is not None and diff_results is None): r = next(iter(fold(Result, results, by=[])), None) if diff_results is None: diff_r = None diff --git a/scripts/perf.py b/scripts/perf.py index f90de89c..9295d57c 100755 --- a/scripts/perf.py +++ b/scripts/perf.py @@ -936,7 +936,7 @@ def table(Result, results, diff_results=None, *, prefixes[2+is_last] + " ")) # entries - if not summary: + if not summary or compare: for name in names: r = table.get(name) if diff_results is None: @@ -956,7 +956,7 @@ def table(Result, results, diff_results=None, *, " ")) # total, unless we're comparing - if summary or not (compare is not None and diff_results is None): + if not (compare is not None and diff_results is None): r = next(iter(fold(Result, results, by=[])), None) if diff_results is None: diff_r = None diff --git a/scripts/perfbd.py b/scripts/perfbd.py index d3de783a..9e6f468c 100755 --- a/scripts/perfbd.py +++ b/scripts/perfbd.py @@ -900,7 +900,7 @@ def table(Result, results, diff_results=None, *, prefixes[2+is_last] + " ")) # entries - if not summary: + if not summary or compare: for name in names: r = table.get(name) if diff_results is None: @@ -920,7 +920,7 @@ def table(Result, results, diff_results=None, *, " ")) # total, unless we're comparing - if summary or not (compare is not None and diff_results is None): + if not (compare is not None and diff_results is None): r = next(iter(fold(Result, results, by=[])), None) if diff_results is None: diff_r = None diff --git a/scripts/stack.py b/scripts/stack.py index cf6d9c60..5a59d2c2 100755 --- a/scripts/stack.py +++ b/scripts/stack.py @@ -582,7 +582,7 @@ def table(Result, results, diff_results=None, *, prefixes[2+is_last] + " ")) # entries - if not summary: + if not summary or compare: for name in names: r = table.get(name) if diff_results is None: @@ -602,7 +602,7 @@ def table(Result, results, diff_results=None, *, " ")) # total, unless we're comparing - if summary or not (compare is not None and diff_results is None): + if not (compare is not None and diff_results is None): r = next(iter(fold(Result, results, by=[])), None) if diff_results is None: diff_r = None diff --git a/scripts/structs.py b/scripts/structs.py index dceb2ba6..7e802426 100755 --- a/scripts/structs.py +++ b/scripts/structs.py @@ -487,7 +487,7 @@ def table(Result, results, diff_results=None, *, return entry # entries - if not summary: + if not summary or compare: for name in names: r = table.get(name) if diff_results is None: @@ -497,7 +497,7 @@ def table(Result, results, diff_results=None, *, lines.append(table_entry(name, r, diff_r)) # total, unless we're comparing - if summary or not (compare is not None and diff_results is None): + if not (compare is not None and diff_results is None): r = next(iter(fold(Result, results, by=[])), None) if diff_results is None: diff_r = None