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

Chris Lattner lattner at cs.uiuc.edu
Sun Dec 14 15:28:01 PST 2003


Changes in directory llvm/lib/Support:

Statistic.cpp updated: 1.12 -> 1.13
Timer.cpp updated: 1.28 -> 1.29

---
Log message:

Finegrainify namespacification
Make the Timer code give correct user/system/user+system times when -track-memory is enabled


---
Diffs of the changes:  (+7 -9)

Index: llvm/lib/Support/Statistic.cpp
diff -u llvm/lib/Support/Statistic.cpp:1.12 llvm/lib/Support/Statistic.cpp:1.13
--- llvm/lib/Support/Statistic.cpp:1.12	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/Statistic.cpp	Sun Dec 14 15:27:33 2003
@@ -26,11 +26,10 @@
 #include <sstream>
 #include <iostream>
 #include <algorithm>
-
-namespace llvm {
+using namespace llvm;
 
 // GetLibSupportInfoOutputFile - Return a file stream to print our output on...
-extern std::ostream *GetLibSupportInfoOutputFile();
+namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
 
 unsigned StatisticBase::NumStats = 0;
 
@@ -106,5 +105,3 @@
       delete OutStream;   // Close the file...
   }
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/Timer.cpp
diff -u llvm/lib/Support/Timer.cpp:1.28 llvm/lib/Support/Timer.cpp:1.29
--- llvm/lib/Support/Timer.cpp:1.28	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/Timer.cpp	Sun Dec 14 15:27:33 2003
@@ -22,8 +22,10 @@
 #include <functional>
 #include <fstream>
 #include <map>
+using namespace llvm;
 
-namespace llvm {
+// GetLibSupportInfoOutputFile - Return a file stream to print our output on...
+namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
 
 // getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy
 // of constructor/destructor ordering being unspecified by C++.  Basically the
@@ -122,9 +124,9 @@
   gettimeofday(&T, 0);
 
   if (!Start) {
-    MemUsed = getMemUsage();
     if (getrusage(RUSAGE_SELF, &RU))
       perror("getrusage call failed: -time-passes info incorrect!");
+    MemUsed = getMemUsage();
   }
 
   TimeRecord Result;
@@ -268,7 +270,7 @@
 
 // GetLibSupportInfoOutputFile - Return a file stream to print our output on...
 std::ostream *
-GetLibSupportInfoOutputFile() {
+llvm::GetLibSupportInfoOutputFile() {
   std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename();
   if (LibSupportInfoOutputFilename.empty())
     return &std::cerr;
@@ -353,4 +355,3 @@
   }
 }
 
-} // End llvm namespace





More information about the llvm-commits mailing list