summaryrefslogtreecommitdiff
path: root/tools/llvm-profdata
diff options
context:
space:
mode:
authorEaswaran Raman <eraman@google.com>2016-05-19 21:07:12 +0000
committerEaswaran Raman <eraman@google.com>2016-05-19 21:07:12 +0000
commit17e7f1191fc1e09714079ee52cc3ffb32f5736b5 (patch)
treefc5ef2c6b8a9554d8855a5bd915fcc59bc05c1d5 /tools/llvm-profdata
parent4f4b87e93849eddd82a11c0d41c760aa6a5e8c31 (diff)
Move ProfileSummary to IR.
This splits ProfileSummary into two classes: a ProfileSummary class that has methods to convert from/to metadata and a ProfileSummaryBuilder class that computes the profiles summary which is in ProfileData. Differential Revision: http://reviews.llvm.org/D20314 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270136 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-profdata')
-rw-r--r--tools/llvm-profdata/llvm-profdata.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/llvm-profdata/llvm-profdata.cpp b/tools/llvm-profdata/llvm-profdata.cpp
index d45e6afa5a5..1b042be8a3f 100644
--- a/tools/llvm-profdata/llvm-profdata.cpp
+++ b/tools/llvm-profdata/llvm-profdata.cpp
@@ -281,7 +281,7 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
if (ShowDetailedSummary && DetailedSummaryCutoffs.empty()) {
Cutoffs = {800000, 900000, 950000, 990000, 999000, 999900, 999990};
}
- InstrProfSummary PS(Cutoffs);
+ InstrProfSummaryBuilder Builder(Cutoffs);
if (Error E = ReaderOrErr.takeError())
exitWithError(std::move(E), Filename);
@@ -302,7 +302,7 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
}
assert(Func.Counts.size() > 0 && "function missing entry counter");
- PS.addRecord(Func);
+ Builder.addRecord(Func);
if (Show) {
@@ -353,18 +353,19 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
if (ShowCounts && TextFormat)
return 0;
-
+ std::unique_ptr<InstrProfSummary> PS(Builder.getSummary());
if (ShowAllFunctions || !ShowFunction.empty())
OS << "Functions shown: " << ShownFunctions << "\n";
- OS << "Total functions: " << PS.getNumFunctions() << "\n";
- OS << "Maximum function count: " << PS.getMaxFunctionCount() << "\n";
- OS << "Maximum internal block count: " << PS.getMaxInternalBlockCount() << "\n";
+ OS << "Total functions: " << PS->getNumFunctions() << "\n";
+ OS << "Maximum function count: " << PS->getMaxFunctionCount() << "\n";
+ OS << "Maximum internal block count: " << PS->getMaxInternalBlockCount()
+ << "\n";
if (ShowDetailedSummary) {
OS << "Detailed summary:\n";
- OS << "Total number of blocks: " << PS.getNumBlocks() << "\n";
- OS << "Total count: " << PS.getTotalCount() << "\n";
- for (auto Entry : PS.getDetailedSummary()) {
+ OS << "Total number of blocks: " << PS->getNumBlocks() << "\n";
+ OS << "Total count: " << PS->getTotalCount() << "\n";
+ for (auto Entry : PS->getDetailedSummary()) {
OS << Entry.NumCounts << " blocks with count >= " << Entry.MinCount
<< " account for "
<< format("%0.6g", (float)Entry.Cutoff / ProfileSummary::Scale * 100)