LLVM 20.0.0git
|
Profiling information for a single function. More...
#include "llvm/ProfileData/InstrProf.h"
Public Types | |
enum | CountPseudoKind { NotPseudo = 0 , PseudoHot , PseudoWarm } |
enum | PseudoCountVal { HotFunctionVal = -1 , WarmFunctionVal = -2 } |
Public Member Functions | |
InstrProfRecord ()=default | |
InstrProfRecord (std::vector< uint64_t > Counts) | |
InstrProfRecord (std::vector< uint64_t > Counts, std::vector< uint8_t > BitmapBytes) | |
InstrProfRecord (InstrProfRecord &&)=default | |
InstrProfRecord (const InstrProfRecord &RHS) | |
InstrProfRecord & | operator= (InstrProfRecord &&)=default |
InstrProfRecord & | operator= (const InstrProfRecord &RHS) |
uint32_t | getNumValueKinds () const |
Return the number of value profile kinds with non-zero number of profile sites. | |
uint32_t | getNumValueSites (uint32_t ValueKind) const |
Return the number of instrumented sites for ValueKind. | |
uint32_t | getNumValueData (uint32_t ValueKind) const |
Return the total number of ValueData for ValueKind. | |
ArrayRef< InstrProfValueData > | getValueArrayForSite (uint32_t ValueKind, uint32_t Site) const |
Return the array of profiled values at Site . | |
void | reserveSites (uint32_t ValueKind, uint32_t NumValueSites) |
Reserve space for NumValueSites sites. | |
void | addValueData (uint32_t ValueKind, uint32_t Site, ArrayRef< InstrProfValueData > VData, InstrProfSymtab *SymTab) |
Add ValueData for ValueKind at value Site. | |
void | merge (InstrProfRecord &Other, uint64_t Weight, function_ref< void(instrprof_error)> Warn) |
Merge the counts in Other into this one. | |
void | scale (uint64_t N, uint64_t D, function_ref< void(instrprof_error)> Warn) |
Scale up profile counts (including value profile data) by a factor of (N / D). | |
void | sortValueData () |
Sort value profile data (per site) by count. | |
void | Clear () |
Clear value data entries and edge counters. | |
void | clearValueData () |
Clear value data entries. | |
void | accumulateCounts (CountSumOrPercent &Sum) const |
Compute the sums of all counts and store in Sum. | |
void | overlap (InstrProfRecord &Other, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap, uint64_t ValueCutoff) |
Compute the overlap b/w this IntrprofRecord and Other. | |
void | overlapValueProfData (uint32_t ValueKind, InstrProfRecord &Src, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap) |
Compute the overlap of value profile counts. | |
CountPseudoKind | getCountPseudoKind () const |
void | setPseudoCount (CountPseudoKind Kind) |
Public Attributes | |
std::vector< uint64_t > | Counts |
std::vector< uint8_t > | BitmapBytes |
Profiling information for a single function.
Definition at line 831 of file InstrProf.h.
Enumerator | |
---|---|
NotPseudo | |
PseudoHot | |
PseudoWarm |
Definition at line 920 of file InstrProf.h.
Enumerator | |
---|---|
HotFunctionVal | |
WarmFunctionVal |
Definition at line 925 of file InstrProf.h.
|
default |
|
inline |
Definition at line 836 of file InstrProf.h.
|
inline |
Definition at line 837 of file InstrProf.h.
|
default |
|
inline |
Definition at line 841 of file InstrProf.h.
void llvm::InstrProfRecord::accumulateCounts | ( | CountSumOrPercent & | Sum | ) | const |
Compute the sums of all counts and store in Sum.
Definition at line 742 of file InstrProf.cpp.
References Counts, llvm::CountSumOrPercent::CountSum, getNumValueSites(), getValueArrayForSite(), I, llvm::CountSumOrPercent::NumEntries, and llvm::CountSumOrPercent::ValueCounts.
Referenced by overlap().
void llvm::InstrProfRecord::addValueData | ( | uint32_t | ValueKind, |
uint32_t | Site, | ||
ArrayRef< InstrProfValueData > | VData, | ||
InstrProfSymtab * | SymTab | ||
) |
Add ValueData for ValueKind at value Site.
We do not support adding sites out of order. Site must go up from 0 one by one.
Definition at line 1015 of file InstrProf.cpp.
References assert(), and llvm::ArrayRef< T >::size().
|
inline |
Clear value data entries and edge counters.
Definition at line 900 of file InstrProf.h.
References clearValueData(), and Counts.
|
inline |
|
inline |
Definition at line 929 of file InstrProf.h.
References Counts, HotFunctionVal, NotPseudo, PseudoHot, PseudoWarm, and WarmFunctionVal.
Referenced by merge().
Return the total number of ValueData for ValueKind.
Definition at line 1024 of file InstrProf.h.
References N.
|
inline |
Return the number of value profile kinds with non-zero number of profile sites.
Definition at line 1017 of file InstrProf.h.
Return the number of instrumented sites for ValueKind.
Definition at line 1031 of file InstrProf.h.
Referenced by accumulateCounts(), overlap(), and overlapValueProfData().
|
inline |
Return the array of profiled values at Site
.
Definition at line 1036 of file InstrProf.h.
Referenced by accumulateCounts(), llvm::annotateValueSite(), and llvm::getNumValueDataForSiteInstrProf().
void llvm::InstrProfRecord::merge | ( | InstrProfRecord & | Other, |
uint64_t | Weight, | ||
function_ref< void(instrprof_error)> | Warn | ||
) |
Merge the counts in Other
into this one.
Optionally scale merged counts by Weight
.
Definition at line 920 of file InstrProf.cpp.
References llvm::bitmap_mismatch, BitmapBytes, llvm::count_mismatch, llvm::counter_overflow, Counts, getCountPseudoKind(), llvm::getInstrMaxCountValue(), I, NotPseudo, llvm::Other, PseudoHot, PseudoWarm, llvm::SaturatingMultiplyAdd(), and setPseudoCount().
|
inline |
Definition at line 847 of file InstrProf.h.
References BitmapBytes, Counts, and RHS.
|
default |
void llvm::InstrProfRecord::overlap | ( | InstrProfRecord & | Other, |
OverlapStats & | Overlap, | ||
OverlapStats & | FuncLevelOverlap, | ||
uint64_t | ValueCutoff | ||
) |
Compute the overlap b/w this IntrprofRecord and Other.
Definition at line 809 of file InstrProf.cpp.
References accumulateCounts(), llvm::OverlapStats::addOneMismatch(), assert(), llvm::OverlapStats::Base, Counts, llvm::CountSumOrPercent::CountSum, getNumValueSites(), I, llvm::CountSumOrPercent::NumEntries, llvm::Other, llvm::OverlapStats::Overlap, overlapValueProfData(), llvm::OverlapStats::score(), llvm::OverlapStats::Test, and llvm::OverlapStats::Valid.
Referenced by llvm::InstrProfWriter::overlapRecord(), and overlapValueProfData().
void llvm::InstrProfRecord::overlapValueProfData | ( | uint32_t | ValueKind, |
InstrProfRecord & | Src, | ||
OverlapStats & | Overlap, | ||
OverlapStats & | FuncLevelOverlap | ||
) |
Compute the overlap of value profile counts.
Definition at line 791 of file InstrProf.cpp.
References assert(), getNumValueSites(), I, llvm::Other, and overlap().
Referenced by overlap().
Reserve space for NumValueSites sites.
Definition at line 1040 of file InstrProf.h.
void llvm::InstrProfRecord::scale | ( | uint64_t | N, |
uint64_t | D, | ||
function_ref< void(instrprof_error)> | Warn | ||
) |
Scale up profile counts (including value profile data) by a factor of (N / D).
Definition at line 983 of file InstrProf.cpp.
References assert(), llvm::counter_overflow, Counts, D, llvm::getInstrMaxCountValue(), N, and llvm::SaturatingMultiply().
|
inline |
Definition at line 937 of file InstrProf.h.
References Counts, HotFunctionVal, PseudoHot, PseudoWarm, and WarmFunctionVal.
Referenced by merge().
|
inline |
Sort value profile data (per site) by count.
Definition at line 893 of file InstrProf.h.
std::vector<uint8_t> llvm::InstrProfRecord::BitmapBytes |
Definition at line 833 of file InstrProf.h.
Referenced by llvm::InstrProfRecordWriterTrait::EmitData(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), merge(), and operator=().
std::vector<uint64_t> llvm::InstrProfRecord::Counts |
Definition at line 832 of file InstrProf.h.
Referenced by accumulateCounts(), Clear(), llvm::InstrProfRecordWriterTrait::EmitData(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), getCountPseudoKind(), merge(), operator=(), overlap(), scale(), and setPseudoCount().