Skip to content
Snippets Groups Projects
Commit 6d8c2b0c authored by Marek Vavrusa's avatar Marek Vavrusa Committed by Vladimír Čunát
Browse files

bench: make bench, dataset for lru, cleanup

`make bench` now runs a predefined set of
microbenchmarks (right now LRU), it's a start
for comparative microbench of internal structures
parent f2bdb7af
Branches
Tags
No related merge requests found
bench_BIN := \
bench_lru
......@@ -15,13 +14,22 @@ endif
# Make bench binaries
define make_bench
$(1)_CFLAGS := -fPIC
$(1)_CFLAGS := -fPIE
$(1)_SOURCES := bench/$(1).c
$(1)_LIBS := $(bench_LIBS)
$(1)_DEPEND := $(bench_DEPEND)
$(call make_bin,$(1),bench)
.PHONY: $(1)
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))
# Test LRU with increasing overfill, misses should increase ~ linearly
@./bench/bench_lru 22 bench/bench_lru_set1.tsv - 65536 # fill = 1
@./bench/bench_lru 23 bench/bench_lru_set1.tsv - 32768 # fill = 2
@./bench/bench_lru 23 bench/bench_lru_set1.tsv - 16384 # fill = 4
@./bench/bench_lru 23 bench/bench_lru_set1.tsv - 8192 # fill = 8
@./bench/bench_lru 23 bench/bench_lru_set1.tsv - 4096 # fill = 16
\ No newline at end of file
......@@ -138,7 +138,7 @@ static struct key * read_lines(const char *fname, size_t *count) {
#endif
static void usage(const char *progname) {
fprintf(stderr, "usage: %s <seed> <input>\n"
fprintf(stderr, "usage: %s <log_count> <input> <seed> [lru_size]\n"
"The seed must be at least 12 characters or \"-\".\n" , progname);
exit(1);
}
......@@ -154,7 +154,8 @@ int main(int argc, char ** argv) {
size_t run_count;
{
size_t run_log = atoi(argv[1]);
run_count = 1 << run_log;
assert(run_log < 64);
run_count = 1ULL << run_log;
printf("test run length: 2^%zd\n", run_log);
}
......
This diff is collapsed.
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment