summaryrefslogtreecommitdiffstats
path: root/bench/bench.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
commit3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch)
treef87bd4a126b3a843858eb447e8fd5893c3ee3882 /bench/bench.mk
parentInitial commit. (diff)
downloadknot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.tar.xz
knot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.zip
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bench/bench.mk')
-rw-r--r--bench/bench.mk28
1 files changed, 28 insertions, 0 deletions
diff --git a/bench/bench.mk b/bench/bench.mk
new file mode 100644
index 0000000..e010039
--- /dev/null
+++ b/bench/bench.mk
@@ -0,0 +1,28 @@
+bench_BIN := \
+ bench_lru
+
+# Dependencies
+bench_DEPEND := $(libkres)
+bench_LIBS := $(libkres_TARGET) $(libkres_LIBS)
+
+# Make bench binaries
+define make_bench
+$(1)_CFLAGS := -fPIE
+$(1)_SOURCES := bench/$(1).c
+$(1)_LIBS := $(bench_LIBS)
+$(1)_DEPEND := $(bench_DEPEND)
+$(call make_bin,$(1),bench)
+endef
+
+$(foreach bench,$(bench_BIN),$(eval $(call make_bench,$(bench))))
+
+# Targets
+.PHONY: bench bench-clean
+bench-clean: $(foreach bench,$(bench_BIN),$(bench)-clean)
+bench: $(foreach bench,$(bench_BIN),bench/$(bench))
+ @echo "Test LRU with increasing overfill, misses should increase ~ linearly" >&2
+ $(preload_syms) ./bench/bench_lru 23 bench/bench_lru_set1.tsv - 65536 # fill ~ 1
+ $(preload_syms) ./bench/bench_lru 23 bench/bench_lru_set1.tsv - 32768 # fill ~ 2
+ $(preload_syms) ./bench/bench_lru 23 bench/bench_lru_set1.tsv - 16384 # fill ~ 4
+ $(preload_syms) ./bench/bench_lru 23 bench/bench_lru_set1.tsv - 8192 # fill ~ 8
+ $(preload_syms) ./bench/bench_lru 23 bench/bench_lru_set1.tsv - 4096 # fill ~ 16