24 cl::desc(
"Merge context profiles before calculating thresholds."));
35 cl::desc(
"A count is hot if it exceeds the minimum count to"
36 " reach this percentile of total counts."));
40 cl::desc(
"A count is cold if it is below the minimum count"
41 " to reach this percentile of total counts."));
44 "profile-summary-huge-working-set-size-threshold",
cl::Hidden,
46 cl::desc(
"The code working set size is considered huge if the number of"
47 " blocks required to reach the -profile-summary-cutoff-hot"
48 " percentile exceeds this count."));
51 "profile-summary-large-working-set-size-threshold",
cl::Hidden,
53 cl::desc(
"The code working set size is considered large if the number of"
54 " blocks required to reach the -profile-summary-cutoff-hot"
55 " percentile exceeds this count."));
61 cl::desc(
"A fixed hot count that overrides the count derived from"
62 " profile-summary-cutoff-hot"));
66 cl::desc(
"A fixed cold count that overrides the count derived from"
67 " profile-summary-cutoff-cold"));
75 200000, 300000, 400000, 500000, 600000, 700000, 800000,
76 900000, 950000, 990000, 999000, 999900, 999990, 999999};
93 return Entry.Cutoff < Percentile;
112 for (
size_t I = 1, E = R.Counts.size();
I < E; ++
I)
120 if (!isCallsiteSample) {
124 }
else if (FS.getContext().hasAttribute(
131 for (
const auto &
I : FS.getBodySamples()) {
135 for (
const auto &
I : FS.getCallsiteSamples())
136 for (
const auto &CS :
I.second)
143 if (DetailedSummaryCutoffs.empty())
146 auto Iter = CountFrequencies.begin();
147 const auto End = CountFrequencies.end();
152 for (
const uint32_t Cutoff : DetailedSummaryCutoffs) {
161 while (CurrSum < DesiredCount && Iter !=
End) {
164 CurrSum += (Count * Freq);
168 assert(CurrSum >= DesiredCount);
178 uint64_t HotCountThreshold = HotEntry.MinCount;
181 return HotCountThreshold;
196 return std::make_unique<ProfileSummary>(
201std::unique_ptr<ProfileSummary>
205 "This can only be called on an empty summary builder");
217 ProfilesToUse = &ContextLessProfiles;
220 for (
const auto &
I : *ProfilesToUse) {
230 return std::make_unique<ProfileSummary>(
237 "Count value should be less than the max count value.");
246 "Count value should be less than the max count value.");
248 if (Count > MaxInternalBlockCount)
249 MaxInternalBlockCount = Count;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static cl::opt< unsigned > ColdCountThreshold("mfs-count-threshold", cl::desc("Minimum number of times a block must be executed to be retained."), cl::init(1), cl::Hidden)
static const ProfileSummaryEntry ZeroCutoffEntry
static const uint32_t DefaultCutoffsData[]
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
LLVM_ABI APInt sdiv(const APInt &RHS) const
Signed division function for APInt.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM_ABI void addInternalCount(uint64_t Count)
LLVM_ABI std::unique_ptr< ProfileSummary > getSummary()
LLVM_ABI void addRecord(const InstrProfRecord &)
LLVM_ABI void addEntryCount(uint64_t Count)
LLVM_ABI void computeDetailedSummary()
void addCount(uint64_t Count)
This is called when a count is seen in the profile.
static LLVM_ABI const ProfileSummaryEntry & getEntryForPercentile(const SummaryEntryVector &DS, uint64_t Percentile)
Find the summary entry for a desired percentile of counts.
uint64_t MaxFunctionCount
static LLVM_ABI const ArrayRef< uint32_t > DefaultCutoffs
A vector of useful cutoff values for detailed summary.
SummaryEntryVector DetailedSummary
static LLVM_ABI uint64_t getHotCountThreshold(const SummaryEntryVector &DS)
static LLVM_ABI uint64_t getColdCountThreshold(const SummaryEntryVector &DS)
LLVM_ABI std::unique_ptr< ProfileSummary > getSummary()
LLVM_ABI std::unique_ptr< ProfileSummary > computeSummaryForProfiles(const sampleprof::SampleProfileMap &Profiles)
LLVM_ABI void addRecord(const sampleprof::FunctionSamples &FS, bool isCallsiteSample=false)
int getNumOccurrences() const
Representation of the samples collected for a function.
static LLVM_ABI bool ProfileIsCS
static void flattenProfile(SampleProfileMap &ProfileMap, bool ProfileIsCS=false)
This class provides operator overloads to the map container using MD5 as the key type,...
initializer< Ty > init(const Ty &Val)
@ ContextDuplicatedIntoBase
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI cl::opt< uint64_t > ProfileSummaryHotCount
auto partition_point(R &&Range, Predicate P)
Binary search for the first iterator in a range where a predicate is false.
LLVM_ABI cl::opt< bool > UseContextLessSummary
LLVM_ABI cl::opt< uint64_t > ProfileSummaryColdCount
uint64_t getInstrMaxCountValue()
Return the max count value. We reserver a few large values for special use.
void sort(IteratorTy Start, IteratorTy End)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
LLVM_ABI cl::opt< int > ProfileSummaryCutoffCold
std::vector< ProfileSummaryEntry > SummaryEntryVector
LLVM_ABI cl::opt< unsigned > ProfileSummaryLargeWorkingSetSizeThreshold
LLVM_ABI cl::opt< int > ProfileSummaryCutoffHot
LLVM_ABI cl::opt< unsigned > ProfileSummaryHugeWorkingSetSizeThreshold
Profiling information for a single function.