runners: Adopted compile-time optional kiwibd as emubd alternative

kiwibd has been used extensively in external benchmarks, it makes sense
to make it the default bd for the bench runner:

- test_runner - defaults to emubd - more testing features
- bench_runner - defaults to kiwibd - lighter-weight disks

The benefit of kiwibd is the disk is just one big blob of RAM, so
basically no overhead. This is important when benchmarking on multi-GiB
disks.

emubd is much heavy, but as a tradeoff can do quite a bit more:
bad-block simulation, wear simulation, snapshotting, etc.

---

In theory the bd used by each runner can be controlled at compile-time
by defining -DBENCH_EMUBD, etc, but I have a feeling no one will ever
use this.
This commit is contained in:
Christopher Haster
2026-01-26 01:56:36 -06:00
parent f07ed90a63
commit ab39a8fde9
6 changed files with 312 additions and 70 deletions
+24
View File
@@ -8,6 +8,23 @@
#define BENCH_RUNNER_H
// default to using kiwibd for benches
#if !defined(BENCH_EMUBD) && !defined(BENCH_KIWIBD)
#define BENCH_KIWIBD
#endif
// ifdef macros for emubd vs kiwibd
#ifdef BENCH_EMUBD
#define BENCH_IFDEF_EMUBD(a, b) (a)
#else
#define BENCH_IFDEF_EMUBD(a, b) (b)
#endif
#ifdef BENCH_KIWIBD
#define BENCH_IFDEF_KIWIBD(a, b) (a)
#else
#define BENCH_IFDEF_KIWIBD(a, b) (b)
#endif
// override LFS3_TRACE
void bench_trace(const char *fmt, ...);
@@ -18,6 +35,7 @@ void bench_trace(const char *fmt, ...);
__VA_ARGS__)
#define LFS3_TRACE(...) LFS3_TRACE_(__VA_ARGS__, "")
#define LFS3_EMUBD_TRACE(...) LFS3_TRACE_(__VA_ARGS__, "")
#define LFS3_KIWIBD_TRACE(...) LFS3_TRACE_(__VA_ARGS__, "")
// BENCH_START/BENCH_STOP macros measure readed/progged/erased bytes
// through emubd
@@ -36,8 +54,14 @@ void bench_fresult(const char *probe, uintmax_t n, double result);
// note these are indirectly included in any generated files
#ifndef BENCH_KIWIBD
#include "bd/lfs3_emubd.h"
#else
#include "bd/lfs3_kiwibd.h"
#endif
#include <stdio.h>
#include <stdint.h>
// give source a chance to define feature macros
#undef _FEATURES_H