5. Profiling
Issue #13. Once
lake exe bench run flags a regression, the next question is
why. lean-bench gives you a way to run a single benchmark
invocation under any external profiler — perf, samply,
heaptrack, /usr/bin/time -v, valgrind --tool=callgrind, … —
without writing shell glue.
The mechanism is intentionally minimal: the profile subcommand
re-invokes the benchmark binary in child mode at one parameter,
but with your profiler command prefixed in front. The profiler
sees a single short-lived child process that runs the registered
function many times (under the default cacheMode := .warm
autotuner) and then exits. Whatever output the profiler produces
— flamegraphs, counters, allocation traces — lands directly on
your terminal or in files at the location it chose.
This page documents four end-to-end workflows. None of them
require modifying your setup_benchmark declarations. All of
them assume you already have a populated benchmark binary; if not,
see Quickstart
first.