[llvm-commits] CVS: llvm/tools/llvm-prof/ProfileInfo.h llvm-prof.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Oct 28 16:31:01 PST 2003
Changes in directory llvm/tools/llvm-prof:
ProfileInfo.h updated: 1.3 -> 1.4
llvm-prof.cpp updated: 1.4 -> 1.5
---
Log message:
Print out command lines used to run the programs
---
Diffs of the changes: (+23 -1)
Index: llvm/tools/llvm-prof/ProfileInfo.h
diff -u llvm/tools/llvm-prof/ProfileInfo.h:1.3 llvm/tools/llvm-prof/ProfileInfo.h:1.4
--- llvm/tools/llvm-prof/ProfileInfo.h:1.3 Tue Oct 28 15:25:23 2003
+++ llvm/tools/llvm-prof/ProfileInfo.h Tue Oct 28 16:30:37 2003
@@ -32,6 +32,9 @@
// 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.
Index: llvm/tools/llvm-prof/llvm-prof.cpp
diff -u llvm/tools/llvm-prof/llvm-prof.cpp:1.4 llvm/tools/llvm-prof/llvm-prof.cpp:1.5
--- llvm/tools/llvm-prof/llvm-prof.cpp:1.4 Tue Oct 28 15:25:23 2003
+++ llvm/tools/llvm-prof/llvm-prof.cpp Tue Oct 28 16:30:37 2003
@@ -73,11 +73,30 @@
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
More information about the llvm-commits
mailing list