runners: bench: Renamed bench m -> probe

This needed a different name, and "bench probe" is sort of reminiscent
of the "debug probes" you can use to measure things in the real world.

Maybe this is just my embedded engineering background poking through,
but honestly anything is better than a single char m, especially for a
non-integer field.
This commit is contained in:
Christopher Haster
2026-01-24 05:25:31 -06:00
parent fe93d62523
commit f07ed90a63
3 changed files with 25 additions and 25 deletions
+12 -12
View File
@@ -602,7 +602,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size) {
// bench recording state
typedef struct bench_record {
const char *m;
const char *probe;
lfs3_emubd_io_t last_reads;
lfs3_emubd_io_t last_progs;
lfs3_emubd_io_t last_erases;
@@ -622,7 +622,7 @@ void bench_reset(struct lfs3_cfg *cfg) {
bench_record_count = 0;
}
void bench_start(const char *m) {
void bench_start(const char *probe) {
// measure current read/prog/erase
assert(bench_cfg);
lfs3_emubd_sio_t reads = lfs3_emubd_reads(bench_cfg);
@@ -646,7 +646,7 @@ void bench_start(const char *m) {
sizeof(bench_record_t),
&bench_record_count,
&bench_record_capacity);
record->m = m;
record->probe = probe;
record->last_reads = reads;
record->last_progs = progs;
record->last_erases = erases;
@@ -656,7 +656,7 @@ void bench_start(const char *m) {
record->last_simtime = simtime;
}
void bench_stop(const char *m, uintmax_t n) {
void bench_stop(const char *probe, uintmax_t n) {
// measure current read/prog/erase
assert(bench_cfg);
lfs3_emubd_sio_t reads = lfs3_emubd_reads(bench_cfg);
@@ -676,14 +676,14 @@ void bench_stop(const char *m, uintmax_t n) {
// find our record
for (size_t i = 0; i < bench_record_count; i++) {
if (strcmp(bench_records[i].m, m) == 0) {
if (strcmp(bench_records[i].probe, probe) == 0) {
// print results
if (simtime >= 0) {
printf("benched %s %jd "
"%"PRIu64" %"PRIu64" %"PRIu64" "
"%"PRIu64" %"PRIu64" %"PRIu64" "
"%"PRIu64"\n",
m,
probe,
n,
reads - bench_records[i].last_reads,
progs - bench_records[i].last_progs,
@@ -696,7 +696,7 @@ void bench_stop(const char *m, uintmax_t n) {
printf("benched %s %jd "
"%"PRIu64" %"PRIu64" %"PRIu64" "
"%"PRIu64" %"PRIu64" %"PRIu64"\n",
m,
probe,
n,
reads - bench_records[i].last_reads,
progs - bench_records[i].last_progs,
@@ -717,23 +717,23 @@ void bench_stop(const char *m, uintmax_t n) {
// not found?
fprintf(stderr, "error: bench stopped before it was started (%s)\n",
m);
probe);
assert(false);
exit(-1);
}
void bench_result(const char *m, uintmax_t n, uintmax_t result) {
void bench_result(const char *probe, uintmax_t n, uintmax_t result) {
// we just print these directly
printf("benched %s %jd %"PRIu64"\n",
m,
probe,
n,
result);
}
void bench_fresult(const char *m, uintmax_t n, double result) {
void bench_fresult(const char *probe, uintmax_t n, double result) {
// we just print these directly
printf("benched %s %jd %.6f\n",
m,
probe,
n,
result);
}
+9 -9
View File
@@ -19,20 +19,20 @@ void bench_trace(const char *fmt, ...);
#define LFS3_TRACE(...) LFS3_TRACE_(__VA_ARGS__, "")
#define LFS3_EMUBD_TRACE(...) LFS3_TRACE_(__VA_ARGS__, "")
// BENCH_START/BENCH_STOP macros measure readed/proged/erased bytes
// BENCH_START/BENCH_STOP macros measure readed/progged/erased bytes
// through emubd
void bench_start(const char *m);
void bench_stop(const char *m, uintmax_t n);
void bench_start(const char *probe);
void bench_stop(const char *probe, uintmax_t n);
#define BENCH_START(m) bench_start(m)
#define BENCH_STOP(m, n) bench_stop(m, n)
#define BENCH_START(probe) bench_start(probe)
#define BENCH_STOP(probe, n) bench_stop(probe, n)
// BENCH_RESULT/BENCH_FRESULT allow for explicit non-io measurements
void bench_result(const char *m, uintmax_t n, uintmax_t result);
void bench_fresult(const char *m, uintmax_t n, double result);
void bench_result(const char *probe, uintmax_t n, uintmax_t result);
void bench_fresult(const char *probe, uintmax_t n, double result);
#define BENCH_RESULT(m, n, result) bench_result(m, n, result)
#define BENCH_FRESULT(m, n, result) bench_fresult(m, n, result)
#define BENCH_RESULT(probe, n, result) bench_result(probe, n, result)
#define BENCH_FRESULT(probe, n, result) bench_fresult(probe, n, result)
// note these are indirectly included in any generated files
+4 -4
View File
@@ -1092,7 +1092,7 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
'|' '(?P<path>[^:]+):(?P<lineno>\d+):(?P<op_>assert):'
' *(?P<message>.*)'
'|' '(?P<op__>benched)'
' (?P<m>[^\s]+)'
' (?P<probe>[^\s]+)'
' (?P<n>\d+)'
'(?:'
'(?:'
@@ -1185,7 +1185,7 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
if args.get('keep_going'):
proc.kill()
elif op == 'benched':
m_ = m.group('m')
probe_ = m.group('probe')
n_ = int(m.group('n'))
# parse measurements
def dat(v):
@@ -1214,7 +1214,7 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
'suite': last_suite,
'case': last_case,
**last_defines,
'm': m_,
'probe': probe_,
'n': n_,
'bench_reads': reads_,
'bench_progs': progs_,
@@ -1401,7 +1401,7 @@ def run(runner, bench_ids=[], **args):
output = BenchOutput(args['output'],
['suite', 'case'],
# defines go here
['m', 'n',
['probe', 'n',
'bench_reads',
'bench_progs',
'bench_erases',