summaryrefslogtreecommitdiff
path: root/tools/llvm-profdata
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-03-12 20:26:37 +0000
committerJustin Bogner <mail@justinbogner.com>2014-03-12 20:26:37 +0000
commitf3e175664890ee016f20a327162826247ae4b93f (patch)
tree14f8d637208488fd5da0851218e3e861331b3066 /tools/llvm-profdata
parent230eda4bdf3822392c8b24c3fb26546631133a89 (diff)
Profile: Remove an inefficient and unnecessary API function
This was leftover from an approach I abandoned, but I forgot to update it before committing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-profdata')
-rw-r--r--tools/llvm-profdata/llvm-profdata.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/llvm-profdata/llvm-profdata.cpp b/tools/llvm-profdata/llvm-profdata.cpp
index fcc54042f40..989c4281f82 100644
--- a/tools/llvm-profdata/llvm-profdata.cpp
+++ b/tools/llvm-profdata/llvm-profdata.cpp
@@ -171,21 +171,24 @@ int show_main(int argc, const char *argv[]) {
if (ShowAllFunctions && !ShowFunction.empty())
errs() << "warning: -function argument ignored: showing all functions\n";
- uint64_t MaxBlockCount = 0, MaxFunctionCount = 0;
+ uint64_t MaxFunctionCount = Reader->getMaximumFunctionCount();
+
+ uint64_t MaxBlockCount = 0;
uint64_t Hash;
- double CallFreq;
size_t ShownFunctions = false;
std::vector<uint64_t> Counts;
for (const auto &Name : *Reader) {
bool Show = ShowAllFunctions || Name.find(ShowFunction) != Name.npos;
if (error_code EC = Reader->getFunctionCounts(Name, Hash, Counts))
exitWithError(EC.message(), Filename);
- if (error_code EC = Reader->getCallFrequency(Name, Hash, CallFreq))
- exitWithError(EC.message(), Filename);
+
if (Show) {
+ double CallFreq = Counts[0] / (double)MaxFunctionCount;
+
if (!ShownFunctions)
OS << "Counters:\n";
++ShownFunctions;
+
OS << " " << Name << ":\n"
<< " Hash: " << HashPrinter(Hash) << "\n"
<< " Relative call frequency: " << FreqPrinter(CallFreq) << "\n"
@@ -193,9 +196,6 @@ int show_main(int argc, const char *argv[]) {
<< " Function count: " << Counts[0] << "\n";
}
- if (Counts[0] > MaxFunctionCount)
- MaxFunctionCount = Counts[0];
-
if (Show && ShowCounts)
OS << " Block counts: [";
for (size_t I = 1, E = Counts.size(); I < E; ++I) {