Append to the ActiveTimers std::vector before looking at the timer instead
[oota-llvm.git] / lib / Support / Timer.cpp
index 9cbb3c705c5471b5f187f4099ef362051511d256..c8678d3ae2c7aed524c55fa93c6ede193f4f80ec 100644 (file)
@@ -132,13 +132,13 @@ static ManagedStatic<std::vector<Timer*> > ActiveTimers;
 
 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() {