Re: [PATCH v2 4/5] meson: wire up benchmarks
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Apr 20, 2025, 10:00 UTC
- Message-ID
- <CAP8UFD2jKwYzmc40knXY7k+FQabjZbGTqs9fowF=-0OqfNYp_w@mail.gmail.com>
- In-Reply-To
- <20250414-pks-meson-benchmarks-v2-4-04377080a167@pks.im>
On Mon, Apr 14, 2025 at 8:51 AM Patrick Steinhardt <ps@pks.im> wrote:
Show 21 quoted lines
> > Wire up benchmarks in Meson. The setup is mostly the same as how we wire > up our tests. The only difference is that benchmarks get wired up via > the `benchmark()` option instead of via `test()`, which gives them a bit > of special treatment: > > - Benchmarks never run in parallel. > > - Benchmarks aren't run by default when tests are executed. > > - Meson does not inject the `MALLOC_PERTURB` environment variable. > > Using benchmarks is quite simple: > > ``` > $ meson setup build > # Run all benchmarks. > $ meson test -C build --benchmark > # Run a specific benchmark. > $ meson test -C build --benchmark p0000-* > ```
Instead of just here, I would have expected that something like this would appear towards the top of the top level meson.build file, maybe in a "Benchmarking" section, where there is the rest of the meson documentation for Git.
Show 7 quoted lines
> Other than that the usual command line arguments accepted when running > tests are also accepted when running benchmarks. > > Note that the benchmarking target is somewhat limited because it will > only run benchmarks for the current build. Other usecases, like running > benchmarks against multiple different versions of Git, are not currently > supported. Users should continue to use "t/perf/run" for those usecases.
s/usecases/use cases/
> The script should get extended at one point in time to support Meson, > but this is outside of the scope of this series.
Fair enough.
Show 16 quoted lines
> +if time.found()
> + benchmark_environment = test_environment
> + benchmark_environment.set('GTIME', time.full_path())
> +
> + foreach benchmark : benchmarks
> + benchmark(fs.stem(benchmark), shell,
> + args: [
> + fs.name(benchmark),
> + ],
> + workdir: meson.current_source_dir() / 'perf',
> + env: benchmark_environment,
> + depends: test_dependencies + bin_wrappers,
> + timeout: 0,
> + )
> + endforeach
> +endifI wonder what happens when we run `meson test -C build --benchmark` but 'time' is not found.