LLVM  15.0.0git
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::sampleprof::SampleProfileWriterCompactBinary Class Reference

#include "llvm/ProfileData/SampleProfWriter.h"

Inheritance diagram for llvm::sampleprof::SampleProfileWriterCompactBinary:
Inheritance graph
[legend]
Collaboration diagram for llvm::sampleprof::SampleProfileWriterCompactBinary:
Collaboration graph
[legend]

Public Member Functions

virtual std::error_code writeSample (const FunctionSamples &S) override
 Write samples of a top-level function to a binary file. More...
 
virtual std::error_code write (const SampleProfileMap &ProfileMap) override
 Write all the sample profiles in the given map of samples. More...
 
- Public Member Functions inherited from llvm::sampleprof::SampleProfileWriterBinary
 SampleProfileWriterBinary (std::unique_ptr< raw_ostream > &OS)
 
- Public Member Functions inherited from llvm::sampleprof::SampleProfileWriter
virtual ~SampleProfileWriter ()=default
 
raw_ostreamgetOutputStream ()
 
virtual void setProfileSymbolList (ProfileSymbolList *PSL)
 
virtual void setToCompressAllSections ()
 
virtual void setUseMD5 ()
 
virtual void setPartialProfile ()
 
virtual void resetSecLayout (SectionLayout SL)
 

Protected Member Functions

virtual std::error_code writeNameTable () override
 
virtual std::error_code writeHeader (const SampleProfileMap &ProfileMap) override
 Write a file header for the profile file. More...
 
std::error_code writeFuncOffsetTable ()
 
- Protected Member Functions inherited from llvm::sampleprof::SampleProfileWriterBinary
virtual MapVector< StringRef, uint32_t > & getNameTable ()
 
virtual std::error_code writeMagicIdent (SampleProfileFormat Format)
 
std::error_code writeSummary ()
 
virtual std::error_code writeContextIdx (const SampleContext &Context)
 
std::error_code writeNameIdx (StringRef FName)
 
std::error_code writeBody (const FunctionSamples &S)
 
void stablizeNameTable (MapVector< StringRef, uint32_t > &NameTable, std::set< StringRef > &V)
 
void addName (StringRef FName)
 
virtual void addContext (const SampleContext &Context)
 
void addNames (const FunctionSamples &S)
 
- Protected Member Functions inherited from llvm::sampleprof::SampleProfileWriter
 SampleProfileWriter (std::unique_ptr< raw_ostream > &OS)
 
virtual std::error_code writeFuncProfiles (const SampleProfileMap &ProfileMap)
 
void computeSummary (const SampleProfileMap &ProfileMap)
 Compute summary for this profile. More...
 

Protected Attributes

MapVector< StringRef, uint64_tFuncOffsetTable
 The table mapping from function name to the offset of its FunctionSample towards profile start. More...
 
uint64_t TableOffset
 The offset of the slot to be filled with the offset of FuncOffsetTable towards profile start. More...
 
- Protected Attributes inherited from llvm::sampleprof::SampleProfileWriterBinary
MapVector< StringRef, uint32_tNameTable
 
- Protected Attributes inherited from llvm::sampleprof::SampleProfileWriter
std::unique_ptr< raw_ostreamOutputStream
 Output stream where to emit the profile to. More...
 
std::unique_ptr< ProfileSummarySummary
 Profile summary. More...
 
SampleProfileFormat Format = SPF_None
 Profile format. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::sampleprof::SampleProfileWriter
static ErrorOr< std::unique_ptr< SampleProfileWriter > > create (StringRef Filename, SampleProfileFormat Format)
 Profile writer factory. More...
 
static ErrorOr< std::unique_ptr< SampleProfileWriter > > create (std::unique_ptr< raw_ostream > &OS, SampleProfileFormat Format)
 Create a new stream writer based on the value of Format. More...
 

Detailed Description

Definition at line 380 of file SampleProfWriter.h.

Member Function Documentation

◆ write()

std::error_code SampleProfileWriterCompactBinary::write ( const SampleProfileMap ProfileMap)
overridevirtual

Write all the sample profiles in the given map of samples.

Returns
status code of the file update operation.

Reimplemented from llvm::sampleprof::SampleProfileWriter.

Definition at line 453 of file SampleProfWriter.cpp.

References llvm::success, llvm::sampleprof::SampleProfileWriter::write(), and writeFuncOffsetTable().

◆ writeFuncOffsetTable()

std::error_code SampleProfileWriterCompactBinary::writeFuncOffsetTable ( )
protected

◆ writeHeader()

std::error_code SampleProfileWriterCompactBinary::writeHeader ( const SampleProfileMap ProfileMap)
overrideprotectedvirtual

◆ writeNameTable()

std::error_code SampleProfileWriterCompactBinary::writeNameTable ( )
overrideprotectedvirtual

◆ writeSample()

std::error_code SampleProfileWriterCompactBinary::writeSample ( const FunctionSamples S)
overridevirtual

Write samples of a top-level function to a binary file.

Returns
true if the samples were written successfully, false otherwise.

Reimplemented from llvm::sampleprof::SampleProfileWriterBinary.

Definition at line 827 of file SampleProfWriter.cpp.

References llvm::encodeULEB128(), FuncOffsetTable, llvm::sampleprof::SampleProfileWriter::OutputStream, S, and llvm::sampleprof::SampleProfileWriterBinary::writeBody().

Member Data Documentation

◆ FuncOffsetTable

MapVector<StringRef, uint64_t> llvm::sampleprof::SampleProfileWriterCompactBinary::FuncOffsetTable
protected

The table mapping from function name to the offset of its FunctionSample towards profile start.

Definition at line 390 of file SampleProfWriter.h.

Referenced by writeFuncOffsetTable(), and writeSample().

◆ TableOffset

uint64_t llvm::sampleprof::SampleProfileWriterCompactBinary::TableOffset
protected

The offset of the slot to be filled with the offset of FuncOffsetTable towards profile start.

Definition at line 393 of file SampleProfWriter.h.

Referenced by writeFuncOffsetTable(), and writeHeader().


The documentation for this class was generated from the following files: