diff options
author | Rahman Lavaee <rahmanl@google.com> | 2022-04-25 21:32:13 +0300 |
---|---|---|
committer | Rahman Lavaee <rahmanl@google.com> | 2022-04-25 21:39:44 +0300 |
commit | e59e580116b055bd2057de0da5cc35fffd16a590 (patch) | |
tree | 7c1c0a34f84e8d97e6d05381eb3c460b4deb8a86 /bolt | |
parent | 408bb9a375ac9f69816823f99cf0a64c1ee8a931 (diff) |
[BOLT] Refactor DataAggregator::printLBRHeatMap.
This also fixes some logs that were impacted by D123067.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D124281
Diffstat (limited to 'bolt')
-rw-r--r-- | bolt/lib/Profile/DataAggregator.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp index 5b7853ee2b25..7992daaa9360 100644 --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -1295,8 +1295,8 @@ std::error_code DataAggregator::printLBRHeatMap() { opts::HeatmapMaxAddress); uint64_t NumTotalSamples = 0; - while (hasData()) { - if (opts::BasicAggregation) { + if (opts::BasicAggregation) { + while (hasData()) { ErrorOr<PerfBasicSample> SampleRes = parseBasicSample(); if (std::error_code EC = SampleRes.getError()) { if (EC == errc::no_such_process) @@ -1306,7 +1306,10 @@ std::error_code DataAggregator::printLBRHeatMap() { PerfBasicSample &Sample = SampleRes.get(); HM.registerAddress(Sample.PC); NumTotalSamples++; - } else { + } + outs() << "HEATMAP: read " << NumTotalSamples << " basic samples\n"; + } else { + while (hasData()) { ErrorOr<PerfBranchSample> SampleRes = parseBranchSample(); if (std::error_code EC = SampleRes.getError()) { if (EC == errc::no_such_process) @@ -1334,23 +1337,22 @@ std::error_code DataAggregator::printLBRHeatMap() { } NumTotalSamples += Sample.LBR.size(); } + outs() << "HEATMAP: read " << NumTotalSamples << " LBR samples\n"; + outs() << "HEATMAP: " << FallthroughLBRs.size() << " unique traces\n"; } if (!NumTotalSamples) { - if (!opts::BasicAggregation) { + if (opts::BasicAggregation) { + errs() << "HEATMAP-ERROR: no basic event samples detected in profile. " + "Cannot build heatmap."; + } else { errs() << "HEATMAP-ERROR: no LBR traces detected in profile. " "Cannot build heatmap. Use -nl for building heatmap from " "basic events.\n"; - } else { - errs() << "HEATMAP-ERROR: no samples detected in profile. " - "Cannot build heatmap."; } exit(1); } - outs() << "HEATMAP: read " << NumTotalSamples << " LBR samples\n"; - outs() << "HEATMAP: " << FallthroughLBRs.size() << " unique traces\n"; - outs() << "HEATMAP: building heat map...\n"; for (const auto &LBR : FallthroughLBRs) { |