[PATCH] D124281: [BOLT] Refactor DataAggregator::printLBRHeatMap.

Rahman Lavaee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 11:40:03 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe59e580116b0: [BOLT] Refactor DataAggregator::printLBRHeatMap. (authored by rahmanl).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124281/new/

https://reviews.llvm.org/D124281

Files:
  bolt/lib/Profile/DataAggregator.cpp


Index: bolt/lib/Profile/DataAggregator.cpp
===================================================================
--- bolt/lib/Profile/DataAggregator.cpp
+++ bolt/lib/Profile/DataAggregator.cpp
@@ -1295,8 +1295,8 @@
              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 @@
       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 @@
       }
       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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124281.424988.patch
Type: text/x-patch
Size: 2046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220425/dcd4a85f/attachment.bin>


More information about the llvm-commits mailing list