summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
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
commite5a17e3f1d1d620d0793f36f54654951a4440f99 (patch)
tree29453f82d5ec2e7a668a9bbceb7d8bc300ce0e73 /llvm/tools/llvm-profdata/llvm-profdata.cpp
parentb1d37199ccfad5654d587cb9a81bcfde613315b4 (diff)
downloadbcm5719-llvm-e5a17e3f1d1d620d0793f36f54654951a4440f99.tar.gz
bcm5719-llvm-e5a17e3f1d1d620d0793f36f54654951a4440f99.zip
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 llvm-svn: 270136
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index d45e6afa5a5..1b042be8a3f 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/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)
OpenPOWER on IntegriCloud