Skip to content

Commit

Permalink
Merge !1581: bench/bench_lru: make it build again, and check it in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
vcunat committed Aug 2, 2024
2 parents 4e9b2b6 + 9c32656 commit 32ce5cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ build-arch:
build-stable:
<<: *build
script:
- meson build_ci_stable --prefix=$PREFIX -Dmalloc=disabled -Dwerror=true -Dextra_tests=enabled
- meson build_ci_stable --prefix=$PREFIX -Dmalloc=disabled -Dwerror=true -Dextra_tests=enabled -Dbench=enabled
- ninja -C build_ci_stable
- ninja -C build_ci_stable install >/dev/null
- ${MESON_TEST} --suite unit --suite config --suite dnstap --no-suite snowflake
Expand Down
14 changes: 7 additions & 7 deletions bench/bench_lru.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
#include "daemon/engine.h"
#include "lib/selection.h"

typedef kr_nsrep_lru_t lru_bench_t;
typedef lru_t(unsigned) lru_bench_t;

#define p_out(...) do { \
printf(__VA_ARGS__); \
fflush(stdout); \
} while (0)
#define p_err(...) fprintf(stderr, __VA_ARGS__)
(void)fflush(stdout); \
} while (0)
#define p_err(...) ((void)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));
(void)fprintf(stderr, "%s: %s\n", cause, strerror(errno));
exit(1);
}

Expand Down Expand Up @@ -171,15 +171,15 @@ int main(int argc, char ** argv)
struct key *keys = read_lines(argv[2], &key_count, &data_to_free);
size_t run_count;
{
size_t run_log = atoi(argv[1]);
size_t run_log = atoi(argv[1]); // NOLINT: atoi is fine for this tool...
assert(run_log < 64);
run_count = 1ULL << run_log;
p_err("\ntest run length:\t2^");
p_out("%zd,", run_log);
}

struct timeval time;
const int lru_size = argc > 4 ? atoi(argv[4]) : LRU_RTT_SIZE;
const int lru_size = argc > 4 ? atoi(argv[4]) : LRU_RTT_SIZE; // NOLINT: ditto atoi

lru_bench_t *lru;
#ifdef lru_create
Expand Down

0 comments on commit 32ce5cf

Please sign in to comment.