aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Timer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Timer.cpp')
-rw-r--r--llvm/lib/Support/Timer.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp
index 089dae2..eca7268 100644
--- a/llvm/lib/Support/Timer.cpp
+++ b/llvm/lib/Support/Timer.cpp
@@ -284,6 +284,11 @@ TimerGroup::~TimerGroup() {
while (FirstTimer)
removeTimer(*FirstTimer);
+ if (!TimersToPrint.empty()) {
+ std::unique_ptr<raw_ostream> OutStream = CreateInfoOutputFile();
+ PrintQueuedTimers(*OutStream);
+ }
+
// Remove the group from the TimerGroupList.
sys::SmartScopedLock<true> L(timerLock());
*Prev = Next;
@@ -305,14 +310,6 @@ void TimerGroup::removeTimer(Timer &T) {
*T.Prev = T.Next;
if (T.Next)
T.Next->Prev = T.Prev;
-
- // Print the report when all timers in this group are destroyed if some of
- // them were started.
- if (FirstTimer || TimersToPrint.empty())
- return;
-
- std::unique_ptr<raw_ostream> OutStream = CreateInfoOutputFile();
- PrintQueuedTimers(*OutStream);
}
void TimerGroup::addTimer(Timer &T) {