From b1742da3868a3594b4e78be64e1412356d95dbd7 Mon Sep 17 00:00:00 2001 From: Onur Gündüz Date: Wed, 10 Jun 2026 15:20:20 +0200 Subject: bench: progress output during sampling, ignore .gitignore in dirty stamp --- Makefile | 4 +++- bench/bench.h | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 88baa58..33501f9 100644 --- a/Makefile +++ b/Makefile @@ -282,7 +282,9 @@ bench-tokenizer: # a JSON sample set under bench/results/, keyed by commit; compare two # records with scripts/benchstat.py to see if a change helped or hurt. # ============================================================================= -BENCH_STAMP = $(shell git rev-parse --short HEAD 2>/dev/null || echo nogit)$(shell git diff --quiet 2>/dev/null || echo -dirty)-$(shell date +%Y%m%d-%H%M%S) +# Dirtiness ignores .gitignore so local-only ignore entries do not mark +# every record as -dirty. +BENCH_STAMP = $(shell git rev-parse --short HEAD 2>/dev/null || echo nogit)$(shell git diff --quiet -- ':!.gitignore' 2>/dev/null || echo -dirty)-$(shell date +%Y%m%d-%H%M%S) BENCH_CC_FLAGS = -Wall -Wextra $(CFLAGS_BASE) $(TEST_BLAS_CFLAGS) -I. bench: diff --git a/bench/bench.h b/bench/bench.h index e26a05d..2c98d5c 100644 --- a/bench/bench.h +++ b/bench/bench.h @@ -163,16 +163,22 @@ static int bench_main(const bench_opts_t *o, } iters[c] = n; ran++; + fprintf(stderr, "calibrated %-44s n=%ld\n", cases[c].name, n); } /* Sample round-robin so slow machine drift (thermals, scheduling) * lands inside every benchmark's sample spread instead of shifting - * whole benchmarks against each other. */ - for (int s = 0; s < o->count; s++) + * whole benchmarks against each other. Results print after the + * last pass; the pass lines are the progress indicator. */ + double sample_t0 = bench_now_ns(); + for (int s = 0; s < o->count; s++) { for (int c = 0; c < n_cases; c++) if (iters[c]) all[(size_t)c * o->count + s] = bench_run_once(cases[c].fn, iters[c]); + fprintf(stderr, "pass %d/%d (%.0fs elapsed)\n", s + 1, o->count, + (bench_now_ns() - sample_t0) / 1e9); + } int emitted = 0; for (int c = 0; c < n_cases; c++) { -- cgit v1.3.1