diff options
| -rw-r--r-- | llvm/include/llvm/Support/Timer.h | 20 | ||||
| -rw-r--r-- | llvm/lib/Support/Timer.cpp | 34 | 
2 files changed, 27 insertions, 27 deletions
diff --git a/llvm/include/llvm/Support/Timer.h b/llvm/include/llvm/Support/Timer.h index 584199f4400..9e19a1c432b 100644 --- a/llvm/include/llvm/Support/Timer.h +++ b/llvm/include/llvm/Support/Timer.h @@ -34,12 +34,12 @@ class TimerGroup;  /// if they are never started.  ///  class Timer { -  double Elapsed;        // Wall clock time elapsed in seconds -  double UserTime;       // User time elapsed -  double SystemTime;     // System time elapsed -  ssize_t MemUsed;       // Memory allocated (in bytes) -  size_t PeakMem;        // Peak memory used -  size_t PeakMemBase;    // Temporary for peak calculation... +  uint64_t Elapsed;        // Wall clock time elapsed in seconds +  uint64_t UserTime;       // User time elapsed +  uint64_t SystemTime;     // System time elapsed +  uint64_t MemUsed;       // Memory allocated (in bytes) +  uint64_t PeakMem;        // Peak memory used +  uint64_t PeakMemBase;    // Temporary for peak calculation...    std::string Name;      // The name of this time variable    bool Started;          // Has this time variable ever been started?    TimerGroup *TG;        // The TimerGroup this Timer is in. @@ -49,10 +49,10 @@ public:    Timer(const Timer &T);    ~Timer(); -  double getProcessTime() const { return UserTime+SystemTime; } -  double getWallTime() const { return Elapsed; } -  ssize_t getMemUsed() const { return MemUsed; } -  size_t getPeakMem() const { return PeakMem; } +  uint64_t getProcessTime() const { return UserTime+SystemTime; } +  uint64_t getWallTime() const { return Elapsed; } +  uint64_t getMemUsed() const { return MemUsed; } +  uint64_t getPeakMem() const { return PeakMem; }    std::string getName() const { return Name; }    const Timer &operator=(const Timer &T) { diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp index bcb27a4ab4f..f4e97c4dc70 100644 --- a/llvm/lib/Support/Timer.cpp +++ b/llvm/lib/Support/Timer.cpp @@ -112,8 +112,7 @@ static inline size_t getMemUsage() {  }  struct TimeRecord { -  double Elapsed, UserTime, SystemTime; -  ssize_t MemUsed; +  uint64_t Elapsed, UserTime, SystemTime, MemUsed;  };  static TimeRecord getTimeRecord(bool Start) { @@ -123,7 +122,7 @@ static TimeRecord getTimeRecord(bool Start) {    sys::TimeValue user(0,0);    sys::TimeValue sys(0,0); -  ssize_t MemUsed = 0; +  uint64_t MemUsed = 0;    if (Start) {      MemUsed = getMemUsage();      sys::Process::GetTimeUsage(now,user,sys); @@ -132,9 +131,9 @@ static TimeRecord getTimeRecord(bool Start) {      MemUsed = getMemUsage();    } -  Result.Elapsed  = now.seconds()  + now.microseconds()  / 1000000.0; -  Result.UserTime = user.seconds() + user.microseconds() / 1000000.0; -  Result.SystemTime  = sys.seconds()  + sys.microseconds()  / 1000000.0; +  Result.Elapsed  = now.seconds() * 1000000 + now.microseconds(); +  Result.UserTime = user.seconds() * 1000000 + user.microseconds(); +  Result.SystemTime  = sys.seconds() * 1000000 + sys.microseconds();    Result.MemUsed  = MemUsed;    return Result; @@ -277,12 +276,13 @@ static void printVal(double Val, double Total, std::ostream &OS) {  void Timer::print(const Timer &Total, std::ostream &OS) {    if (Total.UserTime) -    printVal(UserTime, Total.UserTime, OS); +    printVal(UserTime / 1000000.0, Total.UserTime / 1000000.0, OS);    if (Total.SystemTime) -    printVal(SystemTime, Total.SystemTime, OS); +    printVal(SystemTime / 1000000.0, Total.SystemTime / 1000000.0, OS);    if (Total.getProcessTime()) -    printVal(getProcessTime(), Total.getProcessTime(), OS); -  printVal(Elapsed, Total.Elapsed, OS); +    printVal(getProcessTime() / 1000000.0, +             Total.getProcessTime() / 1000000.0, OS); +  printVal(Elapsed / 1000000.0, Total.Elapsed / 1000000.0, OS);    OS << "  "; @@ -355,23 +355,23 @@ void TimerGroup::removeTimer() {        if (this != DefaultTimerGroup) {          *OutStream << "  Total Execution Time: "; -        printAlignedFP(Total.getProcessTime(), 4, 5, *OutStream); +        printAlignedFP(Total.getProcessTime() / 1000000.0, 4, 5, *OutStream);          *OutStream << " seconds ("; -        printAlignedFP(Total.getWallTime(), 4, 5, *OutStream); +        printAlignedFP(Total.getWallTime() / 1000000.0, 4, 5, *OutStream);          *OutStream << " wall clock)\n";        }        *OutStream << "\n"; -      if (Total.UserTime) +      if (Total.UserTime / 1000000.0)          *OutStream << "   ---User Time---"; -      if (Total.SystemTime) +      if (Total.SystemTime / 1000000.0)          *OutStream << "   --System Time--"; -      if (Total.getProcessTime()) +      if (Total.getProcessTime() / 1000000.0)          *OutStream << "   --User+System--";        *OutStream << "   ---Wall Time---"; -      if (Total.getMemUsed()) +      if (Total.getMemUsed() / 1000000.0)          *OutStream << "  ---Mem---"; -      if (Total.getPeakMem()) +      if (Total.getPeakMem() / 1000000.0)          *OutStream << "  -PeakMem-";        *OutStream << "  --- Name ---\n";  | 

