summaryrefslogtreecommitdiff
path: root/tools/llvm-prof
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-28 22:30:37 +0000
committerChris Lattner <sabre@nondot.org>2003-10-28 22:30:37 +0000
commit4963dcf584b9bfe097aed271309b81d089b291e1 (patch)
treea948369a15856b675a686d2bb72308f9c36ed89b /tools/llvm-prof
parent204089042be123e007398a8d246d20c6ce3d7272 (diff)
downloadllvm-4963dcf584b9bfe097aed271309b81d089b291e1.tar.gz
llvm-4963dcf584b9bfe097aed271309b81d089b291e1.tar.bz2
llvm-4963dcf584b9bfe097aed271309b81d089b291e1.tar.xz
Print out command lines used to run the programs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-prof')
-rw-r--r--tools/llvm-prof/ProfileInfo.h3
-rw-r--r--tools/llvm-prof/llvm-prof.cpp21
2 files changed, 23 insertions, 1 deletions
diff --git a/tools/llvm-prof/ProfileInfo.h b/tools/llvm-prof/ProfileInfo.h
index eab9bc9781..24e4296156 100644
--- a/tools/llvm-prof/ProfileInfo.h
+++ b/tools/llvm-prof/ProfileInfo.h
@@ -32,6 +32,9 @@ public:
// program if the file is invalid or broken.
ProfileInfo(const char *ToolName, const std::string &Filename, Module &M);
+ unsigned getNumExecutions() const { return CommandLines.size(); }
+ const std::string &getExecution(unsigned i) const { return CommandLines[i]; }
+
// getFunctionCounts - This method is used by consumers of function counting
// information. If we do not directly have function count information, we
// compute it from other, more refined, types of profile information.
diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp
index 2b6730ec64..c487da959f 100644
--- a/tools/llvm-prof/llvm-prof.cpp
+++ b/tools/llvm-prof/llvm-prof.cpp
@@ -73,11 +73,30 @@ int main(int argc, char **argv) {
for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i)
TotalExecutions += FunctionCounts[i].second;
+ std::cout << "===" << std::string(73, '-') << "===\n"
+ << "LLVM profiling output for:\n";
+
+ for (unsigned i = 0, e = PI.getNumExecutions(); i != e; ++i) {
+ std::cout << " ";
+ if (e != 1) std::cout << i << ". ";
+ std::cout << PI.getExecution(i) << "\n";
+ }
+
+ std::cout << "\n===" << std::string(73, '-') << "===\n";
+ std::cout << "Function execution frequencies:\n\n";
+
// Print out the function frequencies...
printf(" ## Frequency\n");
- for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i)
+ for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i) {
+ if (FunctionCounts[i].second == 0) {
+ printf("\n NOTE: %d function%s never executed!\n",
+ e-i, e-i-1 ? "s were" : " was");
+ break;
+ }
+
printf("%3d. %5d/%d %s\n", i, FunctionCounts[i].second, TotalExecutions,
FunctionCounts[i].first->getName().c_str());
+ }
// If we have block count information, print out the LLVM module with