LLVM: lib/ProfileData/SampleProfReader.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "samplepgo-reader"
Enumerations
enum class LineType { CallSiteProfile, BodyProfile, Metadata, VirtualCallTypeProfile }
Functions
static void dumpFunctionProfileJson (const FunctionSamples &S, json::OStream &JOS, bool TopLevel=false)
static bool ParseHead (const StringRef &Input, StringRef &FName, uint64_t &NumSamples, uint64_t &NumHeadSamples)
Parse Input as function head.
static bool isOffsetLegal (unsigned L)
Returns true if line offset L is legal (only has 16 bits).
static bool parseMetadata (const StringRef &Input, uint64_t &FunctionHash, uint32_t &Attributes)
Parse Input that contains metadata.
static bool parseTypeCountMap (StringRef Input, DenseMap< StringRef, uint64_t > &TypeCountMap)
static bool ParseLine (const StringRef &Input, LineType &LineTy, uint32_t &Depth, uint64_t &NumSamples, uint32_t &LineOffset, uint32_t &Discriminator, StringRef &CalleeName, DenseMap< StringRef, uint64_t > &TargetCountMap, DenseMap< StringRef, uint64_t > &TypeCountMap, uint64_t &FunctionHash, uint32_t &Attributes, bool &IsFlat)
Parse Input as line sample.
static std::string getSecFlagsStr (const SecHdrTableEntry &Entry)
static ErrorOr< std::unique_ptr< MemoryBuffer > > setupMemoryBuffer (const Twine &Filename, vfs::FileSystem &FS)
Prepare a memory buffer for the contents of Filename.
Variables
static cl::opt< bool > ProfileIsFSDisciminator ("profile-isfs", cl::Hidden, cl::init(false), cl::desc("Profile uses flow sensitive discriminators"))

DEBUG_TYPE

#define DEBUG_TYPE "samplepgo-reader"

LineType

Enumerator
CallSiteProfile
BodyProfile
Metadata
VirtualCallTypeProfile

Definition at line 196 of file SampleProfReader.cpp.

dumpFunctionProfileJson()

Definition at line 77 of file SampleProfReader.cpp.

References llvm::json::OStream::attribute(), llvm::json::OStream::attributeArray(), dumpFunctionProfileJson(), llvm::sampleprof::FunctionSamples::getBodySamples(), llvm::sampleprof::FunctionSamples::getCallsiteSamples(), llvm::sampleprof::FunctionSamples::getFunction(), llvm::sampleprof::FunctionSamples::getHeadSamples(), llvm::sampleprof::SampleRecord::getSamples(), llvm::sampleprof::SampleRecord::getSortedCallTargets(), llvm::sampleprof::FunctionSamples::getTotalSamples(), I, llvm::json::OStream::object(), and llvm::sampleprof::FunctionId::str().

Referenced by dumpFunctionProfileJson(), and llvm::sampleprof::SampleProfileReader::dumpJson().

getSecFlagsStr()

Definition at line 1552 of file SampleProfReader.cpp.

References llvm::sampleprof::hasSecFlag(), llvm::sampleprof::SecFlagCompress, llvm::sampleprof::SecFlagFixedLengthMD5, llvm::sampleprof::SecFlagFlat, llvm::sampleprof::SecFlagFSDiscriminator, llvm::sampleprof::SecFlagFullContext, llvm::sampleprof::SecFlagHasAttribute, llvm::sampleprof::SecFlagIsPreInlined, llvm::sampleprof::SecFlagIsProbeBased, llvm::sampleprof::SecFlagMD5Name, llvm::sampleprof::SecFlagOrdered, llvm::sampleprof::SecFlagPartial, llvm::sampleprof::SecFlagUniqSuffix, llvm::sampleprof::SecFuncMetadata, llvm::sampleprof::SecFuncOffsetTable, llvm::sampleprof::SecNameTable, and llvm::sampleprof::SecProfSummary.

Referenced by llvm::sampleprof::SampleProfileReaderExtBinaryBase::dumpSectionInfo().

isOffsetLegal()

ParseHead()

ParseLine()

bool ParseLine ( const StringRef & Input, LineType & LineTy, uint32_t & Depth, uint64_t & NumSamples, uint32_t & LineOffset, uint32_t & Discriminator, StringRef & CalleeName, DenseMap< StringRef, uint64_t > & TargetCountMap, DenseMap< StringRef, uint64_t > & TypeCountMap, uint64_t & FunctionHash, uint32_t & Attributes, bool & IsFlat ) static

Parse [Input](classInput.html "The Input class is used to parse a yaml document into in-memory structs and vectors.") as line sample.

Parameters

Input input line.
LineTy Type of this line.
Depth the depth of the inline stack.
NumSamples total samples of the line/inlined callsite.
LineOffset line offset to the start of the function.
Discriminator discriminator of the line.
TargetCountMap map from indirect call target to count.
FunctionHash the function's CFG hash, used by pseudo probe.

returns true if parsing is successful.

Definition at line 243 of file SampleProfReader.cpp.

References BodyProfile, CallSiteProfile, llvm::count(), llvm::Depth, llvm::StringRef::find(), llvm::StringRef::find_first_not_of(), llvm::StringRef::find_first_of(), llvm::StringRef::find_last_of(), llvm::StringRef::getAsInteger(), llvm::isDigit(), isOffsetLegal(), llvm::sampleprof::kVTableProfPrefix, Metadata, llvm::StringRef::npos, parseMetadata(), parseTypeCountMap(), llvm::StringRef::size(), llvm::StringRef::starts_with(), llvm::StringRef::substr(), and VirtualCallTypeProfile.

Referenced by llvm::sampleprof::SampleProfileReaderText::readImpl().

parseMetadata()

parseTypeCountMap()

setupMemoryBuffer()

ProfileIsFSDisciminator

cl::opt< bool > ProfileIsFSDisciminator("profile-isfs", cl::Hidden, cl::init(false), cl::desc("Profile uses flow sensitive discriminators")) ( "profile-isfs" , cl::Hidden , cl::init(false) , cl::desc("Profile uses flow sensitive discriminators") ) static