[PATCH] D20735: [Support] Allow nesting paired calls to {start, stop}Timer

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 09:59:52 PDT 2016


davide added inline comments.

================
Comment at: include/llvm/Support/Timer.h:122
@@ +121,3 @@
+  TimeRecord getTotalTime() const {
+    assert(RefCount == 0 && "Cannot query active timer");
+    return Time;
----------------
Any reason why you can't query an active timer?

================
Comment at: lib/Support/Timer.cpp:155
@@ -151,3 +154,3 @@
 void Timer::clear() {
-  Running = Triggered = false;
-  Time = StartTime = TimeRecord();
+  RefCount = 0;
+  Triggered = false;
----------------
hmm, imagine the following sequence:
startTimer()
startTimer()
clear()
stop()
stop()

You hit an assertion, no?


http://reviews.llvm.org/D20735





More information about the llvm-commits mailing list