[llvm] r253612 - SamplePGO - Tweak debugging output for function samples. NFC.

Diego Novillo via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 14:18:30 PST 2015


Author: dnovillo
Date: Thu Nov 19 16:18:30 2015
New Revision: 253612

URL: http://llvm.org/viewvc/llvm-project?rev=253612&view=rev
Log:
SamplePGO - Tweak debugging output for function samples. NFC.

Modified:
    llvm/trunk/lib/ProfileData/SampleProf.cpp

Modified: llvm/trunk/lib/ProfileData/SampleProf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/SampleProf.cpp?rev=253612&r1=253611&r2=253612&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/SampleProf.cpp (original)
+++ llvm/trunk/lib/ProfileData/SampleProf.cpp Thu Nov 19 16:18:30 2015
@@ -108,18 +108,33 @@ void FunctionSamples::print(raw_ostream
   OS << TotalSamples << ", " << TotalHeadSamples << ", " << BodySamples.size()
      << " sampled lines\n";
 
-  SampleSorter<LineLocation, SampleRecord> SortedBodySamples(BodySamples);
-  for (const auto &SI : SortedBodySamples.get()) {
+  OS.indent(Indent);
+  if (BodySamples.size() > 0) {
+    OS << "Samples collected in the function's body {\n";
+    SampleSorter<LineLocation, SampleRecord> SortedBodySamples(BodySamples);
+    for (const auto &SI : SortedBodySamples.get()) {
+      OS.indent(Indent + 2);
+      OS << SI->first << ": " << SI->second;
+    }
     OS.indent(Indent);
-    OS << SI->first << ": " << SI->second;
+    OS << "}\n";
+  } else {
+    OS << "No samples collected in the function's body\n";
   }
 
-  SampleSorter<CallsiteLocation, FunctionSamples> SortedCallsiteSamples(
-      CallsiteSamples);
-  for (const auto &CS : SortedCallsiteSamples.get()) {
-    OS.indent(Indent);
-    OS << CS->first << ": ";
-    CS->second.print(OS, Indent + 2);
+  OS.indent(Indent);
+  if (CallsiteSamples.size() > 0) {
+    OS << "Samples collected in inlined callsites {\n";
+    SampleSorter<CallsiteLocation, FunctionSamples> SortedCallsiteSamples(
+        CallsiteSamples);
+    for (const auto &CS : SortedCallsiteSamples.get()) {
+      OS.indent(Indent + 2);
+      OS << CS->first << ": ";
+      CS->second.print(OS, Indent + 4);
+    }
+    OS << "}\n";
+  } else {
+    OS << "No inlined callsites in this function\n";
   }
 }
 




More information about the llvm-commits mailing list