diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-20 11:41:25 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-20 11:41:25 +0000 |
commit | d9484dd61cc151c4f34c31e07f693fefa66316b5 (patch) | |
tree | ab0560b3da293f1fafd3269c59692e929418f5c2 /contrib/llvm/lib/Support/Timer.cpp | |
parent | 79e0962d4c3cf1f0acf359a9d69cb3ac68c414c4 (diff) | |
parent | d8e91e46262bc44006913e6796843909f1ac7bcd (diff) |
Notes
Diffstat (limited to 'contrib/llvm/lib/Support/Timer.cpp')
-rw-r--r-- | contrib/llvm/lib/Support/Timer.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/contrib/llvm/lib/Support/Timer.cpp b/contrib/llvm/lib/Support/Timer.cpp index 61d3b6c6e319..82f5810dd107 100644 --- a/contrib/llvm/lib/Support/Timer.cpp +++ b/contrib/llvm/lib/Support/Timer.cpp @@ -295,7 +295,7 @@ void TimerGroup::addTimer(Timer &T) { void TimerGroup::PrintQueuedTimers(raw_ostream &OS) { // Sort the timers in descending order by amount of time taken. - llvm::sort(TimersToPrint.begin(), TimersToPrint.end()); + llvm::sort(TimersToPrint); TimeRecord Total; for (const PrintRecord &Record : TimersToPrint) @@ -343,8 +343,7 @@ void TimerGroup::PrintQueuedTimers(raw_ostream &OS) { } void TimerGroup::prepareToPrintList() { - // See if any of our timers were started, if so add them to TimersToPrint and - // reset them. + // See if any of our timers were started, if so add them to TimersToPrint. for (Timer *T = FirstTimer; T; T = T->Next) { if (!T->hasTriggered()) continue; bool WasRunning = T->isRunning(); @@ -368,6 +367,12 @@ void TimerGroup::print(raw_ostream &OS) { PrintQueuedTimers(OS); } +void TimerGroup::clear() { + sys::SmartScopedLock<true> L(*TimerLock); + for (Timer *T = FirstTimer; T; T = T->Next) + T->clear(); +} + void TimerGroup::printAll(raw_ostream &OS) { sys::SmartScopedLock<true> L(*TimerLock); @@ -375,6 +380,12 @@ void TimerGroup::printAll(raw_ostream &OS) { TG->print(OS); } +void TimerGroup::clearAll() { + sys::SmartScopedLock<true> L(*TimerLock); + for (TimerGroup *TG = TimerGroupList; TG; TG = TG->Next) + TG->clear(); +} + void TimerGroup::printJSONValue(raw_ostream &OS, const PrintRecord &R, const char *suffix, double Value) { assert(yaml::needsQuotes(Name) == yaml::QuotingType::None && |