summaryrefslogtreecommitdiffstats
path: root/bench
diff options
context:
space:
mode:
authorTomas Krizek <tomas.krizek@nic.cz>2019-02-14 17:08:43 +0100
committerTomas Krizek <tomas.krizek@nic.cz>2019-03-12 10:43:30 +0100
commitdf1a38ddb297254c2edb19a242ed6057bbd06311 (patch)
treed1159dc8a538be9d46f4ab9095fde5cf92eed8c7 /bench
parentmeson: clean up meson.build (diff)
downloadknot-resolver-df1a38ddb297254c2edb19a242ed6057bbd06311.tar.xz
knot-resolver-df1a38ddb297254c2edb19a242ed6057bbd06311.zip
meson: bench - compile and run
Diffstat (limited to 'bench')
-rw-r--r--bench/bench.mk28
-rw-r--r--bench/bench_lru.c4
-rw-r--r--bench/meson.build23
3 files changed, 27 insertions, 28 deletions
diff --git a/bench/bench.mk b/bench/bench.mk
deleted file mode 100644
index e0100391..00000000
--- a/bench/bench.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-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
diff --git a/bench/bench_lru.c b/bench/bench_lru.c
index 63bbeebd..237be669 100644
--- a/bench/bench_lru.c
+++ b/bench/bench_lru.c
@@ -33,6 +33,10 @@ typedef kr_nsrep_lru_t lru_bench_t;
} while (0)
#define p_err(...) fprintf(stderr, __VA_ARGS__)
+#ifndef LRU_RTT_SIZE
+#define LRU_RTT_SIZE 65536 /**< NS RTT cache size */
+#endif
+
static int die(const char *cause)
{
fprintf(stderr, "%s: %s\n", cause, strerror(errno));
diff --git a/bench/meson.build b/bench/meson.build
new file mode 100644
index 00000000..2d466ab0
--- /dev/null
+++ b/bench/meson.build
@@ -0,0 +1,23 @@
+# bench
+
+bench_lru_src = [
+ 'bench_lru.c',
+]
+
+cc = meson.get_compiler('c')
+m_dep = cc.find_library('m', required : false)
+
+bench_lru = executable(
+ 'bench_lru',
+ bench_lru_src,
+ dependencies: [
+ contrib_dep,
+ libkres_dep,
+ m_dep,
+ ],
+)
+
+run_target(
+ 'bench',
+ command: '../scripts/bench.sh',
+)