summaryrefslogtreecommitdiff
path: root/lib/ProfileData
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2015-11-19 22:18:30 +0000
committerDiego Novillo <dnovillo@google.com>2015-11-19 22:18:30 +0000
commit8003b38f2752a07dd5012f55b7496239bee9ee1b (patch)
treebd048b0022508916aa0505fc892c93c33c944b2a /lib/ProfileData
parent3f1dbfd35ddc34f967b87cbc48ab69dcc929a2f3 (diff)
SamplePGO - Tweak debugging output for function samples. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ProfileData')
-rw-r--r--lib/ProfileData/SampleProf.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/lib/ProfileData/SampleProf.cpp b/lib/ProfileData/SampleProf.cpp
index c376a8bbd98..1b76367f4de 100644
--- a/lib/ProfileData/SampleProf.cpp
+++ b/lib/ProfileData/SampleProf.cpp
@@ -108,18 +108,33 @@ void FunctionSamples::print(raw_ostream &OS, unsigned Indent) const {
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";
}
}