Finegrainify namespacification
authorChris Lattner <sabre@nondot.org>
Sun, 14 Dec 2003 21:27:33 +0000 (21:27 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 14 Dec 2003 21:27:33 +0000 (21:27 +0000)
Make the Timer code give correct user/system/user+system times when -track-memory is enabled

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10463 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Statistic.cpp
lib/Support/Timer.cpp

index 3ac2bf97fbe20fe0bb349d0be77658b444b616a7..9589fd7ebd98469e5e0b6ca3d450b6d9aa507dc6 100644 (file)
 #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 @@ void StatisticBase::destroy() const {
       delete OutStream;   // Close the file...
   }
 }
-
-} // End llvm namespace
index d14a225fcf26c7aba4e1743b4e79e945cdc04495..5d493b8a15e2e329b073362fea01235e384468b3 100644 (file)
 #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 @@ static TimeRecord getTimeRecord(bool Start) {
   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 @@ void Timer::print(const Timer &Total, std::ostream &OS) {
 
 // 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 @@ void TimerGroup::removeTimer() {
   }
 }
 
-} // End llvm namespace