return *ErrorCategory;
}
+/// \brief Print the sample record to the stream \p OS indented by \p Indent.
+void SampleRecord::print(raw_ostream &OS, unsigned Indent) const {
+ OS << NumSamples;
+ if (hasCalls()) {
+ OS << ", calls:";
+ for (const auto &I : getCallTargets())
+ OS << " " << I.first() << ":" << I.second;
+ }
+ OS << "\n";
+}
+
/// \brief Print the samples collected for a function on stream \p OS.
-///
-/// \param OS Stream to emit the output to.
void FunctionSamples::print(raw_ostream &OS, unsigned Indent) const {
OS << TotalSamples << ", " << TotalHeadSamples << ", " << BodySamples.size()
<< " sampled lines\n";
+
for (const auto &SI : BodySamples) {
- LineLocation Loc = SI.first;
- const SampleRecord &Sample = SI.second;
OS.indent(Indent);
- OS << "line offset: " << Loc.LineOffset
- << ", discriminator: " << Loc.Discriminator
- << ", number of samples: " << Sample.getSamples();
- if (Sample.hasCalls()) {
- OS << ", calls:";
- for (const auto &I : Sample.getCallTargets())
- OS << " " << I.first() << ":" << I.second;
- }
- OS << "\n";
+ OS << SI.first << ": " << SI.second;
}
+
for (const auto &CS : CallsiteSamples) {
- CallsiteLocation Loc = CS.first;
- const FunctionSamples &CalleeSamples = CS.second;
OS.indent(Indent);
- OS << "line offset: " << Loc.LineOffset
- << ", discriminator: " << Loc.Discriminator
- << ", inlined callee: " << Loc.CalleeName << ": ";
- CalleeSamples.print(OS, Indent + 2);
+ OS << CS.first << ": ";
+ CS.second.print(OS, Indent + 2);
}
}