summaryrefslogtreecommitdiff
path: root/tools/llvm-profdata
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-05-23 16:36:11 +0000
committerXinliang David Li <davidxl@google.com>2016-05-23 16:36:11 +0000
commit1386ead074e8e9028ae73c8106ccc3853d73bcf6 (patch)
tree382b388a4d11b65a7f610c0f508b3e35fd665688 /tools/llvm-profdata
parent018cdc89a0cdaf3ad7a24cd99d5f3a047cee0108 (diff)
[profile] show more statistics
Add value profile statistics with the 'show' command. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-profdata')
-rw-r--r--tools/llvm-profdata/llvm-profdata.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/llvm-profdata/llvm-profdata.cpp b/tools/llvm-profdata/llvm-profdata.cpp
index b2e60aa43bc..546029aef9f 100644
--- a/tools/llvm-profdata/llvm-profdata.cpp
+++ b/tools/llvm-profdata/llvm-profdata.cpp
@@ -288,6 +288,9 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
auto Reader = std::move(ReaderOrErr.get());
bool IsIRInstr = Reader->isIRLevelProfile();
size_t ShownFunctions = 0;
+ uint64_t TotalNumValueSites = 0;
+ uint64_t TotalNumValueSitesWithValueProfile = 0;
+ uint64_t TotalNumValues = 0;
for (const auto &Func : *Reader) {
bool Show =
ShowAllFunctions || (!ShowFunction.empty() &&
@@ -334,10 +337,14 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
InstrProfSymtab &Symtab = Reader->getSymtab();
uint32_t NS = Func.getNumValueSites(IPVK_IndirectCallTarget);
OS << " Indirect Target Results: \n";
+ TotalNumValueSites += NS;
for (size_t I = 0; I < NS; ++I) {
uint32_t NV = Func.getNumValueDataForSite(IPVK_IndirectCallTarget, I);
std::unique_ptr<InstrProfValueData[]> VD =
Func.getValueForSite(IPVK_IndirectCallTarget, I);
+ TotalNumValues += NV;
+ if (NV)
+ TotalNumValueSitesWithValueProfile++;
for (uint32_t V = 0; V < NV; V++) {
OS << "\t[ " << I << ", ";
OS << Symtab.getFuncName(VD[V].Value) << ", " << VD[V].Count
@@ -347,7 +354,6 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
}
}
}
-
if (Reader->hasError())
exitWithError(Reader->getError(), Filename);
@@ -359,6 +365,13 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
OS << "Total functions: " << PS->getNumFunctions() << "\n";
OS << "Maximum function count: " << PS->getMaxFunctionCount() << "\n";
OS << "Maximum internal block count: " << PS->getMaxInternalCount() << "\n";
+ if (ShownFunctions && ShowIndirectCallTargets) {
+ OS << "Total Number of Indirect Call Sites : " << TotalNumValueSites
+ << "\n";
+ OS << "Total Number of Sites With Values : "
+ << TotalNumValueSitesWithValueProfile << "\n";
+ OS << "Total Number of Profiled Values : " << TotalNumValues << "\n";
+ }
if (ShowDetailedSummary) {
OS << "Detailed summary:\n";