runners: Adopted cumulative results in bench probes
Now that csv.py's accumulate/delta functions make it easy to switch between delta/cumulative results, we might as well make the default results consistent. The previous difference between n/bench_runtime vs bench_readed/ bench_simtime risked a lot of confusion. Note we can't use delta results for n, as it doubles as a unique index for each probe measurement. If we want consistency the only option is cumulative results. At least that makes the decision easy.
This commit is contained in:
@@ -584,7 +584,7 @@ benchmarks: $(BENCH_CSV)
|
|||||||
-bprobe='%(case)s+%(probe)s' \
|
-bprobe='%(case)s+%(probe)s' \
|
||||||
-Fi='min(enumerate())' \
|
-Fi='min(enumerate())' \
|
||||||
-fn='max(n)' \
|
-fn='max(n)' \
|
||||||
-ft='float(bench_simtime)/1.0e9' \
|
-ft='max(float(bench_simtime)/1.0e9)' \
|
||||||
-o-) \
|
-o-) \
|
||||||
-bprobe \
|
-bprobe \
|
||||||
-fn \
|
-fn \
|
||||||
@@ -604,13 +604,13 @@ benchmarks-diff: $(BENCH_CSV)
|
|||||||
-bprobe='%(case)s+%(probe)s' \
|
-bprobe='%(case)s+%(probe)s' \
|
||||||
-Fi='min(enumerate())' \
|
-Fi='min(enumerate())' \
|
||||||
-fn='max(n)' \
|
-fn='max(n)' \
|
||||||
-ft='float(bench_simtime)/1.0e9' \
|
-ft='max(float(bench_simtime)/1.0e9)' \
|
||||||
-o-) \
|
-o-) \
|
||||||
-d <(./scripts/csv.py $(BUILDDIR)/lfs3.bench.csv \
|
-d <(./scripts/csv.py $(BUILDDIR)/lfs3.bench.csv \
|
||||||
-bprobe='%(case)s+%(probe)s' \
|
-bprobe='%(case)s+%(probe)s' \
|
||||||
-Fi='min(enumerate())' \
|
-Fi='min(enumerate())' \
|
||||||
-fn='max(n)' \
|
-fn='max(n)' \
|
||||||
-ft='float(bench_simtime)/1.0e9' \
|
-ft='max(float(bench_simtime)/1.0e9)' \
|
||||||
-o-) \
|
-o-) \
|
||||||
-bprobe \
|
-bprobe \
|
||||||
-fthroughput='avg(float(n) / max(t, 1.0e-9))' \
|
-fthroughput='avg(float(n) / max(t, 1.0e-9))' \
|
||||||
@@ -625,7 +625,7 @@ benchmarks-bottlenecks: $(BENCH_CSV)
|
|||||||
-bprobe='%(case)s+%(probe)s' \
|
-bprobe='%(case)s+%(probe)s' \
|
||||||
-Fi='min(enumerate())' \
|
-Fi='min(enumerate())' \
|
||||||
-fn='max(n)' \
|
-fn='max(n)' \
|
||||||
-ft='float(bench_simtime)/1.0e9' \
|
-ft='max(float(bench_simtime)/1.0e9)' \
|
||||||
-fruntime='max(bench_runtime)' \
|
-fruntime='max(bench_runtime)' \
|
||||||
-o-) \
|
-o-) \
|
||||||
-bprobe \
|
-bprobe \
|
||||||
|
|||||||
+64
-31
@@ -833,6 +833,13 @@ void *__wrap_realloc(void *p, size_t size) {
|
|||||||
// bench recording state
|
// bench recording state
|
||||||
typedef struct bench_record {
|
typedef struct bench_record {
|
||||||
const char *probe;
|
const char *probe;
|
||||||
|
bench_io_t cumul_reads;
|
||||||
|
bench_io_t cumul_progs;
|
||||||
|
bench_io_t cumul_erases;
|
||||||
|
bench_io_t cumul_readed;
|
||||||
|
bench_io_t cumul_progged;
|
||||||
|
bench_io_t cumul_erased;
|
||||||
|
bench_ns_t cumul_simtime;
|
||||||
bench_io_t last_reads;
|
bench_io_t last_reads;
|
||||||
bench_io_t last_progs;
|
bench_io_t last_progs;
|
||||||
bench_io_t last_erases;
|
bench_io_t last_erases;
|
||||||
@@ -894,13 +901,31 @@ void bench_start(const char *probe) {
|
|||||||
bench_sns_t simtime = lfs3_kiwibd_simtime(bench_cfg);
|
bench_sns_t simtime = lfs3_kiwibd_simtime(bench_cfg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// allocate a new record
|
// find our record
|
||||||
bench_record_t *record = mappend(
|
bench_record_t *record = NULL;
|
||||||
|
for (size_t i = 0; i < bench_record_count; i++) {
|
||||||
|
if (strcmp(bench_records[i].probe, probe) == 0) {
|
||||||
|
record = &bench_records[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// allocate a new record?
|
||||||
|
if (!record) {
|
||||||
|
record = mappend(
|
||||||
(void**)&bench_records,
|
(void**)&bench_records,
|
||||||
sizeof(bench_record_t),
|
sizeof(bench_record_t),
|
||||||
&bench_record_count,
|
&bench_record_count,
|
||||||
&bench_record_capacity);
|
&bench_record_capacity);
|
||||||
record->probe = probe;
|
record->probe = probe;
|
||||||
|
record->cumul_reads = 0;
|
||||||
|
record->cumul_progs = 0;
|
||||||
|
record->cumul_erases = 0;
|
||||||
|
record->cumul_readed = 0;
|
||||||
|
record->cumul_progged = 0;
|
||||||
|
record->cumul_erased = 0;
|
||||||
|
record->cumul_simtime = 0;
|
||||||
|
}
|
||||||
record->last_reads = reads;
|
record->last_reads = reads;
|
||||||
record->last_progs = progs;
|
record->last_progs = progs;
|
||||||
record->last_erases = erases;
|
record->last_erases = erases;
|
||||||
@@ -960,9 +985,32 @@ void bench_stop(const char *probe, uintmax_t n) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// find our record
|
// find our record
|
||||||
|
bench_record_t *record = NULL;
|
||||||
for (size_t i = 0; i < bench_record_count; i++) {
|
for (size_t i = 0; i < bench_record_count; i++) {
|
||||||
if (strcmp(bench_records[i].probe, probe) == 0) {
|
if (strcmp(bench_records[i].probe, probe) == 0) {
|
||||||
// print results
|
record = &bench_records[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found?
|
||||||
|
if (!record) {
|
||||||
|
fprintf(stderr, "error: probe stopped before it was started (%s)\n",
|
||||||
|
probe);
|
||||||
|
assert(false);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add to cumulative measurements
|
||||||
|
record->cumul_reads += reads - record->last_reads;
|
||||||
|
record->cumul_progs += progs - record->last_progs;
|
||||||
|
record->cumul_erases += erases - record->last_erases;
|
||||||
|
record->cumul_readed += readed - record->last_readed;
|
||||||
|
record->cumul_progged += progged - record->last_progged;
|
||||||
|
record->cumul_erased += erased - record->last_erased;
|
||||||
|
record->cumul_simtime += simtime - record->last_simtime;
|
||||||
|
|
||||||
|
// print probe sample
|
||||||
if (simtime >= 0) {
|
if (simtime >= 0) {
|
||||||
printf("benched %s %jd "
|
printf("benched %s %jd "
|
||||||
"%"PRIu64" %"PRIu64" %"PRIu64" "
|
"%"PRIu64" %"PRIu64" %"PRIu64" "
|
||||||
@@ -970,42 +1018,27 @@ void bench_stop(const char *probe, uintmax_t n) {
|
|||||||
"%"PRIu64"\n",
|
"%"PRIu64"\n",
|
||||||
probe,
|
probe,
|
||||||
n,
|
n,
|
||||||
reads - bench_records[i].last_reads,
|
record->cumul_reads,
|
||||||
progs - bench_records[i].last_progs,
|
record->cumul_progs,
|
||||||
erases - bench_records[i].last_erases,
|
record->cumul_erases,
|
||||||
readed - bench_records[i].last_readed,
|
record->cumul_readed,
|
||||||
progged - bench_records[i].last_progged,
|
record->cumul_progged,
|
||||||
erased - bench_records[i].last_erased,
|
record->cumul_erased,
|
||||||
simtime - bench_records[i].last_simtime);
|
record->cumul_simtime);
|
||||||
} else {
|
} else {
|
||||||
printf("benched %s %jd "
|
printf("benched %s %jd "
|
||||||
"%"PRIu64" %"PRIu64" %"PRIu64" "
|
"%"PRIu64" %"PRIu64" %"PRIu64" "
|
||||||
"%"PRIu64" %"PRIu64" %"PRIu64"\n",
|
"%"PRIu64" %"PRIu64" %"PRIu64"\n",
|
||||||
probe,
|
probe,
|
||||||
n,
|
n,
|
||||||
reads - bench_records[i].last_reads,
|
record->cumul_reads,
|
||||||
progs - bench_records[i].last_progs,
|
record->cumul_progs,
|
||||||
erases - bench_records[i].last_erases,
|
record->cumul_erases,
|
||||||
readed - bench_records[i].last_readed,
|
record->cumul_readed,
|
||||||
progged - bench_records[i].last_progged,
|
record->cumul_progged,
|
||||||
erased - bench_records[i].last_erased);
|
record->cumul_erased);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove our record
|
|
||||||
memmove(&bench_records[i],
|
|
||||||
&bench_records[i+1],
|
|
||||||
bench_record_count-(i+1));
|
|
||||||
bench_record_count -= 1;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// not found?
|
|
||||||
fprintf(stderr, "error: bench stopped before it was started (%s)\n",
|
|
||||||
probe);
|
|
||||||
assert(false);
|
|
||||||
exit(-1);
|
|
||||||
|
|
||||||
done:;
|
done:;
|
||||||
#ifdef BENCH_YES_HEAP
|
#ifdef BENCH_YES_HEAP
|
||||||
BENCH_HEAP_RESUME();
|
BENCH_HEAP_RESUME();
|
||||||
|
|||||||
Reference in New Issue
Block a user