diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-05 21:51:16 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-05 21:51:16 +0000 |
commit | 4f6f6d080f520d7bc7e87dfcf3b8bafda064fe1a (patch) | |
tree | 1a10e3ed9b86cd04f63b316bd3ba197cfa51a733 /llvm/tools/llvm-prof | |
parent | 1efb6b039195754ff8fd6189ef4b069c85a928f0 (diff) | |
download | bcm5719-llvm-4f6f6d080f520d7bc7e87dfcf3b8bafda064fe1a.tar.gz bcm5719-llvm-4f6f6d080f520d7bc7e87dfcf3b8bafda064fe1a.zip |
Make block and function count available via ProfileInfo.
- Part of optimal static profiling patch sequence by Andreas Neustifter.
llvm-svn: 78247
Diffstat (limited to 'llvm/tools/llvm-prof')
-rw-r--r-- | llvm/tools/llvm-prof/llvm-prof.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/tools/llvm-prof/llvm-prof.cpp b/llvm/tools/llvm-prof/llvm-prof.cpp index 64fe4515006..d3971d30d15 100644 --- a/llvm/tools/llvm-prof/llvm-prof.cpp +++ b/llvm/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" |