1
0
mirror of https://github.com/RPCSX/llvm.git synced 2025-04-07 02:31:55 +00:00

[Profile] dump ic value profile value/site-count histogram

Differential Revision: http://reviews.google.com/D24783




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282017 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Xinliang David Li 2016-09-20 21:04:22 +00:00
parent 38ea316607
commit 163ac62cd3
2 changed files with 14 additions and 1 deletions
test/tools/llvm-profdata
tools/llvm-profdata

@ -66,4 +66,7 @@ foo2:20000
#ICSUM: Total Number of Indirect Call Sites : 3 #ICSUM: Total Number of Indirect Call Sites : 3
#ICSUM: Total Number of Sites With Values : 2 #ICSUM: Total Number of Sites With Values : 2
#ICSUM: Total Number of Profiled Values : 3 #ICSUM: Total Number of Profiled Values : 3
#ICSUM: NumTargets, SiteCount
#ICSUM 1, 1
#ICSUM 2, 1

@ -463,6 +463,7 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts,
uint64_t TotalNumValueSites = 0; uint64_t TotalNumValueSites = 0;
uint64_t TotalNumValueSitesWithValueProfile = 0; uint64_t TotalNumValueSitesWithValueProfile = 0;
uint64_t TotalNumValues = 0; uint64_t TotalNumValues = 0;
std::vector<unsigned> ICHistogram;
for (const auto &Func : *Reader) { for (const auto &Func : *Reader) {
bool Show = bool Show =
ShowAllFunctions || (!ShowFunction.empty() && ShowAllFunctions || (!ShowFunction.empty() &&
@ -515,8 +516,12 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts,
std::unique_ptr<InstrProfValueData[]> VD = std::unique_ptr<InstrProfValueData[]> VD =
Func.getValueForSite(IPVK_IndirectCallTarget, I); Func.getValueForSite(IPVK_IndirectCallTarget, I);
TotalNumValues += NV; TotalNumValues += NV;
if (NV) if (NV) {
TotalNumValueSitesWithValueProfile++; TotalNumValueSitesWithValueProfile++;
if (NV > ICHistogram.size())
ICHistogram.resize(NV, 0);
ICHistogram[NV - 1]++;
}
for (uint32_t V = 0; V < NV; V++) { for (uint32_t V = 0; V < NV; V++) {
OS << "\t[ " << I << ", "; OS << "\t[ " << I << ", ";
OS << Symtab.getFuncName(VD[V].Value) << ", " << VD[V].Count OS << Symtab.getFuncName(VD[V].Value) << ", " << VD[V].Count
@ -543,6 +548,11 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts,
OS << "Total Number of Sites With Values : " OS << "Total Number of Sites With Values : "
<< TotalNumValueSitesWithValueProfile << "\n"; << TotalNumValueSitesWithValueProfile << "\n";
OS << "Total Number of Profiled Values : " << TotalNumValues << "\n"; OS << "Total Number of Profiled Values : " << TotalNumValues << "\n";
OS << "IC Value histogram : \n\tNumTargets, SiteCount\n";
for (unsigned I = 0; I < ICHistogram.size(); I++) {
OS << "\t" << I + 1 << ", " << ICHistogram[I] << "\n";
}
} }
if (ShowDetailedSummary) { if (ShowDetailedSummary) {