Files
littlefs/benches
Christopher Haster 1a98d8089b benches: Reworked bench_rt to fail gracefully
This reworks bench_rt to write the target file gradually, mixing reads
and writes. This makes it so if the benchmark times out, the results are
still interesting, if less rigorous.

This is useful if you want to compare a change quickly, with more
SIM_TIME leading to a more accurate result.

---

The problem for bench_rt is that we first need to write a file. This can
take _quite_ a while for large SIM_TIME, completely failing in some
cases (bench_rt_many + BENCH_NAND).

The nice thing about bench_wt is that when it fails you still get
interesting numbers out of it. You don't find the relevant throughput
for the given SIZE, but you do find throughput for files _approaching_
SIZE. Unfortunately this didn't carry over to bench_rt.

The good news is the new bench probe system makes it easy to selectively
ignore parts of each bench, so we can rework bench_rt to start with a
CHUNK sized file and gradually increase it until it hits our target
size. This allows bench_rt to also fail gracefully.

Consider a 1 minute run:

  $ make bench-runner -j \
      && BENCHFLAGS='bench_rt -DSIM_TIME=60000000000' make bench -j \
      && make bench-marks
  bench+probe                            n       t  throughput
  bench_rt_seq+read                 302848     0.0  30690155.6
  bench_rt_random+read              302592     0.0  59646605.2
  bench_rt_logging+read              52992     5.9      8915.0
  bench_rt_many+read                112896     0.2    482831.6
  TOTAL                             771328     6.2  22707126.8

Vs the default 1 hour run:

  $ make bench-runner -j \
      && BENCHFLAGS='bench_rt' make bench -j \
      && make bench-marks
  bench+probe                            n       t  throughput
  bench_rt_seq+read            79600038272  3325.1  23939212.7
  bench_rt_random+read         21482635264  3325.0   6461004.1
  bench_rt_logging+read            3085056   740.9      4163.9
  bench_rt_many+read             706571904  1800.7    392380.4
  TOTAL                       101792330496  9191.7   7699190.3

The main risk of doing this is cross-contaminating read results with
write operations. Fortunately the current benches appear to be isolated
well enough:

  $ make bench-ops
  bench+probe                       readed     progged      erased
  bench_rt_logging+read           86886137    18936138    19767296
  bench_rt_seq+read            83127251476           0           0
  bench_rt_many+read           45018292401           0           0
  bench_rt_random+read         83124213669           0           0
  TOTAL                       211356643683    18936138    19767296

---

Oh! This also lets us add bench_rt_logging, which needs a mixed writer
to make any sense.

Note bench_rt_logging also includes popping from the log (fifo?), so is
not a strictly read-only bench.
2026-03-09 22:55:31 -05:00
..