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

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

#include "llvm/ProfileData/SampleProfWriter.h"

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

Public Member Functions

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

Protected Member Functions

 SampleProfileWriterText (std::unique_ptr< raw_ostream > &OS)
 
std::error_code writeHeader (const SampleProfileMap &ProfileMap) override
 Write a file header for the profile file. More...
 
- 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...
 

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

Detailed Description

Sample-based profile writer (text format).

Definition at line 96 of file SampleProfWriter.h.

Constructor & Destructor Documentation

◆ SampleProfileWriterText()

llvm::sampleprof::SampleProfileWriterText::SampleProfileWriterText ( std::unique_ptr< raw_ostream > &  OS)
inlineprotected

Definition at line 101 of file SampleProfWriter.h.

Member Function Documentation

◆ writeHeader()

std::error_code llvm::sampleprof::SampleProfileWriterText::writeHeader ( const SampleProfileMap ProfileMap)
inlineoverrideprotectedvirtual

Write a file header for the profile file.

Implements llvm::sampleprof::SampleProfileWriter.

Definition at line 104 of file SampleProfWriter.h.

References llvm::success.

◆ writeSample()

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

Write samples to a text file.

Note: it may be tempting to implement this in terms of FunctionSamples::print(). Please don't. The dump functionality is intended for debugging and has no specified form.

The format used here is more structured and deliberate because it needs to be parsed by the SampleProfileReaderText class.

Implements llvm::sampleprof::SampleProfileWriter.

Definition at line 469 of file SampleProfWriter.cpp.

References llvm::sampleprof::LineLocation::Discriminator, llvm::X86AS::FS, llvm::sampleprof::SampleSorter< LocationT, SampleT >::get(), I, llvm::sampleprof::LineLocation::LineOffset, llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::sampleprof::FunctionSamples::ProfileIsProbeBased, S, and llvm::success.

Friends And Related Function Documentation

◆ SampleProfileWriter::create

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

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