[PATCH] D15619: [Support] Make llvm::Timer reusable

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 15:10:16 PST 2015


rafael added inline comments.

================
Comment at: include/llvm/Support/Timer.h:83
@@ -82,1 +82,3 @@
+  bool Started;          // Is the timer currently running?
+  bool Triggered;        // Has the timer ever been triggered?
   TimerGroup *TG;        // The TimerGroup this Timer is in.
----------------
Don't you have to set it to false in init()?

================
Comment at: lib/Support/Timer.cpp:99
@@ -98,7 +98,3 @@
 void Timer::init(StringRef N) {
-  assert(!TG && "Timer already initialized");
-  Name.assign(N.begin(), N.end());
-  Started = false;
-  TG = getDefaultTimerGroup();
-  TG->addTimer(*this);
+  init(N, *getDefaultTimerGroup());
 }
----------------
This is a nice independent cleanup. Please commit and rebase.

================
Comment at: lib/Support/Timer.cpp:142
@@ -141,3 +137,1 @@
 
-static ManagedStatic<std::vector<Timer*> > ActiveTimers;
-
----------------
Deleting this is a nice independent cleanup. Please commit and rebase. Looks like it is dead since 99841.

================
Comment at: lib/Support/Timer.cpp:147
@@ -151,1 +146,3 @@
+  Started = false;
   Time += TimeRecord::getCurrentTime(false);
+  Time -= StartTime;
----------------
These two lines are just:

+= (TimeRecord::getCurrentTime(false) - StartTime);


http://reviews.llvm.org/D15619





More information about the llvm-commits mailing list