runners: bench: Added BENCH_SIMTIME/SIMRESET/PAUSE/RESUME/etc

- BENCH_SIMTIME()   => lfs3_kiwibd_simtime()
- BENCH_SIMRESET()  => lfs3_kiwibd_simreset()
- BENCH_SIMPAUSE()  => lfs3_kiwibd_simpause()
- BENCH_SIMRESUME() => lfs3_kiwibd_simresume()
- BENCH_RESET()     => lfs3_kiwibd_simreset() + BENCH_STACK/HEAP_RESET()
- BENCH_PAUSE()     => lfs3_kiwibd_simpause() + BENCH_STACK/HEAP_PAUSE()
- BENCH_RESUME()    => lfs3_kiwibd_simresume() + BENCH_STACK/HEAP_RESUME()

This does two things:

1. Adds pause/resume counters to bd counters to make it easier to
   exclude operations from the current bench (potentially useful for
   seq+disk usage).

2. Exposes bd simtime operations as BENCH_* macros, to make it a bit
   easier to interact with simtime without tying all the benches to
   kiwibd. (Not that we'll ever probably not use kiwibd, but still).

Also adopted 32-bit counters for stack/heap pause state instead of a
32-bit stack. Not that either are at a risk of overflowing, but better
safe than sorry.
This commit is contained in:
Christopher Haster
2026-02-07 20:02:26 -06:00
parent f62d91c9b5
commit 10e77d9177
12 changed files with 325 additions and 119 deletions
-12
View File
@@ -10,9 +10,6 @@
// this writes a 1 block file 2*block_count times to get it into a good
// state for benchmarking
int bench_helpers_warmup(lfs3_t *lfs3) {
BENCH_STACK_PAUSE();
BENCH_HEAP_PAUSE();
uint8_t *wbuf = malloc(BLOCK_SIZE);
memset(wbuf, '1', BLOCK_SIZE);
@@ -29,18 +26,12 @@ int bench_helpers_warmup(lfs3_t *lfs3) {
lfs3_remove(lfs3, "warmup") => 0;
free(wbuf);
BENCH_HEAP_RESUME();
BENCH_STACK_RESUME();
return 0;
}
// find tight disk usage
uintmax_t bench_helpers_usage(lfs3_t *lfs3) {
BENCH_STACK_PAUSE();
BENCH_HEAP_PAUSE();
// measure disk usage
//
// littlefs can be a dag, so build a bitmap to find the exact
@@ -70,9 +61,6 @@ uintmax_t bench_helpers_usage(lfs3_t *lfs3) {
}
free(usage_bmap);
BENCH_HEAP_RESUME();
BENCH_STACK_RESUME();
return (uintmax_t)usage * (uintmax_t)BLOCK_SIZE;
}