diff options
author | Xinliang David Li <davidxl@google.com> | 2016-09-20 21:04:22 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2016-09-20 21:04:22 +0000 |
commit | deda33cdbdae0c4c68860e71bd940320cd227819 (patch) | |
tree | 400bf34d9e4162d396b841ea1b6d63062cac6396 /llvm/tools/llvm-profdata/llvm-profdata.cpp | |
parent | 145569df6411e9fcff07fe5bc09afdf8fdc2be35 (diff) | |
download | bcm5719-llvm-deda33cdbdae0c4c68860e71bd940320cd227819.tar.gz bcm5719-llvm-deda33cdbdae0c4c68860e71bd940320cd227819.zip |
[Profile] dump ic value profile value/site-count histogram
Differential Revision: http://reviews.google.com/D24783
llvm-svn: 282017
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r-- | llvm/tools/llvm-profdata/llvm-profdata.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index d5c05daf9b6..059c4dc79c8 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -463,6 +463,7 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts, uint64_t TotalNumValueSites = 0; uint64_t TotalNumValueSitesWithValueProfile = 0; uint64_t TotalNumValues = 0; + std::vector<unsigned> ICHistogram; for (const auto &Func : *Reader) { bool Show = ShowAllFunctions || (!ShowFunction.empty() && @@ -515,8 +516,12 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts, std::unique_ptr<InstrProfValueData[]> VD = Func.getValueForSite(IPVK_IndirectCallTarget, I); TotalNumValues += NV; - if (NV) + if (NV) { TotalNumValueSitesWithValueProfile++; + if (NV > ICHistogram.size()) + ICHistogram.resize(NV, 0); + ICHistogram[NV - 1]++; + } for (uint32_t V = 0; V < NV; V++) { OS << "\t[ " << I << ", "; 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 : " << TotalNumValueSitesWithValueProfile << "\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) { |