19 using namespace llvm::sampleprof;
27 const char *
name()
const noexcept
override {
return "llvm.sampleprof"; }
28 std::string message(
int IE)
const override {
34 return "Invalid sample profile data (bad magic)";
36 return "Unsupported sample profile format version";
38 return "Too much profile data";
40 return "Truncated profile data";
42 return "Malformed sample profile data";
44 return "Unrecognized sample profile encoding format";
46 return "Profile encoding format unsupported for writing operations";
48 return "Truncated function name table";
50 return "Unimplemented feature";
52 return "Counter overflow";
67 if (Discriminator > 0)
68 OS <<
"." << Discriminator;
84 for (
const auto &
I : getCallTargets())
85 OS <<
" " <<
I.first() <<
":" <<
I.second;
100 OS << TotalSamples <<
", " << TotalHeadSamples <<
", " << BodySamples.size()
101 <<
" sampled lines\n";
104 if (BodySamples.size() > 0) {
105 OS <<
"Samples collected in the function's body {\n";
107 for (
const auto &
SI : SortedBodySamples.
get()) {
109 OS <<
SI->first <<
": " <<
SI->second;
114 OS <<
"No samples collected in the function's body\n";
118 if (CallsiteSamples.size() > 0) {
119 OS <<
"Samples collected in inlined callsites {\n";
122 for (
const auto &CS : SortedCallsiteSamples.
get()) {
124 OS << CS->first <<
": inlined callee: " << CS->second.getName() <<
": ";
125 CS->second.print(OS, Indent + 4);
129 OS <<
"No inlined callsites in this function\n";
raw_ostream & operator<<(raw_ostream &OS, const LineLocation &Loc)
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Representation of the samples collected for a function.
Representation of a single sample record.
const SamplesWithLocList & get() const
Sort a LocationT->SampleT map by LocationT.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
void print(raw_ostream &OS=dbgs(), unsigned Indent=0) const
Print the samples collected for a function on stream OS.
static ManagedStatic< _object_error_category > error_category
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const std::error_category & sampleprof_category()
static ManagedStatic< SampleProfErrorCategoryType > ErrorCategory
void print(raw_ostream &OS) const
Represents the relative location of an instruction.
This class implements an extremely fast bulk output stream that can only output to a stream...
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
void print(raw_ostream &OS, unsigned Indent) const
Print the sample record to the stream OS indented by Indent.