LLVM 22.0.0git
|
Encapsulates the data access profile data and the methods to operate on it. More...
#include "llvm/ProfileData/DataAccessProf.h"
Public Types | |
using | StringToIndexMap = llvm::MapVector< StringRef, uint64_t > |
Public Member Functions | |
DataAccessProfData () | |
LLVM_ABI Error | serialize (ProfOStream &OS) const |
Serialize profile data to the output stream. | |
LLVM_ABI Error | deserialize (const unsigned char *&Ptr) |
Deserialize this class from the given buffer. | |
LLVM_ABI std::optional< DataAccessProfRecord > | getProfileRecord (const SymbolHandleRef SymID) const |
Returns a profile record for SymbolID , or std::nullopt if there isn't a record. | |
LLVM_ABI bool | isKnownColdSymbol (const SymbolHandleRef SymID) const |
Returns true if SymID is seen in profiled binaries and cold. | |
LLVM_ABI Error | setDataAccessProfile (SymbolHandleRef SymbolID, uint64_t AccessCount) |
Methods to set symbolized data access profile. | |
LLVM_ABI Error | setDataAccessProfile (SymbolHandleRef SymbolID, uint64_t AccessCount, ArrayRef< SourceLocation > Locations) |
Similar to the method above, for records with Locations representing the filename:line where this symbol shows up. | |
LLVM_ABI Error | addKnownSymbolWithoutSamples (SymbolHandleRef SymbolID) |
Add a symbol that's seen in the profiled binary without samples. | |
ArrayRef< StringToIndexMap::value_type > | getStrToIndexMapRef () const |
The following methods return array reference for various internal data structures. | |
ArrayRef< MapVector< SymbolHandleRef, internal::DataAccessProfRecordRef >::value_type > | getRecords () const |
ArrayRef< StringRef > | getKnownColdSymbols () const |
ArrayRef< uint64_t > | getKnownColdHashes () const |
bool | empty () const |
Encapsulates the data access profile data and the methods to operate on it.
This class provides profile look-up, serialization and deserialization.
Definition at line 129 of file DataAccessProf.h.
Definition at line 133 of file DataAccessProf.h.
|
inline |
Definition at line 135 of file DataAccessProf.h.
Error llvm::memprof::DataAccessProfData::addKnownSymbolWithoutSamples | ( | SymbolHandleRef | SymbolID | ) |
Add a symbol that's seen in the profiled binary without samples.
Definition at line 104 of file DataAccessProf.cpp.
References llvm::memprof::getCanonicalName(), llvm::SetVector< T, Vector, Set, N >::insert(), llvm::memprof::saveStringToMap(), and llvm::Error::success().
Deserialize this class from the given buffer.
Definition at line 118 of file DataAccessProf.cpp.
References E, I, llvm::SetVector< T, Vector, Set, N >::insert(), and Ptr.
|
inline |
Definition at line 188 of file DataAccessProf.h.
References llvm::SetVector< T, Vector, Set, N >::empty().
Referenced by getProfileRecord().
Definition at line 185 of file DataAccessProf.h.
References llvm::SetVector< T, Vector, Set, N >::getArrayRef().
Definition at line 182 of file DataAccessProf.h.
std::optional< DataAccessProfRecord > llvm::memprof::DataAccessProfData::getProfileRecord | ( | const SymbolHandleRef | SymID | ) | const |
Returns a profile record for SymbolID
, or std::nullopt if there isn't a record.
Internally, this function will canonicalize the symbol name before the lookup.
Definition at line 33 of file DataAccessProf.cpp.
References assert(), empty(), and llvm::memprof::getCanonicalName().
|
inline |
Definition at line 179 of file DataAccessProf.h.
|
inline |
The following methods return array reference for various internal data structures.
Definition at line 174 of file DataAccessProf.h.
References llvm::MapVector< KeyT, ValueT, MapType, VectorType >::getArrayRef().
bool llvm::memprof::DataAccessProfData::isKnownColdSymbol | ( | const SymbolHandleRef | SymID | ) | const |
Returns true if SymID
is seen in profiled binaries and cold.
Definition at line 56 of file DataAccessProf.cpp.
References llvm::SetVector< T, Vector, Set, N >::contains().
Error llvm::memprof::DataAccessProfData::serialize | ( | ProfOStream & | OS | ) | const |
Serialize profile data to the output stream.
Storage layout:
Definition at line 177 of file DataAccessProf.cpp.
References E, OS, llvm::SetVector< T, Vector, Set, N >::size(), and llvm::Error::success().
Error llvm::memprof::DataAccessProfData::setDataAccessProfile | ( | SymbolHandleRef | SymbolID, |
uint64_t | AccessCount | ||
) |
Methods to set symbolized data access profile.
Returns error if duplicated symbol names or content hashes are seen. The user of this class should aggregate counters that correspond to the same symbol name or with the same string literal hash before calling 'set*' methods.
Definition at line 62 of file DataAccessProf.cpp.
References llvm::memprof::getCanonicalName(), llvm::invalid_argument, llvm::memprof::saveStringToMap(), and llvm::Error::success().
Referenced by setDataAccessProfile().
Error llvm::memprof::DataAccessProfData::setDataAccessProfile | ( | SymbolHandleRef | SymbolID, |
uint64_t | AccessCount, | ||
ArrayRef< SourceLocation > | Locations | ||
) |
Similar to the method above, for records with Locations
representing the filename:line
where this symbol shows up.
Note because of linker's merge of identical symbols (e.g., unnamed_addr string literals), one symbol is likely to have multiple locations.
Definition at line 89 of file DataAccessProf.cpp.
References E, llvm::memprof::saveStringToMap(), setDataAccessProfile(), and llvm::Error::success().