[llvm-commits] [llvm] r52693 - /llvm/trunk/lib/Support/Timer.cpp

Dan Gohman gohman at apple.com
Tue Jun 24 15:07:08 PDT 2008


Author: djg
Date: Tue Jun 24 17:07:07 2008
New Revision: 52693

URL: http://llvm.org/viewvc/llvm-project?rev=52693&view=rev
Log:
Append to the ActiveTimers std::vector before looking at the timer instead
of after, so that any reallocation it does doesn't get counted for the pass
being timed.  This probably doesn't account for a timing discrepancy I was
looking into, but I'm fixing it anyway.

Modified:
    llvm/trunk/lib/Support/Timer.cpp

Modified: llvm/trunk/lib/Support/Timer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Timer.cpp?rev=52693&r1=52692&r2=52693&view=diff

==============================================================================
--- llvm/trunk/lib/Support/Timer.cpp (original)
+++ llvm/trunk/lib/Support/Timer.cpp Tue Jun 24 17:07:07 2008
@@ -132,13 +132,13 @@
 
 void Timer::startTimer() {
   Started = true;
+  ActiveTimers->push_back(this);
   TimeRecord TR = getTimeRecord(true);
   Elapsed    -= TR.Elapsed;
   UserTime   -= TR.UserTime;
   SystemTime -= TR.SystemTime;
   MemUsed    -= TR.MemUsed;
   PeakMemBase = TR.MemUsed;
-  ActiveTimers->push_back(this);
 }
 
 void Timer::stopTimer() {





More information about the llvm-commits mailing list