LLVM 19.0.0git
Classes | Typedefs | Enumerations | Functions
llvm::memprof Namespace Reference

Classes

struct  AllocationInfo
 
class  CallStack
 Helper class to iterate through stack ids in both metadata (memprof MIB and callsite) and the corresponding ThinLTO summary data structures (CallsiteInfo and MIBInfo). More...
 
class  CallStackTrie
 Class to build a trie of call stack contexts for a particular profiled allocation call, along with their associated allocation types. More...
 
struct  Frame
 
class  FrameLookupTrait
 
class  FrameWriterTrait
 
struct  IndexedAllocationInfo
 
struct  IndexedMemProfRecord
 
class  MemProfReader
 
struct  MemProfRecord
 
struct  PortableMemInfoBlock
 
class  RawMemProfReader
 
class  RecordLookupTrait
 
class  RecordWriterTrait
 

Typedefs

using MemProfSchema = llvm::SmallVector< Meta, static_cast< int >(Meta::Size)>
 
using FrameId = uint64_t
 
using CallStackMap = llvm::DenseMap< uint64_t, llvm::SmallVector< uint64_t > >
 

Enumerations

enum class  Meta : uint64_t { Start = 0 , MIBEntryDef , Size }
 

Functions

AllocationType getAllocType (uint64_t TotalLifetimeAccessDensity, uint64_t AllocCount, uint64_t TotalLifetime)
 Return the allocation type for a given set of memory profile values.
 
MDNodebuildCallstackMetadata (ArrayRef< uint64_t > CallStack, LLVMContext &Ctx)
 Build callstack metadata from the provided list of call stack ids.
 
MDNodegetMIBStackNode (const MDNode *MIB)
 Returns the stack node from an MIB metadata node.
 
AllocationType getMIBAllocType (const MDNode *MIB)
 Returns the allocation type from an MIB metadata node.
 
std::string getAllocTypeAttributeString (AllocationType Type)
 Returns the string to use in attributes with the given type.
 
bool hasSingleAllocType (uint8_t AllocTypes)
 True if the AllocTypes bitmask contains just a single type.
 
Expected< MemProfSchemareadMemProfSchema (const unsigned char *&Buffer)
 

Typedef Documentation

◆ CallStackMap

Definition at line 109 of file RawMemProfReader.h.

◆ FrameId

Definition at line 137 of file MemProf.h.

◆ MemProfSchema

using llvm::memprof::MemProfSchema = typedef llvm::SmallVector<Meta, static_cast<int>(Meta::Size)>

Definition at line 26 of file MemProf.h.

Enumeration Type Documentation

◆ Meta

enum class llvm::memprof::Meta : uint64_t
strong
Enumerator
Start 
MIBEntryDef 
Size 

Definition at line 18 of file MemProf.h.

Function Documentation

◆ buildCallstackMetadata()

MDNode * llvm::memprof::buildCallstackMetadata ( ArrayRef< uint64_t CallStack,
LLVMContext Ctx 
)

Build callstack metadata from the provided list of call stack ids.

Returns the resulting metadata node.

Definition at line 65 of file MemoryProfileInfo.cpp.

References llvm::MDNode::get(), llvm::ConstantInt::get(), llvm::ValueAsMetadata::get(), and llvm::Type::getInt64Ty().

Referenced by addCallsiteMetadata(), and createMIBNode().

◆ getAllocType()

AllocationType llvm::memprof::getAllocType ( uint64_t  TotalLifetimeAccessDensity,
uint64_t  AllocCount,
uint64_t  TotalLifetime 
)

Return the allocation type for a given set of memory profile values.

Definition at line 44 of file MemoryProfileInfo.cpp.

References MemProfAveLifetimeColdThreshold, MemProfLifetimeAccessDensityColdThreshold, and MemProfMinAveLifetimeAccessDensityHotThreshold.

Referenced by addCallStack().

◆ getAllocTypeAttributeString()

std::string llvm::memprof::getAllocTypeAttributeString ( AllocationType  Type)

Returns the string to use in attributes with the given type.

Definition at line 97 of file MemoryProfileInfo.cpp.

References assert(), and llvm_unreachable.

Referenced by addAllocTypeAttribute(), and createMIBNode().

◆ getMIBAllocType()

AllocationType llvm::memprof::getMIBAllocType ( const MDNode MIB)

Returns the allocation type from an MIB metadata node.

Definition at line 82 of file MemoryProfileInfo.cpp.

References assert(), llvm::MDNode::getNumOperands(), and llvm::MDNode::getOperand().

Referenced by llvm::memprof::CallStackTrie::addCallStack(), and computeFunctionSummary().

◆ getMIBStackNode()

MDNode * llvm::memprof::getMIBStackNode ( const MDNode MIB)

Returns the stack node from an MIB metadata node.

Definition at line 76 of file MemoryProfileInfo.cpp.

References assert(), llvm::MDNode::getNumOperands(), and llvm::MDNode::getOperand().

Referenced by llvm::memprof::CallStackTrie::addCallStack(), computeFunctionSummary(), and propagateMemProfHelper().

◆ hasSingleAllocType()

bool llvm::memprof::hasSingleAllocType ( uint8_t  AllocTypes)

True if the AllocTypes bitmask contains just a single type.

Definition at line 121 of file MemoryProfileInfo.cpp.

References assert(), and llvm::popcount().

Referenced by llvm::memprof::CallStackTrie::buildAndAttachMIBMetadata().

◆ readMemProfSchema()

Expected< MemProfSchema > llvm::memprof::readMemProfSchema ( const unsigned char *&  Buffer)

Definition at line 94 of file MemProf.cpp.

References I, llvm::malformed, Ptr, and Size.

Referenced by llvm::IndexedInstrProfReader::readHeader().