aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-prof
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-05 21:51:16 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-05 21:51:16 +0000
commitc9008c5cc7113ea4c3a262e346c0dfcdbca12ae6 (patch)
treee8e8c7d27032dc84dd20ce8327a4cbf927104d1f /tools/llvm-prof
parentb341577401dfb25e1e6c451eee6dd01df531365a (diff)
downloadexternal_llvm-c9008c5cc7113ea4c3a262e346c0dfcdbca12ae6.zip
external_llvm-c9008c5cc7113ea4c3a262e346c0dfcdbca12ae6.tar.gz
external_llvm-c9008c5cc7113ea4c3a262e346c0dfcdbca12ae6.tar.bz2
Make block and function count available via ProfileInfo.
- Part of optimal static profiling patch sequence by Andreas Neustifter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-prof')
-rw-r--r--tools/llvm-prof/llvm-prof.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp
index 64fe451..d3971d3 100644
--- a/tools/llvm-prof/llvm-prof.cpp
+++ b/tools/llvm-prof/llvm-prof.cpp
@@ -142,9 +142,8 @@ bool ProfileInfoPrinterPass::runOnModule(Module &M) {
std::vector<std::pair<Function*, unsigned> > FunctionCounts;
std::vector<std::pair<BasicBlock*, unsigned> > Counts;
for (Module::iterator FI = M.begin(), FE = M.end(); FI != FE; ++FI) {
- unsigned w = PI.getExecutionCount(FI);
- if (w != (unsigned) -1)
- FunctionCounts.push_back(std::make_pair(FI,PI.getExecutionCount(FI)));
+ if (FI->isDeclaration()) continue;
+ FunctionCounts.push_back(std::make_pair(FI,PI.getExecutionCount(FI)));
for (Function::iterator BB = FI->begin(), BBE = FI->end();
BB != BBE; ++BB) {
Counts.push_back(std::make_pair(BB,PI.getExecutionCount(BB)));
@@ -209,7 +208,7 @@ bool ProfileInfoPrinterPass::runOnModule(Module &M) {
if (Counts[i].second == 0) break;
Function *F = Counts[i].first->getParent();
std::cout << std::setw(3) << i+1 << ". "
- << std::setw(5) << std::setprecision(2)
+ << std::setw(5) << std::setprecision(3)
<< Counts[i].second/(double)TotalExecutions*100 << "% "
<< std::setw(5) << Counts[i].second << "/"
<< TotalExecutions << "\t"