[BOLT] Print heatmap from perf2bolt (#139194)
Add perf2bolt `--heatmap` option to produce heatmaps during profile aggregation. Distinguish exclusive mode (`llvm-bolt-heatmap`) and optional mode (`perf2bolt --heatmap`), which impacts perf.data handling: exclusive mode covers all addresses, whereas optional mode consumes attached profile only covering function addresses. Test Plan: updated per2bolt tests: - pre-aggregated-perf.test: pre-aggregated data, - bolt-address-translation-yaml.test: pre-aggregated + BOLTed input, - perf_test.test: no-LBR perf data.
This commit is contained in:
@@ -1453,7 +1453,8 @@ void RewriteInstance::updateRtFiniReloc() {
|
||||
}
|
||||
|
||||
void RewriteInstance::registerFragments() {
|
||||
if (!BC->HasSplitFunctions || opts::HeatmapMode)
|
||||
if (!BC->HasSplitFunctions ||
|
||||
opts::HeatmapMode == opts::HeatmapModeKind::HM_Exclusive)
|
||||
return;
|
||||
|
||||
// Process fragments with ambiguous parents separately as they are typically a
|
||||
@@ -1998,7 +1999,7 @@ Error RewriteInstance::readSpecialSections() {
|
||||
BC->getUniqueSectionByName(BoltAddressTranslation::SECTION_NAME)) {
|
||||
BC->HasBATSection = true;
|
||||
// Do not read BAT when plotting a heatmap
|
||||
if (!opts::HeatmapMode) {
|
||||
if (opts::HeatmapMode != opts::HeatmapModeKind::HM_Exclusive) {
|
||||
if (std::error_code EC = BAT->parse(BC->outs(), BATSec->getContents())) {
|
||||
BC->errs() << "BOLT-ERROR: failed to parse BOLT address translation "
|
||||
"table.\n";
|
||||
@@ -2037,7 +2038,7 @@ Error RewriteInstance::readSpecialSections() {
|
||||
}
|
||||
|
||||
// Force non-relocation mode for heatmap generation
|
||||
if (opts::HeatmapMode)
|
||||
if (opts::HeatmapMode == opts::HeatmapModeKind::HM_Exclusive)
|
||||
BC->HasRelocations = false;
|
||||
|
||||
if (BC->HasRelocations)
|
||||
|
||||
Reference in New Issue
Block a user