LLVM
8.0.1
|
Sample-based profile writer. Base class. More...
#include "llvm/ProfileData/SampleProfWriter.h"
Public Member Functions | |
virtual | ~SampleProfileWriter ()=default |
virtual std::error_code | write (const FunctionSamples &S)=0 |
Write sample profiles in S . More... | |
virtual std::error_code | write (const StringMap< FunctionSamples > &ProfileMap) |
Write all the sample profiles in the given map of samples. More... | |
raw_ostream & | getOutputStream () |
Static Public Member Functions | |
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 Member Functions | |
SampleProfileWriter (std::unique_ptr< raw_ostream > &OS) | |
virtual std::error_code | writeHeader (const StringMap< FunctionSamples > &ProfileMap)=0 |
Write a file header for the profile file. More... | |
void | computeSummary (const StringMap< FunctionSamples > &ProfileMap) |
Compute summary for this profile. More... | |
Protected Attributes | |
std::unique_ptr< raw_ostream > | OutputStream |
Output stream where to emit the profile to. More... | |
std::unique_ptr< ProfileSummary > | Summary |
Profile summary. More... | |
Sample-based profile writer. Base class.
Definition at line 33 of file SampleProfWriter.h.
|
virtualdefault |
|
inlineprotected |
Definition at line 61 of file SampleProfWriter.h.
References writeHeader().
|
protected |
Compute summary for this profile.
Definition at line 394 of file SampleProfWriter.cpp.
References llvm::SampleProfileSummaryBuilder::addRecord(), llvm::ProfileSummaryBuilder::DefaultCutoffs, llvm::SampleProfileSummaryBuilder::getSummary(), I, and Summary.
Referenced by llvm::sampleprof::SampleProfileWriterBinary::writeHeader().
|
static |
Profile writer factory.
Create a sample profile file writer based on the specified format.
Create a new file writer based on the value of Format
.
Filename | The file to create. |
Format | Encoding format for the profile file. |
Definition at line 351 of file SampleProfWriter.cpp.
References llvm::sys::fs::F_None, llvm::sys::fs::F_Text, llvm::sampleprof::SPF_Binary, and llvm::sampleprof::SPF_Compact_Binary.
Referenced by getOutputStream(), and llvm::sampleprof::SampleProfileWriterText::writeHeader().
|
static |
Create a new stream writer based on the value of Format
.
Create a sample profile stream writer based on the specified format.
For testing.
OS | The output stream to store the profile data to. |
Format | Encoding format for the profile file. |
Definition at line 372 of file SampleProfWriter.cpp.
References llvm::sampleprof::SPF_Binary, llvm::sampleprof::SPF_Compact_Binary, llvm::sampleprof::SPF_GCC, llvm::sampleprof::SPF_Text, llvm::unrecognized_format, and llvm::unsupported_writing_format.
|
inline |
Definition at line 47 of file SampleProfWriter.h.
References create(), llvm::Format, and OutputStream.
|
pure virtual |
Write sample profiles in S
.
Implemented in llvm::sampleprof::SampleProfileWriterCompactBinary, llvm::sampleprof::SampleProfileWriterBinary, and llvm::sampleprof::SampleProfileWriterText.
Referenced by write(), llvm::sampleprof::SampleProfileWriterText::write(), and llvm::sampleprof::SampleProfileWriterCompactBinary::write().
|
virtual |
Write all the sample profiles in the given map of samples.
Reimplemented in llvm::sampleprof::SampleProfileWriterCompactBinary.
Definition at line 44 of file SampleProfWriter.cpp.
References B, I, llvm::success, write(), and writeHeader().
|
protectedpure virtual |
Write a file header for the profile file.
Implemented in llvm::sampleprof::SampleProfileWriterCompactBinary, llvm::sampleprof::SampleProfileWriterBinary, and llvm::sampleprof::SampleProfileWriterText.
Referenced by SampleProfileWriter(), llvm::sampleprof::SampleProfileWriterBinary::SampleProfileWriterBinary(), and write().
|
protected |
Output stream where to emit the profile to.
Definition at line 69 of file SampleProfWriter.h.
Referenced by getOutputStream(), llvm::sampleprof::SampleProfileWriterText::write(), llvm::sampleprof::SampleProfileWriterBinary::write(), llvm::sampleprof::SampleProfileWriterCompactBinary::write(), llvm::sampleprof::SampleProfileWriterBinary::writeBody(), llvm::sampleprof::SampleProfileWriterCompactBinary::writeFuncOffsetTable(), llvm::sampleprof::SampleProfileWriterRawBinary::writeMagicIdent(), llvm::sampleprof::SampleProfileWriterCompactBinary::writeMagicIdent(), llvm::sampleprof::SampleProfileWriterRawBinary::writeNameTable(), llvm::sampleprof::SampleProfileWriterCompactBinary::writeNameTable(), and llvm::sampleprof::SampleProfileWriterBinary::writeSummary().
|
protected |
Profile summary.
Definition at line 72 of file SampleProfWriter.h.
Referenced by computeSummary(), and llvm::sampleprof::SampleProfileWriterBinary::writeSummary().