13#ifndef LLVM_PROFILEDATA_MEMPROFREADER_H_
14#define LLVM_PROFILEDATA_MEMPROFREADER_H_
57 std::function<
const Frame(
const FrameId)> Callback =
nullptr) {
64 if (Callback ==
nullptr)
75 if (CSIdConv.LastUnmappedId)
123 static bool hasFormat(
const StringRef Path);
129 create(
const Twine &Path,
StringRef ProfiledBinary,
bool KeepName =
false);
131 create(std::unique_ptr<MemoryBuffer> Buffer,
StringRef ProfiledBinary,
132 bool KeepName =
false);
135 static std::vector<std::string> peekBuildIds(
MemoryBuffer *DataBuffer);
139 std::function<
const Frame(
const FrameId)> Callback)
override;
146 : SegmentInfo(Seg.begin(), Seg.end()), CallstackProfileData(Prof),
147 StackMap(SM), KeepSymbolName(KeepName) {
153 if (
Error E = symbolizeAndFilterStackFrames(std::move(
Sym)))
155 if (
Error E = mapRawProfileToRecords())
161 : Binary(
std::
move(
Bin)), KeepSymbolName(KeepName) {}
165 Error readRawProfile(std::unique_ptr<MemoryBuffer> DataBuffer);
167 Error setupForSymbolization();
172 Error symbolizeAndFilterStackFrames(
173 std::unique_ptr<llvm::symbolize::SymbolizableModule> Symbolizer);
177 Error mapRawProfileToRecords();
182 readMemInfoBlocks(
const char *
Ptr);
188 uint64_t MemprofRawVersion = MEMPROF_RAW_VERSION;
190 uint64_t PreferredTextSegmentAddress = 0;
192 uint64_t ProfiledTextSegmentStart = 0;
194 uint64_t ProfiledTextSegmentEnd = 0;
203 CallStackMap StackMap;
209 bool KeepSymbolName =
false;
230 create(std::unique_ptr<MemoryBuffer> Buffer);
235 return std::move(DataAccessProfileData);
242 setDataAccessProfileData(std::unique_ptr<memprof::DataAccessProfData>
Data) {
243 DataAccessProfileData = std::move(
Data);
246 std::unique_ptr<memprof::DataAccessProfData> DataAccessProfileData;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the DenseMap class.
This file implements a map that provides insertion order iteration.
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringLiteral > StandardNames)
Initialize the set of available library functions based on the specified target triple.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
A file format agnostic iterator over profiling data.
This class implements a map that also provides access to all stored values in a deterministic order.
typename VectorType::iterator iterator
This interface provides simple read-only access to a block of memory, and provides simple methods for...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const Frame & idToFrame(const FrameId Id) const
virtual ~MemProfReader()=default
IndexedMemProfData takeMemProfData()
InstrProfIterator< GuidMemProfRecordPair, MemProfReader > Iterator
IndexedMemProfData MemProfData
InstrProfKind getProfileKind() const
virtual Error readNextRecord(GuidMemProfRecordPair &GuidRecord, std::function< const Frame(const FrameId)> Callback=nullptr)
MemProfReader(IndexedMemProfData &&MemProfData)
llvm::MapVector< GlobalValue::GUID, IndexedMemProfRecord >::iterator Iter
std::pair< GlobalValue::GUID, MemProfRecord > GuidMemProfRecordPair
RawMemProfReader & operator=(const RawMemProfReader &)=delete
RawMemProfReader(const RawMemProfReader &)=delete
RawMemProfReader(std::unique_ptr< llvm::symbolize::SymbolizableModule > Sym, llvm::SmallVectorImpl< SegmentEntry > &Seg, llvm::MapVector< uint64_t, MemInfoBlock > &Prof, CallStackMap &SM, bool KeepName=false)
YAMLMemProfReader()=default
static LLVM_ABI bool hasFormat(const MemoryBuffer &DataBuffer)
std::unique_ptr< memprof::DataAccessProfData > takeDataAccessProfData()
static LLVM_ABI Expected< std::unique_ptr< YAMLMemProfReader > > create(const Twine &Path)
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
InstrProfKind
An enum describing the attributes of an instrumented profile.
Implement std::hash so that hash_code can be used in STL containers.
llvm::MapVector< CallStackId, llvm::SmallVector< FrameId > > CallStacks
llvm::MapVector< GlobalValue::GUID, IndexedMemProfRecord > Records
llvm::MapVector< FrameId, Frame > Frames
LLVM_ABI MemProfRecord toMemProfRecord(llvm::function_ref< std::vector< Frame >(const CallStackId)> Callback) const