LLVM 17.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 (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. | |
uint32_t | getNumValueDataForSite (uint32_t ValueKind, uint32_t Site) const |
Return the number of value data collected for ValueKind at profiling site: Site. | |
std::unique_ptr< InstrProfValueData[]> | getValueForSite (uint32_t ValueKind, uint32_t Site, uint64_t *TotalC=nullptr) const |
Return the array of profiled values at Site . | |
uint64_t | getValueForSite (InstrProfValueData Dest[], uint32_t ValueKind, uint32_t Site) const |
Get the target value/counts of kind ValueKind collected at site Site and store the result in array Dest . | |
void | reserveSites (uint32_t ValueKind, uint32_t NumValueSites) |
Reserve space for NumValueSites sites. | |
void | addValueData (uint32_t ValueKind, uint32_t Site, InstrProfValueData *VData, uint32_t N, 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 |
Profiling information for a single function.
Definition at line 743 of file InstrProf.h.
Enumerator | |
---|---|
NotPseudo | |
PseudoHot | |
PseudoWarm |
Definition at line 840 of file InstrProf.h.
Enumerator | |
---|---|
HotFunctionVal | |
WarmFunctionVal |
Definition at line 845 of file InstrProf.h.
|
default |
|
inline |
Definition at line 747 of file InstrProf.h.
|
default |
|
inline |
Definition at line 749 of file InstrProf.h.
void llvm::InstrProfRecord::accumulateCounts | ( | CountSumOrPercent & | Sum | ) | const |
Compute the sums of all counts and store in Sum.
Definition at line 539 of file InstrProf.cpp.
References Counts, llvm::CountSumOrPercent::CountSum, getNumValueDataForSite(), getNumValueSites(), getValueForSite(), I, llvm::CountSumOrPercent::NumEntries, and llvm::CountSumOrPercent::ValueCounts.
Referenced by overlap().
void llvm::InstrProfRecord::addValueData | ( | uint32_t | ValueKind, |
uint32_t | Site, | ||
InstrProfValueData * | VData, | ||
uint32_t | N, | ||
InstrProfSymtab * | SymTab | ||
) |
Add ValueData for ValueKind at value Site.
Definition at line 792 of file InstrProf.cpp.
|
inline |
Clear value data entries and edge counters.
Definition at line 820 of file InstrProf.h.
References clearValueData(), and Counts.
|
inline |
|
inline |
Definition at line 849 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 951 of file InstrProf.h.
References N.
|
inline |
Return the number of value data collected for ValueKind at profiling site: Site.
Definition at line 962 of file InstrProf.h.
Referenced by accumulateCounts(), llvm::annotateValueSite(), and getValueForSite().
|
inline |
Return the number of value profile kinds with non-zero number of profile sites.
Definition at line 944 of file InstrProf.h.
Return the number of instrumented sites for ValueKind.
Definition at line 958 of file InstrProf.h.
Referenced by accumulateCounts(), overlap(), and overlapValueProfData().
|
inline |
Get the target value/counts of kind ValueKind
collected at site Site
and store the result in array Dest
.
Return the total counts of all target values at this site.
Definition at line 984 of file InstrProf.h.
References I, and llvm::SaturatingAdd().
|
inline |
Return the array of profiled values at Site
.
If TotalC
is not null, the total count of all target values at this site will be stored in *TotalC
.
Definition at line 968 of file InstrProf.h.
References getNumValueDataForSite(), getValueForSite(), and N.
Referenced by accumulateCounts(), llvm::annotateValueSite(), and getValueForSite().
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 712 of file InstrProf.cpp.
References llvm::count_mismatch, llvm::counter_overflow, Counts, E, getCountPseudoKind(), llvm::getInstrMaxCountValue(), I, NotPseudo, llvm::Other, PseudoHot, PseudoWarm, llvm::SaturatingMultiplyAdd(), and setPseudoCount().
|
inline |
Definition at line 755 of file InstrProf.h.
|
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 608 of file InstrProf.cpp.
References accumulateCounts(), llvm::OverlapStats::addOneMismatch(), assert(), llvm::OverlapStats::Base, Counts, llvm::CountSumOrPercent::CountSum, E, 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 590 of file InstrProf.cpp.
References assert(), getNumValueSites(), I, llvm::Other, and overlap().
Referenced by overlap().
Reserve space for NumValueSites sites.
Definition at line 998 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 763 of file InstrProf.cpp.
References assert(), llvm::counter_overflow, Counts, D, llvm::getInstrMaxCountValue(), N, and llvm::SaturatingMultiply().
|
inline |
Definition at line 857 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 813 of file InstrProf.h.
std::vector<uint64_t> llvm::InstrProfRecord::Counts |
Definition at line 744 of file InstrProf.h.
Referenced by accumulateCounts(), Clear(), llvm::InstrProfRecordWriterTrait::EmitData(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), getCountPseudoKind(), merge(), operator=(), overlap(), scale(), and setPseudoCount().