scripts: csv.py: Added -H/--hlabel and --tlabel

These are useful for customizing the table renderer's header and total
labels:

  ./scripts/csv.py test.csv -ba -fc \
      -Hc='c(MiB/s)' \
      --tlabel='wow so many (%(c)s)'
  a                   c(MiB/s)
  x                          6
  wow so many (6)            6

In theory header labels could be controlled by the field names
themselves, but our use of Python's namedtuples internal is quite
limiting.

The immediate use case is -Hprobe=bench+probe in the bench-related
rules, but it may also be useful for adding units such as in the above
example.

---

I considered adding these to all csv scripts, but decided that was too
much. punescape modifiers are probably a good line for what should be
limited to csv.py.
This commit is contained in:
Christopher Haster
2026-02-06 19:05:22 -06:00
parent 8bbddd3500
commit 2cf87dedb4
10 changed files with 219 additions and 139 deletions
+5
View File
@@ -609,6 +609,7 @@ bench-marks: $(BENCH_CSV)
-ft='max(float(bench_simtime)/1.0e9)' \
-o-) \
-bprobe \
-Hprobe=bench+probe \
-fn \
-ft \
-fthroughput='avg(float(n) / max(t, 1.0e-9))' \
@@ -641,6 +642,7 @@ bench-marks-diff: $(BENCH_CSV)
-ft='max(float(bench_simtime)/1.0e9)' \
-o-) \
-bprobe \
-Hprobe=bench+probe \
-fthroughput='avg(float(n) / max(t, 1.0e-9))' \
$(SUMMARYFLAGS))
@@ -660,6 +662,7 @@ bench-bottlenecks: $(BENCH_CSV)
-fruntime='max(bench_runtime)' \
-o-) \
-bprobe \
-Hprobe=bench+probe \
-fn \
-ft \
-fruntime \
@@ -674,6 +677,7 @@ bench-ops: $(BENCH_CSV)
commit,namelookup,$\
write,stat,read \
-bprobe='%(case)s+%(probe)s' \
-Hprobe=bench+probe \
-Fi='min(enumerate())' \
-freads='bench_reads' \
-fprogs='bench_progs' \
@@ -692,6 +696,7 @@ bench-widths: $(BENCH_CSV)
commit,namelookup,$\
write,stat,read \
-bprobe='%(case)s+%(probe)s' \
-Hprobe=bench+probe \
-Fi='min(enumerate())' \
-freaded="avg(saturate(ffrac( \
float(bench_readed)/float(bench_reads), \