13#ifndef LLVM_PROFILEDATA_MEMPROFREADER_H_
14#define LLVM_PROFILEDATA_MEMPROFREADER_H_
55 std::function<
const Frame(
const FrameId)> Callback =
nullptr) {
62 if (Callback ==
nullptr)
74 if (CSIdConv.LastUnmappedId)
131 bool KeepName =
false);
138 std::function<
const Frame(
const FrameId)> Callback)
override;
145 : SegmentInfo(Seg.
begin(), Seg.
end()), CallstackProfileData(Prof),
146 StackMap(SM), KeepSymbolName(KeepName) {
152 if (
Error E = symbolizeAndFilterStackFrames(std::move(
Sym)))
154 if (
Error E = mapRawProfileToRecords())
160 : Binary(
std::
move(
Bin)), KeepSymbolName(KeepName) {}
162 Error initialize(std::unique_ptr<MemoryBuffer> DataBuffer);
164 Error readRawProfile(std::unique_ptr<MemoryBuffer> DataBuffer);
166 Error setupForSymbolization();
171 Error symbolizeAndFilterStackFrames(
172 std::unique_ptr<llvm::symbolize::SymbolizableModule> Symbolizer);
176 Error mapRawProfileToRecords();
181 readMemInfoBlocks(
const char *
Ptr);
187 uint64_t MemprofRawVersion = MEMPROF_RAW_VERSION;
189 uint64_t PreferredTextSegmentAddress = 0;
191 uint64_t ProfiledTextSegmentStart = 0;
193 uint64_t ProfiledTextSegmentEnd = 0;
208 bool KeepSymbolName =
false;
228 create(std::unique_ptr<MemoryBuffer> Buffer);
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.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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
void printYAML(raw_ostream &OS)
RawMemProfReader & operator=(const RawMemProfReader &)=delete
RawMemProfReader(const RawMemProfReader &)=delete
static Expected< std::unique_ptr< RawMemProfReader > > create(const Twine &Path, StringRef ProfiledBinary, bool KeepName=false)
static std::vector< std::string > peekBuildIds(MemoryBuffer *DataBuffer)
Error readNextRecord(GuidMemProfRecordPair &GuidRecord, std::function< const Frame(const FrameId)> Callback) override
RawMemProfReader(std::unique_ptr< llvm::symbolize::SymbolizableModule > Sym, llvm::SmallVectorImpl< SegmentEntry > &Seg, llvm::MapVector< uint64_t, MemInfoBlock > &Prof, CallStackMap &SM, bool KeepName=false)
static bool hasFormat(const MemoryBuffer &DataBuffer)
virtual ~RawMemProfReader() override
YAMLMemProfReader()=default
static bool hasFormat(const MemoryBuffer &DataBuffer)
static 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.
llvm::DenseMap< uint64_t, llvm::SmallVector< uint64_t > > CallStackMap
This is an optimization pass for GlobalISel generic memory operations.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
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
MemProfRecord toMemProfRecord(llvm::function_ref< std::vector< Frame >(const CallStackId)> Callback) const