README
¶
benchprof
benchprof analyzes unified-bench profile artifacts (CPU + allocation sections) and emits:
insights.md(human-readable summary)insights.json(machine-friendly summary)insights.html(browser view rendered from markdown)
It emits concrete investigation targets (function + file:line) for each section using
symbol/theme inference (iterator/seek, decode/read I/O, write/delete/flush, locking, alloc/copy, etc.),
so it can adapt as implementations evolve without hardcoding specific function names.
Build
make benchprof
Typical flow
- Run
unified-benchwith profile outputs into one directory.-profile-dirdefaults artifact metadata to-path-label native-fastpath; pass-path-label oraclefor explicit oracle/comparator captures,-path-label m8-m14-10mm-gatefor the #2768+ mandatory span-run gate shape,-path-label span-native-default-gatefor the default span-native production closeout matrix, or-path-label span-native-read-scan-guardrailfor the related settled read/scan guardrail matrix. unified-benchauto-runsbenchprofin-process when-profile-diris enabled. You can still runbenchprofmanually if needed.
Example:
This example uses unified-bench's legacy fast benchmark-runner preset for a
no-WAL profiling ceiling; it is not a TreeDB server profile recommendation.
mkdir -p /tmp/scan-profiles
./bin/unified-bench \
-dbs treedb \
-keys 800000 \
-profile fast \
-checkpoint-between-tests \
-treedb-vlog-compression-variant off \
-test full_scan,prefix_scan \
-profile-dir /tmp/scan-profiles \
-path-label native-fastpath \
-progress=false
./bin/benchprof \
-profiles-dir /tmp/scan-profiles
Outputs:
/tmp/scan-profiles/insights.md/tmp/scan-profiles/insights.json/tmp/scan-profiles/insights.html
insights.html is always generated. For unified-bench -suite collection_storage,
the same command also renders the suite's runs[].collection_workloads metadata
(mode/workload names, correctness and semantic-equivalence flags, asset-byte
splits, and per-workload counters) into a "Collection Workload Metadata" table.
Notes
benchprofcurrently reads:benchprof_results.json(preferred; auto-written byunified-bench -profile-dir)benchprof_results.md(fallback; auto-written byunified-bench -profile-dir)cpu_<test>_<db>.pprof(all test sections)allocs_<test>_<db>.pprof(allocation delta profiles by section; auto-written byunified-bench -profile-dir)block_<test>_<db>.pprof(per-test block contention delta profiles; present when non-empty)mutex_<test>_<db>.pprof(per-test mutex contention delta profiles; present when non-empty)checkpoint_cpu_checkpoint_<test>_<db>.pprof(checkpoint CPU sections)block.pprof/mutex.pprof(global run-level fallback/supplement)trace.out(detected, but not deeply analyzed yet)
benchprof_results.jsonpreserves selected TreeDB stats underruns[].treedb_statswhen the benchmark exposes them. Checkpoint-enabled runs also exposeruns[].checkpoint_durations_seconds, optionalruns[].checkpoint_settle_seconds, and checkpoint-local selected stats underruns[].checkpoint_treedb_stats. This is the raw counter metadata used for TreeDB root-apply/cache review artifacts. For value-log mmap reads, unified-bench selected displays prefer backendtreedb.vlog.mmap_read.*counters over cache-prefixed aliases, and the metadata includes generic plus leaf-specific sealed mmap budget caps when TreeDB exposes them. Parallel-flush M0/M8 artifacts preservetreedb.cache.flush_apply.*,treedb.cache.leaf_log_lanes.*,treedb.cache.flush_span_run.*,treedb.flush_apply.*,treedb.flush_apply.span_run.*, andtreedb.flush_apply.span_native.*counters so planning, leaf-log lane distribution, canonical run shape, old-leaf read/decode bytes/op, leaf merges/op, replacement pages/op, append frames/op, publish prepare/final-install, guarded publish, reducer/publish, checkpoint wait splits, fallback reasons, retry, and foreground-assist stages appear beside CPU/allocation/contention profiles. Value-log codec policy artifacts also preservetreedb.cache.vlog_auto.*,treedb.cache.vlog_write_mode.*,treedb.cache.vlog_payload_kind.*,treedb.cache.vlog_payload_split.*,treedb.cache.vlog_outer_leaf_codec.*, andtreedb.cache.vlog_block.*counters so actual auto codec selection, outer-leaf codec distribution, and frame-K distribution remain available in benchprof output.benchprof_results.jsonalso preserves collection-storage suite metadata underruns[].collection_workloadswhenunified-bench -suite collection_storageis used.benchprofkeeps those stable mode/workload names and semantic comparability fields ininsights.{md,json,html}alongside the CPU/allocation profile summaries.- Optional flags:
-binif you want explicit symbolization target (otherwise profile-only mode is used)-run-mdto force a specific markdown log file for ops/sec parsing-out-htmlto override the default HTML output path
Maintenance Expectations
If unified-bench profile naming, profile-dir defaults, or benchmark test names
change, update benchprof in the same PR:
- filename parsing in
internal/benchprof/main.go - parser tests in
internal/benchprof/main_test.go cmd/unified_bench/profile_artifact_dir_test.goexpectations- this README and
cmd/unified_bench/README.md
Documentation
¶
There is no documentation for this package.