summaryrefslogtreecommitdiffstats
path: root/bench/bench.mk
diff options
context:
space:
mode:
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