LLVM 20.0.0git
|
Sample-based profile writer (text format). More...
#include "llvm/ProfileData/SampleProfWriter.h"
Public Member Functions | |
std::error_code | writeSample (const FunctionSamples &S) override |
Write samples to a text file. | |
Public Member Functions inherited from llvm::sampleprof::SampleProfileWriter | |
virtual | ~SampleProfileWriter ()=default |
virtual std::error_code | writeSample (const FunctionSamples &S)=0 |
Write sample profiles in S . | |
virtual std::error_code | write (const SampleProfileMap &ProfileMap) |
Write all the sample profiles in the given map of samples. | |
template<typename FunctionPruningStrategy = DefaultFunctionPruningStrategy> | |
std::error_code | writeWithSizeLimit (SampleProfileMap &ProfileMap, size_t OutputSizeLimit) |
Write sample profiles up to given size limit, using the pruning strategy to drop some functions if necessary. | |
raw_ostream & | getOutputStream () |
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. | |
Protected Member Functions inherited from llvm::sampleprof::SampleProfileWriter | |
SampleProfileWriter (std::unique_ptr< raw_ostream > &OS) | |
virtual std::error_code | writeHeader (const SampleProfileMap &ProfileMap)=0 |
Write a file header for the profile file. | |
virtual std::error_code | writeFuncProfiles (const SampleProfileMap &ProfileMap) |
std::error_code | writeWithSizeLimitInternal (SampleProfileMap &ProfileMap, size_t OutputSizeLimit, FunctionPruningStrategy *Strategy) |
void | computeSummary (const SampleProfileMap &ProfileMap) |
Compute summary for this profile. | |
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. | |
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 . | |
Protected Attributes inherited from llvm::sampleprof::SampleProfileWriter | |
size_t | LineCount |
For writeWithSizeLimit in text mode, each newline takes 1 additional byte on Windows when actually written to the file, but not written to a memory buffer. | |
std::unique_ptr< raw_ostream > | OutputStream |
Output stream where to emit the profile to. | |
std::unique_ptr< ProfileSummary > | Summary |
Profile summary. | |
SampleProfileFormat | Format = SPF_None |
Profile format. | |
Sample-based profile writer (text format).
Definition at line 166 of file SampleProfWriter.h.
|
inlineprotected |
Definition at line 171 of file SampleProfWriter.h.
|
inlineoverrideprotectedvirtual |
Write a file header for the profile file.
Implements llvm::sampleprof::SampleProfileWriter.
Definition at line 174 of file SampleProfWriter.h.
References llvm::sampleprof::SampleProfileWriter::LineCount, and llvm::success.
|
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 568 of file SampleProfWriter.cpp.
References llvm::sampleprof::LineLocation::Discriminator, llvm::sampleprof::SampleSorter< LocationT, SampleT >::get(), llvm::sampleprof::SampleContext::getAllAttributes(), llvm::sampleprof::FunctionSamples::getBodySamples(), llvm::sampleprof::FunctionSamples::getCallsiteSamples(), llvm::sampleprof::FunctionSamples::getContext(), llvm::sampleprof::FunctionSamples::getFunction(), llvm::sampleprof::FunctionSamples::getFunctionHash(), llvm::sampleprof::FunctionSamples::getHeadSamples(), llvm::sampleprof::SampleRecord::getSamples(), llvm::sampleprof::SampleRecord::getSortedCallTargets(), llvm::sampleprof::FunctionSamples::getTotalSamples(), I, llvm::raw_ostream::indent(), llvm::sampleprof::SampleProfileWriter::LineCount, llvm::sampleprof::LineLocation::LineOffset, OS, llvm::sampleprof::SampleProfileWriter::OutputStream, llvm::sampleprof::FunctionSamples::ProfileIsCS, llvm::sampleprof::FunctionSamples::ProfileIsProbeBased, llvm::success, llvm::sampleprof::SampleContext::toString(), and writeSample().
Referenced by writeSample().
|
friend |