12 #ifndef LLVM_PROFILEDATA_SAMPLEPROFWRITER_H 13 #define LLVM_PROFILEDATA_SAMPLEPROFWRITER_H 26 #include <system_error> 29 namespace sampleprof {
66 virtual std::error_code
70 virtual std::error_code
121 virtual std::error_code writeNameTable();
122 virtual std::error_code
124 std::error_code writeSummary();
125 std::error_code writeNameIdx(
StringRef FName);
127 inline void stablizeNameTable(std::set<StringRef> &V);
147 virtual std::error_code
150 void setToCompressAllSections();
154 uint64_t markSectionStart(
SecType Type);
155 std::error_code addNewSection(
SecType Sec, uint64_t SectionStart);
156 virtual void initSectionHdrLayout() = 0;
157 virtual std::error_code
167 void allocSecHdrTable();
168 std::error_code writeSecHdrTable();
169 virtual std::error_code
173 std::error_code compressAndOutput();
183 std::unique_ptr<raw_ostream> LocalBufStream;
188 uint64_t SecHdrTableOffset;
190 std::vector<SecHdrTableEntry> SecHdrTable;
197 initSectionHdrLayout();
206 virtual void initSectionHdrLayout()
override {
223 virtual std::error_code
230 uint64_t SecLBRProfileStart = 0;
234 std::error_code writeFuncOffsetTable();
272 virtual std::error_code
282 virtual std::error_code writeNameTable()
override;
283 virtual std::error_code
285 std::error_code writeFuncOffsetTable();
291 #endif // LLVM_PROFILEDATA_SAMPLEPROFWRITER_H
Represents either an error or a value T.
uint64_t TableOffset
The offset of the slot to be filled with the offset of FuncOffsetTable towards profile start...
This class represents lattice values for constants.
MapVector< StringRef, uint32_t > NameTable
Sample-based profile writer. Base class.
virtual ~SampleProfileWriter()=default
This class implements a map that also provides access to all stored values in a deterministic order...
std::error_code writeHeader(const StringMap< FunctionSamples > &ProfileMap) override
Write a file header for the profile file.
std::unique_ptr< raw_ostream > OutputStream
Output stream where to emit the profile to.
SampleProfileWriterBinary(std::unique_ptr< raw_ostream > &OS)
Representation of the samples collected for a function.
virtual std::error_code writeFuncProfiles(const StringMap< FunctionSamples > &ProfileMap)
MapVector< StringRef, uint64_t > FuncOffsetTable
The table mapping from function name to the offset of its FunctionSample towards profile start...
virtual std::error_code write(const StringMap< FunctionSamples > &ProfileMap)
Write all the sample profiles in the given map of samples.
std::unique_ptr< ProfileSummary > Summary
Profile summary.
The instances of the Type class are immutable: once they are created, they are never changed...
Sample-based profile writer (binary format).
raw_ostream & getOutputStream()
SmallVector< SecHdrTableEntry, 8 > SectionHdrLayout
virtual std::error_code writeSample(const FunctionSamples &S)=0
Write sample profiles in S.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static ErrorOr< std::unique_ptr< SampleProfileWriter > > create(StringRef Filename, SampleProfileFormat Format)
Profile writer factory.
SampleProfileFormat Format
Profile format.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
virtual void setProfileSymbolList(ProfileSymbolList *PSL)
virtual void setProfileSymbolList(ProfileSymbolList *PSL) override
SampleProfileWriterText(std::unique_ptr< raw_ostream > &OS)
ProfileSymbolList records the list of function symbols shown up in the binary used to generate the pr...
Provides ErrorOr<T> smart pointer.
virtual std::error_code writeHeader(const StringMap< FunctionSamples > &ProfileMap)=0
Write a file header for the profile file.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
SampleProfileWriter(std::unique_ptr< raw_ostream > &OS)
void computeSummary(const StringMap< FunctionSamples > &ProfileMap)
Compute summary for this profile.
Sample-based profile writer (text format).
SampleProfileWriterExtBinary(std::unique_ptr< raw_ostream > &OS)