LLVM  3.7.0
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
llvm::sampleprof::SampleProfileWriter Class Referenceabstract

Sample-based profile writer. Base class. More...

#include <SampleProfWriter.h>

Inheritance diagram for llvm::sampleprof::SampleProfileWriter:
[legend]
Collaboration diagram for llvm::sampleprof::SampleProfileWriter:
[legend]

Public Member Functions

 SampleProfileWriter (StringRef Filename, std::error_code &EC, sys::fs::OpenFlags Flags)
 
virtual ~SampleProfileWriter ()
 
virtual bool write (StringRef FName, const FunctionSamples &S)=0
 Write sample profiles in S for function FName. More...
 
bool write (const Function &F, const FunctionSamples &S)
 Write sample profiles in S for function F. More...
 
bool write (const Module &M, StringMap< FunctionSamples > &P)
 Write all the sample profiles for all the functions in M. More...
 
bool write (StringMap< FunctionSamples > &ProfileMap)
 Write all the sample profiles in the given map of samples. More...
 

Static Public Member Functions

static ErrorOr
< std::unique_ptr
< SampleProfileWriter > > 
create (StringRef Filename, SampleProfileFormat Format)
 Profile writer factory. More...
 

Protected Attributes

raw_fd_ostream OS
 Output stream where to emit the profile to. More...
 

Detailed Description

Sample-based profile writer. Base class.

Definition at line 31 of file SampleProfWriter.h.

Constructor & Destructor Documentation

llvm::sampleprof::SampleProfileWriter::SampleProfileWriter ( StringRef  Filename,
std::error_code &  EC,
sys::fs::OpenFlags  Flags 
)
inline

Definition at line 33 of file SampleProfWriter.h.

virtual llvm::sampleprof::SampleProfileWriter::~SampleProfileWriter ( )
inlinevirtual

Definition at line 36 of file SampleProfWriter.h.

Member Function Documentation

ErrorOr< std::unique_ptr< SampleProfileWriter > > SampleProfileWriter::create ( StringRef  Filename,
SampleProfileFormat  Format 
)
static

Profile writer factory.

Create a sample profile writer based on the specified format.

Create a new writer based on the value of Format.

Parameters
FilenameThe file to create.
WriterThe writer to instantiate according to the specified format.
FormatEncoding format for the profile file.
Returns
an error code indicating the status of the created writer.

Definition at line 111 of file SampleProfWriter.cpp.

References llvm::sampleprof::SPF_Binary, llvm::sampleprof::SPF_Text, and llvm::unrecognized_format.

virtual bool llvm::sampleprof::SampleProfileWriter::write ( StringRef  FName,
const FunctionSamples S 
)
pure virtual

Write sample profiles in S for function FName.

Returns
true if the file was updated successfully. False, otherwise.

Implemented in llvm::sampleprof::SampleProfileWriterBinary, and llvm::sampleprof::SampleProfileWriterText.

Referenced by write(), llvm::sampleprof::SampleProfileWriterText::write(), and llvm::sampleprof::SampleProfileWriterBinary::write().

bool llvm::sampleprof::SampleProfileWriter::write ( const Function F,
const FunctionSamples S 
)
inline

Write sample profiles in S for function F.

Definition at line 44 of file SampleProfWriter.h.

References llvm::Value::getName(), and write().

bool llvm::sampleprof::SampleProfileWriter::write ( const Module M,
StringMap< FunctionSamples > &  P 
)
inline

Write all the sample profiles for all the functions in M.

Returns
true if the file was updated successfully. False, otherwise.

Definition at line 51 of file SampleProfWriter.h.

References F(), and write().

bool llvm::sampleprof::SampleProfileWriter::write ( StringMap< FunctionSamples > &  ProfileMap)
inline

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

Returns
true if the file was updated successfully. False, otherwise.

Definition at line 63 of file SampleProfWriter.h.

References I, and write().

Member Data Documentation

raw_fd_ostream llvm::sampleprof::SampleProfileWriter::OS
protected

Output stream where to emit the profile to.

Definition at line 80 of file SampleProfWriter.h.

Referenced by llvm::sampleprof::SampleProfileWriterBinary::SampleProfileWriterBinary(), and llvm::sampleprof::SampleProfileWriterBinary::write().


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