From a1f278f96c2e96b38905b9351e66007a92a817a3 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Wed, 12 Mar 2014 20:26:37 +0000 Subject: Profile: Remove an inefficient and unnecessary API function This was leftover from an approach I abandoned, but I forgot to update it before committing. llvm-svn: 203708 --- llvm/tools/llvm-profdata/llvm-profdata.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp') diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index fcc5404..989c428 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/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 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) { -- cgit v1.1