22 #include <system_error>
25 using namespace sampleprof;
33 const char *
name()
const noexcept
override {
return "llvm.sampleprof"; }
35 std::string message(
int IE)
const override {
41 return "Invalid sample profile data (bad magic)";
43 return "Unsupported sample profile format version";
45 return "Too much profile data";
47 return "Truncated profile data";
49 return "Malformed sample profile data";
51 return "Unrecognized sample profile encoding format";
53 return "Profile encoding format unsupported for writing operations";
55 return "Truncated function name table";
57 return "Unimplemented feature";
59 return "Counter overflow";
85 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
95 OS <<
" " <<
I.first() <<
":" <<
I.second;
100 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
112 OS << TotalSamples <<
", " << TotalHeadSamples <<
", " << BodySamples.size()
113 <<
" sampled lines\n";
116 if (!BodySamples.empty()) {
117 OS <<
"Samples collected in the function's body {\n";
119 for (
const auto &
SI : SortedBodySamples.
get()) {
121 OS <<
SI->first <<
": " <<
SI->second;
126 OS <<
"No samples collected in the function's body\n";
130 if (!CallsiteSamples.empty()) {
131 OS <<
"Samples collected in inlined callsites {\n";
134 for (
const auto &CS : SortedCallsiteSamples.
get()) {
135 for (
const auto &FS : CS->second) {
137 OS << CS->first <<
": inlined callee: " << FS.second.getName() <<
": ";
138 FS.second.print(OS, Indent + 4);
143 OS <<
"No inlined callsites in this function\n";
153 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
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.
const CallTargetMap & getCallTargets() const
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.
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
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
bool hasCalls() const
Return true if this sample record contains function calls.
llvm_unreachable("Unknown RegBank!")
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.