benchmark: improve setup

Add some useful make targets, and separate (optimized) build.
This commit is contained in:
Dirk-Jan C. Binnema 2023-07-25 23:54:50 +03:00
parent 4c0b7db3d8
commit da290c21a9
2 changed files with 36 additions and 14 deletions

View File

@ -15,18 +15,19 @@
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Makefile with some useful targets for meson/ninja
V ?= 0
V ?= 0
BUILDDIR ?= $(CURDIR)/build
BUILDDIR_COVERAGE ?= $(CURDIR)/build-coverage
BUILDDIR_VALGRIND ?= $(CURDIR)/build-valgrind
BUILDDIR ?= $(CURDIR)/build
BUILDDIR_COVERAGE ?= $(CURDIR)/build-coverage
BUILDDIR_VALGRIND ?= $(CURDIR)/build-valgrind
BUILDDIR_BENCHMARK ?= $(CURDIR)/build-benchmark
GENHTML ?= genhtml
LCOV ?= lcov
MAKEINFO ?= makeinfo
MESON ?= meson
NINJA ?= ninja
VALGRIND ?= valgrind
GENHTML ?= genhtml
LCOV ?= lcov
MAKEINFO ?= makeinfo
MESON ?= meson
NINJA ?= ninja
VALGRIND ?= valgrind
ifneq ($(V),0)
VERBOSE=--verbose
@ -108,8 +109,22 @@ test-helgrind: $(BUILDDIR_VALGRIND)
check-helgrind: test-helgrind
benchmark: $(BUILDDIR)
$(NINJA) -C $(BUILDDIR) benchmark
#
# benchmarking
#
$(BUILDDIR_BENCHMARK):
@$(MESON) setup --buildtype=release $(BUILDDIR_BENCHMARK)
build-benchmark: $(BUILDDIR_BENCHMARK)
@$(MESON) compile -C $(BUILDDIR_BENCHMARK) $(VERBOSE)
benchmark: $(BUILDDIR_BENCHMARK)
$(NINJA) -C $(BUILDDIR_BENCHMARK) benchmark
#
# coverage
#
$(BUILDDIR_COVERAGE):
$(MESON) setup -Db_coverage=true --buildtype=debug $(BUILDDIR_COVERAGE)
@ -127,6 +142,11 @@ coverage: $(BUILDDIR_COVERAGE)
@$(GENHTML) $(covfile) --output-directory $(BUILDDIR_COVERAGE)/meson-logs/coverage/
@echo "coverage report at: file://$(BUILDDIR_COVERAGE)/meson-logs/coverage/index.html"
#
# misc
#
dist: $(BUILDDIR)
$(MESON) compile -C $(BUILDDIR) $(VERBOSE)
$(MESON) dist -C $(BUILDDIR) $(VERBOSE)

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2022 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** Copyright (C) 2022-2023 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
@ -494,7 +494,9 @@ int
main(int argc, char *argv[])
{
size_t num_maildirs{}, num_messages{};
g_test_init(&argc, &argv, nullptr);
mu_test_init(&argc, &argv);
if (g_test_perf()) {
num_maildirs = 20;
num_messages = 5000;