LLVM  8.0.1
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::sampleprof::SampleProfileWriterBinary Class Referenceabstract

Sample-based profile writer (binary format). More...

#include "llvm/ProfileData/SampleProfWriter.h"

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

Public Member Functions

virtual std::error_code write (const FunctionSamples &S) override
 Write samples of a top-level function to a binary file. More...
 
 SampleProfileWriterBinary (std::unique_ptr< raw_ostream > &OS)
 
- Public Member Functions inherited from llvm::sampleprof::SampleProfileWriter
virtual ~SampleProfileWriter ()=default
 
virtual std::error_code write (const StringMap< FunctionSamples > &ProfileMap)
 Write all the sample profiles in the given map of samples. More...
 
raw_ostreamgetOutputStream ()
 

Protected Member Functions

virtual std::error_code writeNameTable ()=0
 
virtual std::error_code writeMagicIdent ()=0
 
virtual std::error_code writeHeader (const StringMap< FunctionSamples > &ProfileMap) override
 Write a file header for the profile file. More...
 
std::error_code writeSummary ()
 
std::error_code writeNameIdx (StringRef FName)
 
std::error_code writeBody (const FunctionSamples &S)
 
void stablizeNameTable (std::set< StringRef > &V)
 
- Protected Member Functions inherited from llvm::sampleprof::SampleProfileWriter
 SampleProfileWriter (std::unique_ptr< raw_ostream > &OS)
 
void computeSummary (const StringMap< FunctionSamples > &ProfileMap)
 Compute summary for this profile. More...
 

Protected Attributes

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...
 

Friends

ErrorOr< std::unique_ptr< SampleProfileWriter > > SampleProfileWriter::create (std::unique_ptr< raw_ostream > &OS, SampleProfileFormat Format)
 

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

Sample-based profile writer (binary format).

Definition at line 104 of file SampleProfWriter.h.

Constructor & Destructor Documentation

◆ SampleProfileWriterBinary()

llvm::sampleprof::SampleProfileWriterBinary::SampleProfileWriterBinary ( std::unique_ptr< raw_ostream > &  OS)
inline

Member Function Documentation

◆ stablizeNameTable()

void SampleProfileWriterBinary::stablizeNameTable ( std::set< StringRef > &  V)
inlineprotected

Definition at line 159 of file SampleProfWriter.cpp.

References I, and N.

◆ write()

std::error_code SampleProfileWriterBinary::write ( 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.

Implements llvm::sampleprof::SampleProfileWriter.

Reimplemented in llvm::sampleprof::SampleProfileWriterCompactBinary.

Definition at line 329 of file SampleProfWriter.cpp.

References llvm::encodeULEB128(), llvm::sampleprof::FunctionSamples::getHeadSamples(), and llvm::sampleprof::SampleProfileWriter::OutputStream.

◆ writeBody()

std::error_code SampleProfileWriterBinary::writeBody ( const FunctionSamples S)
protected

◆ writeHeader()

std::error_code SampleProfileWriterBinary::writeHeader ( const StringMap< FunctionSamples > &  ProfileMap)
overrideprotectedvirtual

◆ writeMagicIdent()

virtual std::error_code llvm::sampleprof::SampleProfileWriterBinary::writeMagicIdent ( )
protectedpure virtual

◆ writeNameIdx()

std::error_code SampleProfileWriterBinary::writeNameIdx ( StringRef  FName)
protected

◆ writeNameTable()

virtual std::error_code llvm::sampleprof::SampleProfileWriterBinary::writeNameTable ( )
protectedpure virtual

◆ writeSummary()

std::error_code SampleProfileWriterBinary::writeSummary ( )
protected

Friends And Related Function Documentation

◆ SampleProfileWriter::create

ErrorOr<std::unique_ptr<SampleProfileWriter> > SampleProfileWriter::create ( std::unique_ptr< raw_ostream > &  OS,
SampleProfileFormat  Format 
)
friend

Member Data Documentation

◆ NameTable

MapVector<StringRef, uint32_t> llvm::sampleprof::SampleProfileWriterBinary::NameTable
protected

Definition at line 120 of file SampleProfWriter.h.


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