LLVM 19.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. | |
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 |
std::vector< uint8_t > | BitmapBytes |
Profiling information for a single function.
Definition at line 704 of file InstrProf.h.
Enumerator | |
---|---|
NotPseudo | |
PseudoHot | |
PseudoWarm |
Definition at line 806 of file InstrProf.h.
Enumerator | |
---|---|
HotFunctionVal | |
WarmFunctionVal |
Definition at line 811 of file InstrProf.h.
|
default |
|
inline |
Definition at line 709 of file InstrProf.h.
|
inline |
Definition at line 710 of file InstrProf.h.
|
default |
|
inline |
Definition at line 714 of file InstrProf.h.
void llvm::InstrProfRecord::accumulateCounts | ( | CountSumOrPercent & | Sum | ) | const |
Compute the sums of all counts and store in Sum.
Definition at line 639 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 904 of file InstrProf.cpp.
|
inline |
Clear value data entries and edge counters.
Definition at line 786 of file InstrProf.h.
References clearValueData(), and Counts.
|
inline |
|
inline |
Definition at line 815 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 925 of file InstrProf.h.
References N.
|
inline |
Return the number of value data collected for ValueKind at profiling site: Site.
Definition at line 936 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 918 of file InstrProf.h.
Return the number of instrumented sites for ValueKind.
Definition at line 932 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 958 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 942 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 812 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 720 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 708 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 690 of file InstrProf.cpp.
References assert(), getNumValueSites(), I, llvm::Other, and overlap().
Referenced by overlap().
Reserve space for NumValueSites sites.
Definition at line 972 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 875 of file InstrProf.cpp.
References assert(), llvm::counter_overflow, Counts, D, llvm::getInstrMaxCountValue(), N, and llvm::SaturatingMultiply().
|
inline |
Definition at line 823 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 779 of file InstrProf.h.
std::vector<uint8_t> llvm::InstrProfRecord::BitmapBytes |
Definition at line 706 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 705 of file InstrProf.h.
Referenced by accumulateCounts(), Clear(), llvm::InstrProfRecordWriterTrait::EmitData(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), getCountPseudoKind(), merge(), operator=(), overlap(), scale(), and setPseudoCount().