diff options
Diffstat (limited to 'runtime/thread_list.cc')
-rw-r--r-- | runtime/thread_list.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index 54732fae04..b649b626ca 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -39,6 +39,8 @@ namespace art { +static constexpr uint64_t kLongThreadSuspendThreshold = MsToNs(5); + ThreadList::ThreadList() : suspend_all_count_(0), debug_suspend_all_count_(0), thread_exit_cond_("thread exit condition variable", *Locks::thread_list_lock_) { @@ -304,8 +306,8 @@ void ThreadList::SuspendAll() { DCHECK(self != nullptr); VLOG(threads) << *self << " SuspendAll starting..."; - ATRACE_BEGIN("Suspending mutator threads"); + uint64_t start_time = NanoTime(); Locks::mutator_lock_->AssertNotHeld(self); Locks::thread_list_lock_->AssertNotHeld(self); @@ -338,6 +340,11 @@ void ThreadList::SuspendAll() { Locks::mutator_lock_->ExclusiveLock(self); #endif + uint64_t end_time = NanoTime(); + if (end_time - start_time > kLongThreadSuspendThreshold) { + LOG(WARNING) << "Suspending all threads took: " << PrettyDuration(end_time - start_time); + } + if (kDebugLocking) { // Debug check that all threads are suspended. AssertThreadsAreSuspended(self, self); |