LLVM  4.0.0
Public Types | Public Member Functions | List of all members
llvm::sampleprof::SampleRecord Class Reference

Representation of a single sample record. More...

#include <SampleProf.h>

Public Types

typedef StringMap< uint64_t > CallTargetMap
 

Public Member Functions

 SampleRecord ()
 
sampleprof_error addSamples (uint64_t S, uint64_t Weight=1)
 Increment the number of samples for this record by S. More...
 
sampleprof_error addCalledTarget (StringRef F, uint64_t S, uint64_t Weight=1)
 Add called function F with samples S. More...
 
bool hasCalls () const
 Return true if this sample record contains function calls. More...
 
uint64_t getSamples () const
 
const CallTargetMapgetCallTargets () const
 
sampleprof_error merge (const SampleRecord &Other, uint64_t Weight=1)
 Merge the samples in Other into this record. More...
 
void print (raw_ostream &OS, unsigned Indent) const
 Print the sample record to the stream OS indented by Indent. More...
 
void dump () const
 

Detailed Description

Representation of a single sample record.

A sample record is represented by a positive integer value, which indicates how frequently was the associated line location executed.

Additionally, if the associated location contains a function call, the record will hold a list of all the possible called targets. For direct calls, this will be the exact function being invoked. For indirect calls (function pointers, virtual table dispatch), this will be a list of one or more functions.

Definition at line 113 of file SampleProf.h.

Member Typedef Documentation

Definition at line 115 of file SampleProf.h.

Constructor & Destructor Documentation

llvm::sampleprof::SampleRecord::SampleRecord ( )
inline

Definition at line 117 of file SampleProf.h.

Member Function Documentation

sampleprof_error llvm::sampleprof::SampleRecord::addCalledTarget ( StringRef  F,
uint64_t  S,
uint64_t  Weight = 1 
)
inline

Add called function F with samples S.

Optionally scale sample count S by Weight.

Sample counts accumulate using saturating arithmetic, to avoid wrapping around unsigned integers.

Definition at line 136 of file SampleProf.h.

References llvm::counter_overflow, F, llvm::SaturatingMultiplyAdd(), and llvm::success.

Referenced by merge().

sampleprof_error llvm::sampleprof::SampleRecord::addSamples ( uint64_t  S,
uint64_t  Weight = 1 
)
inline

Increment the number of samples for this record by S.

Optionally scale sample count S by Weight.

Sample counts accumulate using saturating arithmetic, to avoid wrapping around unsigned integers.

Definition at line 124 of file SampleProf.h.

References llvm::counter_overflow, llvm::SaturatingMultiplyAdd(), and llvm::success.

Referenced by merge().

LLVM_DUMP_METHOD void SampleRecord::dump ( ) const

Definition at line 90 of file SampleProf.cpp.

References llvm::dbgs().

const CallTargetMap& llvm::sampleprof::SampleRecord::getCallTargets ( ) const
inline
uint64_t llvm::sampleprof::SampleRecord::getSamples ( ) const
inline
bool llvm::sampleprof::SampleRecord::hasCalls ( ) const
inline

Return true if this sample record contains function calls.

Definition at line 147 of file SampleProf.h.

References llvm::StringMapImpl::size().

sampleprof_error llvm::sampleprof::SampleRecord::merge ( const SampleRecord Other,
uint64_t  Weight = 1 
)
inline

Merge the samples in Other into this record.

Optionally scale sample counts by Weight.

Definition at line 154 of file SampleProf.h.

References addCalledTarget(), addSamples(), getCallTargets(), getSamples(), I, and llvm::MergeResult().

void SampleRecord::print ( raw_ostream OS,
unsigned  Indent 
) const

Print the sample record to the stream OS indented by Indent.

Definition at line 80 of file SampleProf.cpp.

References I.

Referenced by llvm::sampleprof::operator<<().


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