From 6c16cbd44fcd328246e2bd5995d3bd229bcb2bef Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 2 Feb 2026 13:45:23 -0600 Subject: [PATCH] make: Added benchmark/testmark-bottlenecks to help find slow cases This is mostly useful for finding slow test cases, but may be useful for benches in the future? I've been running a separate script for this, but adding a rule to the Makefile makes it a bit easier: TESTMARKS=1 make test -j && make testmarks-bottlenecks --- Makefile | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 197e7813..d9ce31d3 100644 --- a/Makefile +++ b/Makefile @@ -540,6 +540,16 @@ testmarks-diff: $(TEST_CSV) -fruntime=test_runtime \ $(SUMMARYFLAGS) -d $(BUILDDIR)/lfs3.test.csv) +## Show which tests took the most time +.PHONY: testmarks-bottlenecks +testmarks-bottlenecks: SUMMARYFLAGS+=-Sruntime +testmarks-bottlenecks: $(TEST_CSV) + $(strip ./scripts/csv.py $^ \ + -bcase \ + -fpassed=test_passed \ + -fruntime=test_runtime \ + $(SUMMARYFLAGS)) + ## Build the bench-runner .PHONY: bench-runner build-benches bench-runner build-benches: CFLAGS+=$(BENCH_CFLAGS) @@ -587,11 +597,23 @@ benchmarks-csv: $(BUILDDIR)/lfs3.bench.csv .PHONY: benchmarks-diff benchmarks-diff: $(BENCH_CSV) $(strip ./scripts/csv.py $^ \ - -bcase='%(case)s+%(m)s' \ - -fsimtime='float(bench_simtime)/1.0e9' \ - -fsimthroughput='float(n)/max(float(bench_simtime)/1.0e9,1.0e-9)' \ + -bprobe='%(case)s+%(probe)s' \ + -fthroughput='avg( \ + float(delta(n, case, probe)) \ + / max(float(bench_simtime)/1.0e9, 1.0e-9))' \ $(SUMMARYFLAGS) -d $(BUILDDIR)/lfs3.bench.csv) +## Show which tests took the most time +.PHONY: benchmarks-bottlenecks +benchmarks-bottlenecks: SUMMARYFLAGS+=-Sruntime +benchmarks-bottlenecks: $(BENCH_CSV) + $(strip ./scripts/csv.py $^ \ + -bcase='%(case)s+%(probe)s' \ + -fn='delta(n, case, probe)' \ + -ft='float(bench_simtime)/1.0e9' \ + -fruntime='delta(bench_runtime, case, probe)' \ + $(SUMMARYFLAGS)) + # low-level rules