LLVM 18.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 689 of file InstrProf.h.
Enumerator | |
---|---|
NotPseudo | |
PseudoHot | |
PseudoWarm |
Definition at line 791 of file InstrProf.h.
Enumerator | |
---|---|
HotFunctionVal | |
WarmFunctionVal |
Definition at line 796 of file InstrProf.h.
|
default |
|
inline |
Definition at line 694 of file InstrProf.h.
|
inline |
Definition at line 695 of file InstrProf.h.
|
default |
|
inline |
Definition at line 699 of file InstrProf.h.
void llvm::InstrProfRecord::accumulateCounts | ( | CountSumOrPercent & | Sum | ) | const |
Compute the sums of all counts and store in Sum.
Definition at line 622 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 887 of file InstrProf.cpp.
|
inline |
Clear value data entries and edge counters.
Definition at line 771 of file InstrProf.h.
References clearValueData(), and Counts.
|
inline |
|
inline |
Definition at line 800 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 907 of file InstrProf.h.
References N.
|
inline |
Return the number of value data collected for ValueKind at profiling site: Site.
Definition at line 918 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 900 of file InstrProf.h.
Return the number of instrumented sites for ValueKind.
Definition at line 914 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 940 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 924 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 795 of file InstrProf.cpp.
References llvm::bitmap_mismatch, BitmapBytes, 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 705 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 691 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 673 of file InstrProf.cpp.
References assert(), getNumValueSites(), I, llvm::Other, and overlap().
Referenced by overlap().
Reserve space for NumValueSites sites.
Definition at line 954 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 858 of file InstrProf.cpp.
References assert(), llvm::counter_overflow, Counts, D, llvm::getInstrMaxCountValue(), N, and llvm::SaturatingMultiply().
|
inline |
Definition at line 808 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 764 of file InstrProf.h.
std::vector<uint8_t> llvm::InstrProfRecord::BitmapBytes |
Definition at line 691 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 690 of file InstrProf.h.
Referenced by accumulateCounts(), Clear(), llvm::InstrProfRecordWriterTrait::EmitData(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), getCountPseudoKind(), merge(), operator=(), overlap(), scale(), and setPseudoCount().