class SampleRecord

Declaration

class SampleRecord { /* full declaration omitted */ };

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.

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:206

Method Overview

  • public SampleRecord()
  • public static const llvm::sampleprof::SampleRecord::SortedCallTargetSet SortCallTargets(const llvm::sampleprof::SampleRecord::CallTargetMap & Targets)
  • public llvm::sampleprof_error addCalledTarget(llvm::StringRef F, uint64_t S, uint64_t Weight = 1)
  • public llvm::sampleprof_error addSamples(uint64_t S, uint64_t Weight = 1)
  • public void dump() const
  • public const llvm::sampleprof::SampleRecord::CallTargetMap & getCallTargets() const
  • public uint64_t getSamples() const
  • public const llvm::sampleprof::SampleRecord::SortedCallTargetSet getSortedCallTargets() const
  • public bool hasCalls() const
  • public llvm::sampleprof_error merge(const llvm::sampleprof::SampleRecord & Other, uint64_t Weight = 1)
  • public void print(llvm::raw_ostream & OS, unsigned int Indent) const

Methods

SampleRecord()

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:220

static const llvm::sampleprof::SampleRecord::
    SortedCallTargetSet
    SortCallTargets(
        const llvm::sampleprof::SampleRecord::
            CallTargetMap& Targets)

Description

Sort call targets in descending order of call frequency.

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:259

Parameters

const llvm::sampleprof::SampleRecord:: CallTargetMap& Targets

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

Description

Add called function \p F with samples \p S. Optionally scale sample count \p S by \p Weight. Sample counts accumulate using saturating arithmetic, to avoid wrapping around unsigned integers.

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:239

Parameters

llvm::StringRef F
uint64_t S
uint64_t Weight = 1

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

Description

Increment the number of samples for this record by \p S. Optionally scale sample count \p S by \p Weight. Sample counts accumulate using saturating arithmetic, to avoid wrapping around unsigned integers.

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:227

Parameters

uint64_t S
uint64_t Weight = 1

void dump() const

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:278

const llvm::sampleprof::SampleRecord::
    CallTargetMap&
    getCallTargets() const

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:253

uint64_t getSamples() const

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:252

const llvm::sampleprof::SampleRecord::
    SortedCallTargetSet
    getSortedCallTargets() const

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:254

bool hasCalls() const

Description

Return true if this sample record contains function calls.

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:250

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

Description

Merge the samples in \p Other into this record. Optionally scale sample counts by \p Weight.

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:269

Parameters

const llvm::sampleprof::SampleRecord& Other
uint64_t Weight = 1

void print(llvm::raw_ostream& OS,
           unsigned int Indent) const

Declared at: llvm/include/llvm/ProfileData/SampleProf.h:277

Parameters

llvm::raw_ostream& OS
unsigned int Indent