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

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 14:29:56 PST 2015


rafael added a subscriber: rafael.

================
Comment at: include/llvm/Support/Timer.h:65
@@ -64,3 +64,3 @@
 
-  /// print - Print the current timer to standard error, and reset the "Started"
-  /// flag.
+  /// print - Print the current time record to \p OS, with a breakdown showing
+  /// contributions to the \p Total time record.
----------------
Please drop the duplicated name.

================
Comment at: include/llvm/Support/Timer.h:106
@@ -104,5 +105,3 @@
 
-  /// startTimer - Start the timer running.  Time between calls to
-  /// startTimer/stopTimer is counted by the Timer class.  Note that these calls
-  /// must be correctly paired.
-  ///
+  /// hasTriggered - Check if startTimer() has ever been called on this timer.
+  bool hasTriggered() const { return TimeRecord() < StartTime; }
----------------
Don't repeat the name in the comment.

================
Comment at: include/llvm/Support/Timer.h:107
@@ +106,3 @@
+  /// hasTriggered - Check if startTimer() has ever been called on this timer.
+  bool hasTriggered() const { return TimeRecord() < StartTime; }
+
----------------
Is this reliable? Will it return true in

Foo.startTimer();
Foo.hasTriggered();

That is, if hasTriggered is called immediately after the start.



http://reviews.llvm.org/D15619





More information about the llvm-commits mailing list