[llvm] r282017 - [Profile] dump ic value profile value/site-count histogram
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 20 14:04:23 PDT 2016
Author: davidxl
Date: Tue Sep 20 16:04:22 2016
New Revision: 282017
URL: http://llvm.org/viewvc/llvm-project?rev=282017&view=rev
Log:
[Profile] dump ic value profile value/site-count histogram
Differential Revision: http://reviews.google.com/D24783
Modified:
llvm/trunk/test/tools/llvm-profdata/value-prof.proftext
llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
Modified: llvm/trunk/test/tools/llvm-profdata/value-prof.proftext
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-profdata/value-prof.proftext?rev=282017&r1=282016&r2=282017&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-profdata/value-prof.proftext (original)
+++ llvm/trunk/test/tools/llvm-profdata/value-prof.proftext Tue Sep 20 16:04:22 2016
@@ -66,4 +66,7 @@ foo2:20000
#ICSUM: Total Number of Indirect Call Sites : 3
#ICSUM: Total Number of Sites With Values : 2
#ICSUM: Total Number of Profiled Values : 3
+#ICSUM: NumTargets, SiteCount
+#ICSUM 1, 1
+#ICSUM 2, 1
Modified: llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp?rev=282017&r1=282016&r2=282017&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp (original)
+++ llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp Tue Sep 20 16:04:22 2016
@@ -463,6 +463,7 @@ static int showInstrProfile(const std::s
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::s
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::s
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) {
More information about the llvm-commits
mailing list