[BOLT][heatmap] Produce zoomed-out heatmaps (#140153)

Add a capability to produce multiple heatmaps with given bucket sizes.

The default heatmap block size (64B) could be too fine-grained for
large binaries. Extend the option `block-size` to accept a list of
bucket sizes for additional heatmaps with coarser granularity. The
heatmap is simply rescaled so provided sizes should be multiples of
each other. Human-readable suffixes can be used, e.g. 4K, 16kb, 1MiB.

New defaults: 64B (base bucket size), 4KB (default page size),
256KB (for large binaries).

Test Plan: updated heatmap-preagg.test
This commit is contained in:
Amir Ayupov
2025-05-30 16:20:19 -07:00
committed by GitHub
parent f1886b1d6d
commit 5047a33cd8
8 changed files with 166 additions and 10 deletions

View File

@@ -59,7 +59,26 @@ static std::string GetExecutablePath(const char *Argv0) {
int main(int argc, char **argv) {
cl::HideUnrelatedOptions(ArrayRef(opts::HeatmapCategories));
cl::ParseCommandLineOptions(argc, argv, "");
cl::ParseCommandLineOptions(
argc, argv,
" BOLT Code Heatmap tool\n\n"
" Produces code heatmaps using sampled profile\n\n"
" Inputs:\n"
" - Binary (supports BOLT-optimized binaries),\n"
" - Sampled profile collected from the binary:\n"
" - perf data or pre-aggregated profile data (instrumentation profile "
"not supported)\n"
" - perf data can have basic (IP) or branch-stack (LBR) samples\n\n"
" Outputs:\n"
" - Heatmaps: colored ASCII (requires a color-capable terminal or a"
" conversion tool like `aha`)\n"
" Multiple heatmaps are produced by default with different "
"granularities (set by `block-size` option)\n"
" - Section hotness: per-section samples% and utilization%\n"
" - Cumulative distribution: working set size corresponding to a "
"given percentile of samples\n");
if (opts::PerfData.empty()) {
errs() << ToolName << ": expected -perfdata=<filename> option.\n";