[llvm-commits] CVS: llvm/lib/Support/Timer.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 9 10:41:48 PST 2005



Changes in directory llvm/lib/Support:

Timer.cpp updated: 1.42 -> 1.43
---
Log message:

Don't print a 'Total Execution Time' line for the 'Miscellaneous Ungrouped 
Timers' section.  Since these are random timers in the program it doesn't 
make sense to sum them up.



---
Diffs of the changes:  (+13 -5)

 Timer.cpp |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)


Index: llvm/lib/Support/Timer.cpp
diff -u llvm/lib/Support/Timer.cpp:1.42 llvm/lib/Support/Timer.cpp:1.43
--- llvm/lib/Support/Timer.cpp:1.42	Fri Jan 28 23:21:16 2005
+++ llvm/lib/Support/Timer.cpp	Wed Feb  9 12:41:32 2005
@@ -302,12 +302,20 @@
       *OutStream << "===" << std::string(73, '-') << "===\n"
                  << std::string(Padding, ' ') << Name << "\n"
                  << "===" << std::string(73, '-')
-                 << "===\n  Total Execution Time: ";
+                 << "===\n";
 
-      printAlignedFP(Total.getProcessTime(), 4, 5, *OutStream);
-      *OutStream << " seconds (";
-      printAlignedFP(Total.getWallTime(), 4, 5, *OutStream);
-      *OutStream << " wall clock)\n\n";
+      // If this is not an collection of ungrouped times, print the total time.
+      // Ungrouped timers don't really make sense to add up.  We still print the
+      // TOTAL line to make the percentages make sense.
+      if (this != DefaultTimerGroup) {
+        *OutStream << "  Total Execution Time: ";
+
+        printAlignedFP(Total.getProcessTime(), 4, 5, *OutStream);
+        *OutStream << " seconds (";
+        printAlignedFP(Total.getWallTime(), 4, 5, *OutStream);
+        *OutStream << " wall clock)\n";
+      }
+      *OutStream << "\n";
 
       if (Total.UserTime)
         *OutStream << "   ---User Time---";






More information about the llvm-commits mailing list