benches: Added stack/heap measurements to bench_wt

Might as well, we have the hooks already.

The only annoying this is these extra probes clutter up the `make
bench-marks` output, so split into two separate rules:

- make bench-marks
- make bench-usage

It's tempting to add disk usage as well (we have bench_helper_usage for
this purpose), but I'm not sure how to measure usage in bench_wt_seq
since it's constantly truncating.
This commit is contained in:
Christopher Haster
2026-02-05 15:32:56 -06:00
parent c641bac80a
commit 81a9c34c8b
2 changed files with 67 additions and 0 deletions
+35
View File
@@ -592,6 +592,7 @@ bench-marks: SUMMARYFLAGS+=-Si
bench-marks: $(BENCH_CSV) bench-marks: $(BENCH_CSV)
$(strip ./scripts/csv.py \ $(strip ./scripts/csv.py \
<(./scripts/csv.py $^ \ <(./scripts/csv.py $^ \
-Dprobe=create,delete,fetch,lookup,write \
-bprobe='%(case)s+%(probe)s' \ -bprobe='%(case)s+%(probe)s' \
-Fi='min(enumerate())' \ -Fi='min(enumerate())' \
-fn='max(n)' \ -fn='max(n)' \
@@ -612,12 +613,14 @@ bench-marks-csv: $(BUILDDIR)/lfs3.bench.csv
bench-marks-diff: $(BENCH_CSV) bench-marks-diff: $(BENCH_CSV)
$(strip ./scripts/csv.py \ $(strip ./scripts/csv.py \
<(./scripts/csv.py $^ \ <(./scripts/csv.py $^ \
-Dprobe=create,delete,fetch,lookup,write \
-bprobe='%(case)s+%(probe)s' \ -bprobe='%(case)s+%(probe)s' \
-Fi='min(enumerate())' \ -Fi='min(enumerate())' \
-fn='max(n)' \ -fn='max(n)' \
-ft='max(float(bench_simtime)/1.0e9)' \ -ft='max(float(bench_simtime)/1.0e9)' \
-o-) \ -o-) \
-d <(./scripts/csv.py $(BUILDDIR)/lfs3.bench.csv \ -d <(./scripts/csv.py $(BUILDDIR)/lfs3.bench.csv \
-Dprobe=create,delete,fetch,lookup,write \
-bprobe='%(case)s+%(probe)s' \ -bprobe='%(case)s+%(probe)s' \
-Fi='min(enumerate())' \ -Fi='min(enumerate())' \
-fn='max(n)' \ -fn='max(n)' \
@@ -633,6 +636,7 @@ bench-bottlenecks: SUMMARYFLAGS+=-Sruntime
bench-bottlenecks: $(BENCH_CSV) bench-bottlenecks: $(BENCH_CSV)
$(strip ./scripts/csv.py \ $(strip ./scripts/csv.py \
<(./scripts/csv.py $^ \ <(./scripts/csv.py $^ \
-Dprobe=create,delete,fetch,lookup,write \
-bprobe='%(case)s+%(probe)s' \ -bprobe='%(case)s+%(probe)s' \
-Fi='min(enumerate())' \ -Fi='min(enumerate())' \
-fn='max(n)' \ -fn='max(n)' \
@@ -650,6 +654,7 @@ bench-bottlenecks: $(BENCH_CSV)
bench-ops: SUMMARYFLAGS+=-Si bench-ops: SUMMARYFLAGS+=-Si
bench-ops: $(BENCH_CSV) bench-ops: $(BENCH_CSV)
$(strip ./scripts/csv.py $^ \ $(strip ./scripts/csv.py $^ \
-Dprobe=create,delete,fetch,lookup,write \
-bprobe='%(case)s+%(probe)s' \ -bprobe='%(case)s+%(probe)s' \
-Fi='min(enumerate())' \ -Fi='min(enumerate())' \
-freads='bench_reads' \ -freads='bench_reads' \
@@ -665,6 +670,7 @@ bench-ops: $(BENCH_CSV)
bench-widths: SUMMARYFLAGS+=-Si bench-widths: SUMMARYFLAGS+=-Si
bench-widths: $(BENCH_CSV) bench-widths: $(BENCH_CSV)
$(strip ./scripts/csv.py $^ \ $(strip ./scripts/csv.py $^ \
-Dprobe=create,delete,fetch,lookup,write \
-bprobe='%(case)s+%(probe)s' \ -bprobe='%(case)s+%(probe)s' \
-Fi='min(enumerate())' \ -Fi='min(enumerate())' \
-freaded="avg(ffrac( \ -freaded="avg(ffrac( \
@@ -687,6 +693,35 @@ bench-widths: $(BENCH_CSV)
| sed -n 's/^ERASE_WIDTH=\(.*\)/\1/p'))))" \ | sed -n 's/^ERASE_WIDTH=\(.*\)/\1/p'))))" \
$(SUMMARYFLAGS)) $(SUMMARYFLAGS))
## Show heap/stack/disk usage
.PHONY: bench-usage
bench-usage: SUMMARYFLAGS+=-Si
bench-usage: $(BENCH_CSV)
$(strip ./scripts/csv.py \
<(./scripts/csv.py $^ \
-Dprobe=stack \
-bcase \
-Fi='min(enumerate())' \
-fstack='max(bench_simtime)' \
-o-) \
<(./scripts/csv.py $^ \
-Dprobe=heap \
-bcase \
-Fi='min(enumerate())' \
-fheap='max(bench_simtime)' \
-o-) \
<(./scripts/csv.py $^ \
-Dprobe=usage \
-bcase \
-Fi='min(enumerate())' \
-fdisk='max(bench_simtime)' \
-o-) \
-bcase \
-fstack \
-fheap \
-fdisk \
$(SUMMARYFLAGS))
+32
View File
@@ -82,6 +82,14 @@ code = '''
// report the amount we managed to write // report the amount we managed to write
BENCH_STOP("write", written); BENCH_STOP("write", written);
// report the total stack/heap usage after the benchmark
#ifdef BENCH_YES_STACK
BENCH_RESULT("stack", written, BENCH_STACK());
#endif
#ifdef BENCH_YES_HEAP
BENCH_RESULT("heap", written, BENCH_HEAP());
#endif
lfs3_unmount(&lfs3) => 0; lfs3_unmount(&lfs3) => 0;
''' '''
@@ -129,6 +137,14 @@ code = '''
// report the amount we managed to write // report the amount we managed to write
BENCH_STOP("write", written); BENCH_STOP("write", written);
// report the total stack/heap usage after the benchmark
#ifdef BENCH_YES_STACK
BENCH_RESULT("stack", written, BENCH_STACK());
#endif
#ifdef BENCH_YES_HEAP
BENCH_RESULT("heap", written, BENCH_HEAP());
#endif
lfs3_unmount(&lfs3) => 0; lfs3_unmount(&lfs3) => 0;
''' '''
@@ -196,6 +212,14 @@ code = '''
// report the amount we managed to write // report the amount we managed to write
BENCH_STOP("write", written); BENCH_STOP("write", written);
// report the total stack/heap usage after the benchmark
#ifdef BENCH_YES_STACK
BENCH_RESULT("stack", written, BENCH_STACK());
#endif
#ifdef BENCH_YES_HEAP
BENCH_RESULT("heap", written, BENCH_HEAP());
#endif
lfs3_unmount(&lfs3) => 0; lfs3_unmount(&lfs3) => 0;
''' '''
@@ -253,6 +277,14 @@ code = '''
// report the amount we managed to write // report the amount we managed to write
BENCH_STOP("write", written); BENCH_STOP("write", written);
// report the total stack/heap usage after the benchmark
#ifdef BENCH_YES_STACK
BENCH_RESULT("stack", written, BENCH_STACK());
#endif
#ifdef BENCH_YES_HEAP
BENCH_RESULT("heap", written, BENCH_HEAP());
#endif
lfs3_unmount(&lfs3) => 0; lfs3_unmount(&lfs3) => 0;
''' '''