|
LLVM 24.0.0git
|
Representation of the samples collected for a function. More...
#include "llvm/ProfileData/SampleProf.h"
Public Member Functions | |
| FunctionSamples ()=default | |
| LLVM_ABI void | print (raw_ostream &OS=dbgs(), unsigned Indent=0) const |
Print the samples collected for a function on stream OS. | |
| LLVM_ABI void | dump () const |
| sampleprof_error | addTotalSamples (uint64_t Num, uint64_t Weight=1) |
| void | removeTotalSamples (uint64_t Num) |
| void | setTotalSamples (uint64_t Num) |
| void | setHeadSamples (uint64_t Num) |
| sampleprof_error | addHeadSamples (uint64_t Num, uint64_t Weight=1) |
| sampleprof_error | addBodySamples (uint32_t LineOffset, uint32_t Discriminator, uint64_t Num, uint64_t Weight=1) |
| sampleprof_error | addCalledTargetSamples (uint32_t LineOffset, uint32_t Discriminator, FunctionId Func, uint64_t Num, uint64_t Weight=1) |
| sampleprof_error | addSampleRecord (LineLocation Location, const SampleRecord &SampleRecord, uint64_t Weight=1) |
| void | reserveBodySamples (size_t NumEntries) |
| void | reserveCallsiteTypeCounts (size_t NumEntries) |
| uint64_t | removeCalledTargetAndBodySample (uint32_t LineOffset, uint32_t Discriminator, FunctionId Func) |
| void | removeAllCallsiteSamples () |
| void | updateCallsiteSamples () |
| void | updateTotalSamples () |
| void | setContextSynthetic () |
| void | setContextAttribute (ContextAttributeMask Attr) |
| const LineLocation & | mapIRLocToProfileLoc (const LineLocation &IRLoc) const |
| ErrorOr< uint64_t > | findSamplesAt (uint32_t LineOffset, uint32_t Discriminator) const |
| Return the number of samples collected at the given location. | |
| ErrorOr< const SampleRecord::CallTargetMap & > | findCallTargetMapAt (uint32_t LineOffset, uint32_t Discriminator) const LLVM_LIFETIME_BOUND |
| Returns the call target map collected at a given location. | |
| ErrorOr< const SampleRecord::CallTargetMap & > | findCallTargetMapAt (const LineLocation &CallSite) const LLVM_LIFETIME_BOUND |
Returns the call target map collected at a given location specified by CallSite. | |
| FunctionSamplesMap & | functionSamplesAt (const LineLocation &Loc) LLVM_LIFETIME_BOUND |
| Return the function samples at the given callsite location. | |
| const FunctionSamplesMap * | findFunctionSamplesMapAt (const LineLocation &Loc) const LLVM_LIFETIME_BOUND |
Returns the FunctionSamplesMap at the given Loc. | |
| const TypeCountMap * | findCallsiteTypeSamplesAt (const LineLocation &Loc) const LLVM_LIFETIME_BOUND |
Returns the TypeCountMap for inlined callsites at the given Loc. | |
| LLVM_ABI const FunctionSamples * | findFunctionSamplesAt (const LineLocation &Loc, StringRef CalleeName, SampleProfileReaderItaniumRemapper *Remapper, const HashKeyMap< DenseMap, FunctionId, FunctionId > *FuncNameToProfNameMap=nullptr) const LLVM_LIFETIME_BOUND |
Returns a pointer to FunctionSamples at the given callsite location Loc with callee CalleeName. | |
| bool | empty () const |
| uint64_t | getTotalSamples () const |
| Return the total number of samples collected inside the function. | |
| uint64_t | getHeadSamples () const |
| For top-level functions, return the total number of branch samples that have the function as the branch target (or 0 otherwise). | |
| uint64_t | getHeadSamplesEstimate () const |
| Return an estimate of the sample count of the function entry basic block. | |
| const BodySampleMap & | getBodySamples () const LLVM_LIFETIME_BOUND |
| Return all the samples collected in the body of the function. | |
| const CallsiteSampleMap & | getCallsiteSamples () const LLVM_LIFETIME_BOUND |
| Return all the callsite samples collected in the body of the function. | |
| bool | hasCallsiteSamples () const |
| Return whether this function profile contains callsite samples. | |
| const CallsiteTypeMap & | getCallsiteTypeCounts () const LLVM_LIFETIME_BOUND |
| Returns vtable access samples for the C++ types collected in this function. | |
| TypeCountMap & | getTypeSamplesAt (const LineLocation &Loc) LLVM_LIFETIME_BOUND |
Returns the vtable access samples for the C++ types for Loc. | |
| sampleprof_error | addTypeSamplesAt (const LineLocation &Loc, FunctionId Type, uint64_t Count) |
At location Loc, add a type sample for the given Type with Count. | |
| template<typename T> | |
| sampleprof_error | addCallsiteVTableTypeProfAt (const LineLocation &Loc, const T &Other, uint64_t Weight=1) |
Scale Other sample counts by Weight and add the scaled result to the type samples for Loc. | |
| uint64_t | getMaxCountInside (bool SkipCallSite=false) const |
| Return the maximum of sample counts in a function body. | |
| sampleprof_error | merge (const FunctionSamples &Other, uint64_t Weight=1) |
Merge the samples in Other into this one. | |
| void | findInlinedFunctions (DenseSet< GlobalValue::GUID > &S, const HashKeyMap< DenseMap, FunctionId, Function * > &SymbolMap, uint64_t Threshold) const |
Recursively traverses all children, if the total sample count of the corresponding function is no less than Threshold, add its corresponding GUID to S. | |
| void | setFunction (FunctionId NewFunctionID) |
| Set the name of the function. | |
| FunctionId | getFunction () const |
| Return the function name. | |
| StringRef | getFuncName () const |
| Return the original function name. | |
| void | setFunctionHash (uint64_t Hash) |
| uint64_t | getFunctionHash () const |
| void | setIRToProfileLocationMap (const LocToLocMap *LTLM) |
| StringRef | getFuncName (FunctionId Func) const |
Translate Func into its original name. | |
| LLVM_ABI const FunctionSamples * | findFunctionSamples (const DILocation *DIL, SampleProfileReaderItaniumRemapper *Remapper=nullptr, const HashKeyMap< DenseMap, FunctionId, FunctionId > *FuncNameToProfNameMap=nullptr) const LLVM_LIFETIME_BOUND |
| Get the FunctionSamples of the inline instance where DIL originates from. | |
| SampleContext & | getContext () const LLVM_LIFETIME_BOUND |
| void | setContext (const SampleContext &FContext) |
| uint64_t | getGUID () const |
| Return the GUID of the context's name. | |
| LLVM_ABI void | findAllNames (DenseSet< FunctionId > &NameSet) const |
| bool | operator== (const FunctionSamples &Other) const |
| bool | operator!= (const FunctionSamples &Other) const |
Static Public Member Functions | |
| static StringRef | getCanonicalFnName (const Function &F) |
| Return the canonical name for a function, taking into account suffix elision policy attributes. | |
| static StringRef | getCanonicalFnName (StringRef FnName, StringRef Attr="selected") |
| static StringRef | getCanonicalCoroFnName (StringRef FnName, StringRef Attr="selected") |
| static StringRef | getCanonicalFnName (StringRef FnName, ArrayRef< StringRef > Suffixes, StringRef Attr="selected") |
| static LLVM_ABI unsigned | getOffset (const DILocation *DIL) |
| Returns the line offset to the start line of the subprogram. | |
| static LLVM_ABI LineLocation | getCallSiteIdentifier (const DILocation *DIL, bool ProfileIsFS=false) |
| Returns a unique call site identifier for a given debug location of a call instruction. | |
| static uint64_t | getCallSiteHash (FunctionId Callee, const LineLocation &Callsite) |
| Returns a unique hash code for a combination of a callsite location and the callee function name. | |
Public Attributes | |
| DenseMap< uint64_t, StringRef > * | GUIDToFuncNameMap = nullptr |
| GUIDToFuncNameMap saves the mapping from GUID to the symbol name, for all the function symbols defined or declared in current module. | |
Static Public Attributes | |
| static constexpr const char * | LLVMSuffix = ".llvm." |
| Name suffixes which canonicalization should handle to avoid profile mismatch. | |
| static constexpr const char * | PartSuffix = ".part." |
| static constexpr const char * | UniqSuffix = ".__uniq." |
| static LLVM_ABI std::atomic< bool > | ProfileIsProbeBased |
| static LLVM_ABI std::atomic< bool > | ProfileIsCS |
| static LLVM_ABI std::atomic< bool > | ProfileIsPreInlined |
| static LLVM_ABI std::atomic< bool > | UseMD5 |
| Whether the profile uses MD5 to represent string. | |
| static LLVM_ABI std::atomic< bool > | HasUniqSuffix = true |
| Whether the profile contains any ".__uniq." suffix in a name. | |
| static LLVM_ABI std::atomic< bool > | ProfileIsFS |
| If this profile uses flow sensitive discriminators. | |
Representation of the samples collected for a function.
This data structure contains all the collected samples for the body of a function. Each sample corresponds to a LineLocation instance within the body of the function.
Definition at line 826 of file SampleProf.h.
|
default |
References LLVM_ABI.
Referenced by findFunctionSamples(), findFunctionSamplesAt(), merge(), operator!=(), operator==(), and print().
|
inline |
Definition at line 860 of file SampleProf.h.
References uint64_t.
Referenced by llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::sampleprof::SampleProfileReaderGCC::readOneFunctionProfile(), and llvm::sampleprof::SampleProfileReaderBinary::readProfile().
|
inline |
Definition at line 866 of file SampleProf.h.
References uint64_t.
Referenced by llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::sampleprof::SampleProfileReaderGCC::readOneFunctionProfile(), and llvm::sampleprof::SampleProfileReaderBinary::readProfile().
|
inline |
Scale Other sample counts by Weight and add the scaled result to the type samples for Loc.
Under the hoold, the caller-provided Loc will be un-drifted before the type sample lookup if possible. typename T is either a std::map or a DenseMap.
Definition at line 1138 of file SampleProf.h.
References llvm::Count, llvm::counter_overflow, getTypeSamplesAt(), llvm::Other, llvm::SortedVectorMap< KeyT, ValueT, N, KeyCompare >::reserve(), llvm::SaturatingMultiplyAdd(), llvm::SortedVectorMap< KeyT, ValueT, N, KeyCompare >::size(), llvm::success, T, and uint64_t.
Referenced by merge().
|
inline |
Definition at line 852 of file SampleProf.h.
References llvm::counter_overflow, llvm::SaturatingMultiplyAdd(), llvm::success, and uint64_t.
Referenced by merge(), llvm::sampleprof::SampleProfileReaderBinary::readFuncProfile(), llvm::sampleprof::SampleProfileReaderText::readImpl(), and llvm::sampleprof::SampleProfileReaderGCC::readOneFunctionProfile().
|
inline |
Definition at line 874 of file SampleProf.h.
References uint64_t.
|
inline |
Definition at line 833 of file SampleProf.h.
References llvm::counter_overflow, llvm::SaturatingMultiplyAdd(), llvm::success, and uint64_t.
Referenced by merge(), llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::sampleprof::SampleProfileReaderBinary::readProfile(), and updateTotalSamples().
|
inline |
At location Loc, add a type sample for the given Type with Count.
This function uses saturating add which clamp the result to maximum uint64_t (the counter type), and inserts the saturating add result to map. Returns counter_overflow to caller if the actual result is larger than maximum uint64_t.
Definition at line 1123 of file SampleProf.h.
References llvm::Count, llvm::counter_overflow, getTypeSamplesAt(), llvm::SaturatingMultiplyAdd(), llvm::success, and uint64_t.
| LLVM_DUMP_METHOD void FunctionSamples::dump | ( | ) | const |
Definition at line 393 of file SampleProf.cpp.
References llvm::dbgs(), LLVM_DUMP_METHOD, and print().
|
inline |
| void FunctionSamples::findAllNames | ( | DenseSet< FunctionId > & | NameSet | ) | const |
Definition at line 333 of file SampleProf.cpp.
References getFunction(), llvm::detail::DenseSetImpl< ValueT, MapTy >::insert(), llvm::detail::DenseSetImpl< ValueT, MapTy >::insert_range(), and llvm::make_first_range().
|
inline |
Returns the TypeCountMap for inlined callsites at the given Loc.
The returned pointer may be invalidated by subsequent modifications to this FunctionSamples.
Definition at line 1026 of file SampleProf.h.
References LLVM_LIFETIME_BOUND, and mapIRLocToProfileLoc().
Referenced by print(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
|
inline |
Returns the call target map collected at a given location specified by CallSite.
If the location is not found in profile, return error. The returned reference may be invalidated by subsequent modifications to this FunctionSamples.
Definition at line 1000 of file SampleProf.h.
References LLVM_LIFETIME_BOUND, and mapIRLocToProfileLoc().
|
inline |
Returns the call target map collected at a given location.
Each location is specified by LineOffset and Discriminator. If the location is not found in profile, return error. The returned reference may be invalidated by subsequent modifications to this FunctionSamples.
Definition at line 986 of file SampleProf.h.
References LLVM_LIFETIME_BOUND, and mapIRLocToProfileLoc().
Referenced by llvm::sampleprof::ProfiledCallGraph::ProfiledCallGraph().
| const FunctionSamples * FunctionSamples::findFunctionSamples | ( | const DILocation * | DIL, |
| SampleProfileReaderItaniumRemapper * | Remapper = nullptr, | ||
| const HashKeyMap< DenseMap, FunctionId, FunctionId > * | FuncNameToProfNameMap = nullptr ) const |
Get the FunctionSamples of the inline instance where DIL originates from.
The FunctionSamples of the instruction (Machine or IR) associated to DIL is the inlined instance in which that instruction is coming from. We traverse the inline stack of that instruction, and match it with the tree nodes in the profile.
Remapper or FuncNameToProfNameMap is not nullptr, it will be used to find matching FunctionSamples with not exactly the same but equivalent name. Definition at line 304 of file SampleProf.cpp.
References assert(), llvm::SmallVectorImpl< T >::emplace_back(), FunctionSamples(), getCallSiteIdentifier(), ProfileIsFS, and llvm::SmallVectorTemplateCommon< T, typename >::size().
| const FunctionSamples * FunctionSamples::findFunctionSamplesAt | ( | const LineLocation & | Loc, |
| StringRef | CalleeName, | ||
| SampleProfileReaderItaniumRemapper * | Remapper, | ||
| const HashKeyMap< DenseMap, FunctionId, FunctionId > * | FuncNameToProfNameMap = nullptr ) const |
Returns a pointer to FunctionSamples at the given callsite location Loc with callee CalleeName.
If no callsite can be found, relax the restriction to return the FunctionSamples at callsite location Loc with the maximum total sample count. If Remapper or FuncNameToProfNameMap is not nullptr, use them to find FunctionSamples with equivalent name as CalleeName.
Definition at line 346 of file SampleProf.cpp.
References llvm::StringRef::empty(), llvm::sampleprof::HashKeyMap< MapT, KeyT, ValueT, MapTArgs >::find(), FunctionSamples(), getCanonicalFnName(), llvm::sampleprof::getRepInFormat(), I, llvm::sampleprof::SampleProfileReaderItaniumRemapper::lookUpNameInProfile(), and mapIRLocToProfileLoc().
|
inline |
Returns the FunctionSamplesMap at the given Loc.
Definition at line 1015 of file SampleProf.h.
References LLVM_LIFETIME_BOUND, and mapIRLocToProfileLoc().
|
inline |
Recursively traverses all children, if the total sample count of the corresponding function is no less than Threshold, add its corresponding GUID to S.
Also traverse the BodySamples to add hot CallTarget's GUID to S.
Definition at line 1229 of file SampleProf.h.
References F, getFunction(), getGUID(), llvm::detail::DenseSetImpl< ValueT, MapTy >::insert(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::lookup(), and uint64_t.
|
inline |
Return the number of samples collected at the given location.
Each location is specified by LineOffset and Discriminator. If the location is not found in profile, return error.
Definition at line 971 of file SampleProf.h.
References mapIRLocToProfileLoc().
|
inline |
Return the function samples at the given callsite location.
Definition at line 1009 of file SampleProf.h.
References LLVM_LIFETIME_BOUND, and mapIRLocToProfileLoc().
Referenced by merge(), llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncMetadata(), llvm::sampleprof::SampleProfileReaderGCC::readOneFunctionProfile(), and llvm::sampleprof::SampleProfileReaderBinary::readProfile().
|
inline |
Return all the samples collected in the body of the function.
The returned reference may be invalidated by subsequent modifications to this FunctionSamples.
Definition at line 1089 of file SampleProf.h.
References const, and LLVM_LIFETIME_BOUND.
Referenced by llvm::sampleprof::SampleProfileWriterBinary::addNames(), dumpFunctionProfileJson(), getMaxCountInside(), llvm::sampleprof::SampleProfileWriterBinary::writeBody(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
|
inlinestatic |
Returns a unique hash code for a combination of a callsite location and the callee function name.
Guarantee MD5 and non-MD5 representation of the same function results in the same hash.
Definition at line 1369 of file SampleProf.h.
References llvm::sampleprof::SampleContextFrame::getHashCode(), and uint64_t.
Referenced by llvm::ContextTrieNode::getChildContext(), llvm::ContextTrieNode::getOrCreateChildContext(), llvm::sampleprof::ProfileConverter::FrameNode::getOrCreateChildFrame(), and llvm::ContextTrieNode::removeChildContext().
|
static |
Returns a unique call site identifier for a given debug location of a call instruction.
This is wrapper of two scenarios, the probe-based profile and regular profile, to hide implementation details from the sample loader and the context tracker.
Definition at line 287 of file SampleProf.cpp.
References llvm::PseudoProbeDwarfDiscriminator::extractProbeIndex(), llvm::DILocation::getBaseDiscriminator(), getOffset(), ProfileIsFS, and ProfileIsProbeBased.
Referenced by findFunctionSamples(), llvm::SampleContextTracker::getIndirectCalleeContextSamplesFor(), and llvm::SampleContextTracker::promoteMergeContextSamplesTree().
|
inline |
Return all the callsite samples collected in the body of the function.
Definition at line 1094 of file SampleProf.h.
References const, and LLVM_LIFETIME_BOUND.
Referenced by llvm::sampleprof::SampleProfileWriterBinary::addNames(), dumpFunctionProfileJson(), getMaxCountInside(), llvm::sampleprof::SampleProfileWriterBinary::writeBody(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncMetadata(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
|
inline |
Returns vtable access samples for the C++ types collected in this function.
The returned reference may be invalidated by subsequent modifications to this FunctionSamples.
Definition at line 1105 of file SampleProf.h.
References const, and LLVM_LIFETIME_BOUND.
Referenced by llvm::sampleprof::SampleProfileWriterBinary::addNames(), and llvm::sampleprof::SampleProfileWriterBinary::writeBody().
|
inlinestatic |
Definition at line 1300 of file SampleProf.h.
References getCanonicalFnName(), and LLVMSuffix.
Referenced by llvm::PseudoProbeHandler::emitPseudoProbe().
Return the canonical name for a function, taking into account suffix elision policy attributes.
Definition at line 1278 of file SampleProf.h.
References F, and getCanonicalFnName().
Referenced by llvm::sampleprof::SampleProfileReaderExtBinaryBase::collectFuncsFromModule(), findFunctionSamplesAt(), llvm::SampleContextTracker::getAllContextSamplesFor(), llvm::SampleContextTracker::getBaseSamplesFor(), llvm::SampleContextTracker::getCalleeContextSamplesFor(), getCanonicalCoroFnName(), getCanonicalFnName(), getCanonicalFnName(), llvm::PseudoProbeManager::getDesc(), llvm::PseudoProbeManager::getDesc(), llvm::memprof::getGUID(), llvm::sampleprof::SampleProfileReader::getSamplesFor(), and llvm::PseudoProbeManager::PseudoProbeManager().
|
inlinestatic |
Definition at line 1311 of file SampleProf.h.
References assert(), HasUniqSuffix, llvm::StringRef::npos, llvm::StringRef::rfind(), llvm::StringRef::split(), llvm::StringRef::substr(), and UniqSuffix.
|
inlinestatic |
Definition at line 1290 of file SampleProf.h.
References getCanonicalFnName(), LLVMSuffix, PartSuffix, and UniqSuffix.
|
inline |
Definition at line 1392 of file SampleProf.h.
References const, getContext(), and LLVM_LIFETIME_BOUND.
Referenced by getContext(), llvm::SampleContextTracker::getContextSamplesFor(), llvm::SampleContextTracker::markContextSamplesInlined(), llvm::SampleContextTracker::populateFuncToCtxtMap(), llvm::sampleprof::ProfileConverter::ProfileConverter(), llvm::SampleContextTracker::promoteMergeContextSamplesTree(), llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncMetadata(), llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::sampleprof::SampleProfileWriterBinary::writeBody(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncMetadata(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeSample(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
|
inline |
Return the original function name.
Definition at line 1265 of file SampleProf.h.
References getFuncName(), and getFunction().
Referenced by getFuncName().
|
inline |
Translate Func into its original name.
When profile doesn't use MD5, Func needs no translation. When profile uses MD5, Func in current FunctionSamples is actually GUID of the original function name. getFuncName will translate Func in current FunctionSamples into its original name by looking up in the function map GUIDToFuncNameMap. If the original name doesn't exist in the map, return empty StringRef.
Definition at line 1345 of file SampleProf.h.
References assert(), GUIDToFuncNameMap, and UseMD5.
|
inline |
Return the function name.
Definition at line 1262 of file SampleProf.h.
Referenced by llvm::sampleprof::SampleProfileWriterBinary::addNames(), dumpFunctionProfileJson(), findAllNames(), findInlinedFunctions(), getFuncName(), getGUID(), llvm::sampleprof::ProfiledCallGraph::ProfiledCallGraph(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
|
inline |
Definition at line 1269 of file SampleProf.h.
References uint64_t.
Referenced by print(), llvm::PseudoProbeManager::profileIsHashMismatched(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncMetadata(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
|
inline |
Return the GUID of the context's name.
If the context is already using MD5, don't hash it again.
Definition at line 1419 of file SampleProf.h.
References getFunction(), llvm::sampleprof::FunctionId::getHashCode(), and uint64_t.
Referenced by findInlinedFunctions().
|
inline |
For top-level functions, return the total number of branch samples that have the function as the branch target (or 0 otherwise).
This is the raw data fetched from the profile. This should be equivalent to the sample of the first instruction of the symbol. But as we directly get this info for raw profile without referring to potentially inaccurate debug info, this gives more accurate profile data and is preferred for standalone symbols.
Definition at line 1056 of file SampleProf.h.
References uint64_t.
Referenced by dumpFunctionProfileJson(), getHeadSamplesEstimate(), llvm::sampleprof::SampleProfileWriterBinary::writeSample(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeSample(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
|
inline |
Return an estimate of the sample count of the function entry basic block.
The function can be either a standalone symbol or an inlined function. For Context-Sensitive profiles, this will prefer returning the head samples (i.e. getHeadSamples()), if non-zero. Otherwise it estimates from the function body's samples or callsite samples.
Definition at line 1063 of file SampleProf.h.
References llvm::Count, getHeadSamples(), ProfileIsCS, and uint64_t.
Referenced by llvm::sampleprof::ProfiledCallGraph::ProfiledCallGraph().
|
inline |
Return the maximum of sample counts in a function body.
When SkipCallSite is false, which is the default, the return count includes samples in the inlined functions. When SkipCallSite is true, the return count only considers the body samples.
Definition at line 1165 of file SampleProf.h.
References C(), F, getBodySamples(), getCallsiteSamples(), and uint64_t.
|
static |
Returns the line offset to the start line of the subprogram.
We assume that a single function will not exceed 65535 LOC.
Definition at line 282 of file SampleProf.cpp.
Referenced by getCallSiteIdentifier(), and llvm::SampleProfileLoaderBaseImpl< FT >::getInstWeightImpl().
|
inline |
Return the total number of samples collected inside the function.
Definition at line 1048 of file SampleProf.h.
References uint64_t.
Referenced by llvm::sampleprofutil::callsiteIsHot(), dumpFunctionProfileJson(), llvm::ContextTrieNode::getHottestChildContext(), llvm::sampleprof::SampleProfileReaderGCC::readOneFunctionProfile(), llvm::sampleprof::SampleContextTrimmer::trimAndMergeColdContextProfiles(), llvm::sampleprof::SampleProfileWriterBinary::writeBody(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
|
inline |
Returns the vtable access samples for the C++ types for Loc.
Under the hood, the caller-specified Loc will be un-drifted before the type sample lookup if possible. The returned reference may be invalidated by subsequent modifications to this FunctionSamples.
Definition at line 1114 of file SampleProf.h.
References LLVM_LIFETIME_BOUND, and mapIRLocToProfileLoc().
Referenced by addCallsiteVTableTypeProfAt(), addTypeSamplesAt(), and llvm::sampleprof::SampleProfileReaderBinary::readCallsiteVTableProf().
|
inline |
Return whether this function profile contains callsite samples.
Definition at line 1099 of file SampleProf.h.
|
inline |
Definition at line 957 of file SampleProf.h.
Referenced by findCallsiteTypeSamplesAt(), findCallTargetMapAt(), findCallTargetMapAt(), findFunctionSamplesAt(), findFunctionSamplesMapAt(), findSamplesAt(), functionSamplesAt(), and getTypeSamplesAt().
|
inline |
Merge the samples in Other into this one.
Optionally scale samples by Weight.
Definition at line 1179 of file SampleProf.h.
References addCallsiteVTableTypeProfAt(), addHeadSamples(), addTotalSamples(), FunctionSamples(), functionSamplesAt(), GUIDToFuncNameMap, llvm::hash_mismatch, I, merge(), llvm::mergeSampleProfErrors(), llvm::Other, llvm::success, and uint64_t.
Referenced by llvm::SampleContextTracker::createContextLessProfileMap(), merge(), and llvm::sampleprof::SampleContextTrimmer::trimAndMergeColdContextProfiles().
|
inline |
Definition at line 1436 of file SampleProf.h.
References FunctionSamples(), and llvm::Other.
|
inline |
Definition at line 1425 of file SampleProf.h.
References FunctionSamples(), GUIDToFuncNameMap, and llvm::Other.
| void FunctionSamples::print | ( | raw_ostream & | OS = dbgs(), |
| unsigned | Indent = 0 ) const |
Print the samples collected for a function on stream OS.
Definition at line 214 of file SampleProf.cpp.
References findCallsiteTypeSamplesAt(), FunctionSamples(), getFunctionHash(), llvm::raw_ostream::indent(), llvm::make_second_range(), and printTypeCountMap().
Referenced by dump().
|
inline |
Definition at line 906 of file SampleProf.h.
|
inline |
Definition at line 890 of file SampleProf.h.
References llvm::Count, I, and uint64_t.
|
inline |
Definition at line 841 of file SampleProf.h.
References uint64_t.
|
inline |
Definition at line 880 of file SampleProf.h.
Referenced by llvm::sampleprof::SampleProfileReaderGCC::readOneFunctionProfile(), and llvm::sampleprof::SampleProfileReaderBinary::readProfile().
|
inline |
Definition at line 884 of file SampleProf.h.
Referenced by llvm::sampleprof::SampleProfileReaderBinary::readCallsiteVTableProf().
|
inline |
Definition at line 1394 of file SampleProf.h.
Referenced by llvm::sampleprof::SampleProfileReaderBinary::readFuncProfile().
|
inline |
Definition at line 947 of file SampleProf.h.
References I.
|
inline |
Definition at line 936 of file SampleProf.h.
References I, and llvm::sampleprof::SyntheticContext.
|
inline |
Set the name of the function.
Definition at line 1257 of file SampleProf.h.
Referenced by llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::sampleprof::SampleProfileReaderGCC::readOneFunctionProfile(), and llvm::sampleprof::SampleProfileReaderBinary::readProfile().
|
inline |
Definition at line 1267 of file SampleProf.h.
References uint64_t.
Referenced by llvm::sampleprof::SampleProfileReaderExtBinaryBase::readFuncMetadata(), and llvm::sampleprof::SampleProfileReaderText::readImpl().
|
inline |
Definition at line 850 of file SampleProf.h.
References uint64_t.
|
inline |
Definition at line 1271 of file SampleProf.h.
References assert().
|
inline |
Definition at line 848 of file SampleProf.h.
References uint64_t.
Referenced by updateTotalSamples().
|
inline |
Definition at line 909 of file SampleProf.h.
|
inline |
Definition at line 922 of file SampleProf.h.
References addTotalSamples(), I, and setTotalSamples().
GUIDToFuncNameMap saves the mapping from GUID to the symbol name, for all the function symbols defined or declared in current module.
Definition at line 1415 of file SampleProf.h.
Referenced by getFuncName(), merge(), and operator==().
|
static |
Whether the profile contains any ".__uniq." suffix in a name.
Definition at line 1408 of file SampleProf.h.
Referenced by getCanonicalFnName(), and llvm::sampleprof::SampleProfileReaderExtBinaryBase::readOneSection().
Name suffixes which canonicalization should handle to avoid profile mismatch.
Definition at line 1286 of file SampleProf.h.
Referenced by getCanonicalCoroFnName(), and getCanonicalFnName().
Definition at line 1287 of file SampleProf.h.
Referenced by getCanonicalFnName().
|
static |
Definition at line 1400 of file SampleProf.h.
Referenced by llvm::SampleProfileSummaryBuilder::computeSummaryForProfiles(), llvm::sampleprof::SampleProfileWriter::create(), getHeadSamplesEstimate(), llvm::sampleprof::ProfiledCallGraph::ProfiledCallGraph(), llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::sampleprof::SampleProfileReaderExtBinaryBase::readOneSection(), llvm::SampleProfileMatcher::runOnModule(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncMetadata(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncMetadata(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncOffsetTable(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeLegacyFuncOffsetTable(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeNameTableSection(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeOneSection(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
|
static |
If this profile uses flow sensitive discriminators.
Definition at line 1411 of file SampleProf.h.
Referenced by findFunctionSamples(), getCallSiteIdentifier(), llvm::sampleprof::SampleProfileReaderBinary::readImpl(), llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::sampleprof::SampleProfileReaderExtBinaryBase::readOneSection(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeOneSection().
|
static |
Definition at line 1402 of file SampleProf.h.
Referenced by llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::sampleprof::SampleProfileReaderExtBinaryBase::readOneSection(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncMetadata(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncMetadata(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeOneSection().
|
static |
Definition at line 1398 of file SampleProf.h.
Referenced by llvm::sampleprof::SampleProfileWriter::create(), getCallSiteIdentifier(), llvm::MIRProfileLoader::getInstWeight(), llvm::SampleProfileLoaderBaseImpl< FT >::getInstWeight(), llvm::SampleProfileLoaderBaseImpl< FT >::getProbeWeight(), llvm::sampleprof::SampleProfileReaderText::readImpl(), llvm::sampleprof::SampleProfileReaderExtBinaryBase::readOneSection(), llvm::MIRProfileLoader::runOnFunction(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncMetadata(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeFuncMetadata(), llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeOneSection(), and llvm::sampleprof::SampleProfileWriterText::writeSample().
Definition at line 1288 of file SampleProf.h.
Referenced by getCanonicalFnName(), getCanonicalFnName(), llvm::getUniqueInternalLinkagePostfix(), and llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeNameTableSection().
|
static |
Whether the profile uses MD5 to represent string.
Definition at line 1405 of file SampleProf.h.
Referenced by getFuncName(), llvm::SampleContextTracker::getFuncNameFor(), llvm::sampleprof::getRepInFormat(), and llvm::sampleprof::SampleProfileReader::read().