diff options
author | Mathieu Chartier <mathieuc@google.com> | 2015-03-13 17:21:25 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2015-03-13 17:32:48 -0700 |
commit | bf9fc581e8870faddbd320a935f9a627da724c48 (patch) | |
tree | 0a4a6c21fbd4c771b06fac186d32efa6722605b2 | |
parent | 3d96846b6adedf57be64eb3873de0ca58ec4b827 (diff) | |
download | art-bf9fc581e8870faddbd320a935f9a627da724c48.zip art-bf9fc581e8870faddbd320a935f9a627da724c48.tar.gz art-bf9fc581e8870faddbd320a935f9a627da724c48.tar.bz2 |
Add more info to who called SuspendAll
Helps diagnose related jank.
Change-Id: I38191cdda723c6f0355d0197c494a3dff2b6653c
-rw-r--r-- | compiler/driver/compiler_driver.cc | 2 | ||||
-rw-r--r-- | oatdump/oatdump.cc | 2 | ||||
-rw-r--r-- | runtime/debugger.cc | 12 | ||||
-rw-r--r-- | runtime/gc/collector/garbage_collector.cc | 2 | ||||
-rw-r--r-- | runtime/gc/heap.cc | 10 | ||||
-rw-r--r-- | runtime/gc/space/rosalloc_space.cc | 2 | ||||
-rw-r--r-- | runtime/hprof/hprof.cc | 2 | ||||
-rw-r--r-- | runtime/instrumentation.cc | 2 | ||||
-rw-r--r-- | runtime/jit/jit.cc | 2 | ||||
-rw-r--r-- | runtime/thread_list.cc | 8 | ||||
-rw-r--r-- | runtime/thread_list.h | 2 | ||||
-rw-r--r-- | runtime/trace.cc | 6 |
12 files changed, 26 insertions, 26 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index be6c41a..3d3d5cb 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -932,7 +932,7 @@ void CompilerDriver::UpdateImageClasses(TimingLogger* timings) { Runtime* current = Runtime::Current(); // Suspend all threads. - current->GetThreadList()->SuspendAll(); + current->GetThreadList()->SuspendAll(__FUNCTION__); std::string error_msg; std::unique_ptr<ClinitImageUpdate> update(ClinitImageUpdate::Create(image_classes_.get(), diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index 344d2b5..c27b3d4 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -1539,7 +1539,7 @@ class ImageDumper { { self->TransitionFromRunnableToSuspended(kNative); ThreadList* thread_list = Runtime::Current()->GetThreadList(); - thread_list->SuspendAll(); + thread_list->SuspendAll(__FUNCTION__); heap->RevokeAllThreadLocalAllocationStacks(self); thread_list->ResumeAll(); self->TransitionFromSuspendedToRunnable(); diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 9f2a09b..6296cf5 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -644,7 +644,7 @@ void Dbg::GoActive() { } Runtime* runtime = Runtime::Current(); - runtime->GetThreadList()->SuspendAll(); + runtime->GetThreadList()->SuspendAll(__FUNCTION__); Thread* self = Thread::Current(); ThreadState old_state = self->SetStateUnsafe(kRunnable); CHECK_NE(old_state, kRunnable); @@ -668,7 +668,7 @@ void Dbg::Disconnected() { // to kRunnable to avoid scoped object access transitions. Remove the debugger as a listener // and clear the object registry. Runtime* runtime = Runtime::Current(); - runtime->GetThreadList()->SuspendAll(); + runtime->GetThreadList()->SuspendAll(__FUNCTION__); Thread* self = Thread::Current(); ThreadState old_state = self->SetStateUnsafe(kRunnable); @@ -819,7 +819,7 @@ JDWP::JdwpError Dbg::GetMonitorInfo(JDWP::ObjectId object_id, JDWP::ExpandBuf* r Thread* self = Thread::Current(); CHECK_EQ(self->GetState(), kRunnable); self->TransitionFromRunnableToSuspended(kSuspended); - Runtime::Current()->GetThreadList()->SuspendAll(); + Runtime::Current()->GetThreadList()->SuspendAll(__FUNCTION__); MonitorInfo monitor_info(o); @@ -3135,7 +3135,7 @@ void Dbg::ManageDeoptimization() { self->TransitionFromRunnableToSuspended(kWaitingForDeoptimization); // We need to suspend mutator threads first. Runtime* const runtime = Runtime::Current(); - runtime->GetThreadList()->SuspendAll(); + runtime->GetThreadList()->SuspendAll(__FUNCTION__); const ThreadState old_state = self->SetStateUnsafe(kRunnable); { MutexLock mu(self, *Locks::deoptimization_lock_); @@ -4436,7 +4436,7 @@ void Dbg::DdmSendHeapSegments(bool native) { // RosAlloc's internal logic doesn't know to release and reacquire the heap bitmap lock. self->TransitionFromRunnableToSuspended(kSuspended); ThreadList* tl = Runtime::Current()->GetThreadList(); - tl->SuspendAll(); + tl->SuspendAll(__FUNCTION__); { ReaderMutexLock mu(self, *Locks::heap_bitmap_lock_); space->AsRosAllocSpace()->Walk(HeapChunkContext::HeapChunkJavaCallback, &context); @@ -4452,7 +4452,7 @@ void Dbg::DdmSendHeapSegments(bool native) { heap->IncrementDisableMovingGC(self); self->TransitionFromRunnableToSuspended(kSuspended); ThreadList* tl = Runtime::Current()->GetThreadList(); - tl->SuspendAll(); + tl->SuspendAll(__FUNCTION__); ReaderMutexLock mu(self, *Locks::heap_bitmap_lock_); context.SetChunkOverhead(0); space->AsRegionSpace()->Walk(BumpPointerSpaceCallback, &context); diff --git a/runtime/gc/collector/garbage_collector.cc b/runtime/gc/collector/garbage_collector.cc index eafcc45..47d6ada 100644 --- a/runtime/gc/collector/garbage_collector.cc +++ b/runtime/gc/collector/garbage_collector.cc @@ -157,7 +157,7 @@ void GarbageCollector::ResetMeasurements() { GarbageCollector::ScopedPause::ScopedPause(GarbageCollector* collector) : start_time_(NanoTime()), collector_(collector) { - Runtime::Current()->GetThreadList()->SuspendAll(); + Runtime::Current()->GetThreadList()->SuspendAll(__FUNCTION__); } GarbageCollector::ScopedPause::~ScopedPause() { diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 1298272..0cad11f 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -576,7 +576,7 @@ void Heap::DisableMovingGc() { ThreadList* tl = Runtime::Current()->GetThreadList(); Thread* self = Thread::Current(); ScopedThreadStateChange tsc(self, kSuspended); - tl->SuspendAll(); + tl->SuspendAll(__FUNCTION__); // Something may have caused the transition to fail. if (!IsMovingGc(collector_type_) && non_moving_space_ != main_space_) { CHECK(main_space_ != nullptr); @@ -758,7 +758,7 @@ void Heap::VisitObjects(ObjectCallback callback, void* arg) { IncrementDisableMovingGC(self); self->TransitionFromRunnableToSuspended(kWaitingForVisitObjects); ThreadList* tl = Runtime::Current()->GetThreadList(); - tl->SuspendAll(); + tl->SuspendAll(__FUNCTION__); VisitObjectsInternalRegionSpace(callback, arg); VisitObjectsInternal(callback, arg); tl->ResumeAll(); @@ -1058,7 +1058,7 @@ void Heap::Trim(Thread* self) { // Deflate the monitors, this can cause a pause but shouldn't matter since we don't care // about pauses. Runtime* runtime = Runtime::Current(); - runtime->GetThreadList()->SuspendAll(); + runtime->GetThreadList()->SuspendAll(__FUNCTION__); uint64_t start_time = NanoTime(); size_t count = runtime->GetMonitorList()->DeflateMonitors(); VLOG(heap) << "Deflating " << count << " monitors took " @@ -1697,7 +1697,7 @@ HomogeneousSpaceCompactResult Heap::PerformHomogeneousSpaceCompact() { return HomogeneousSpaceCompactResult::kErrorVMShuttingDown; } // Suspend all threads. - tl->SuspendAll(); + tl->SuspendAll(__FUNCTION__); uint64_t start_time = NanoTime(); // Launch compaction. space::MallocSpace* to_space = main_space_backup_.release(); @@ -1779,7 +1779,7 @@ void Heap::TransitionCollector(CollectorType collector_type) { return; } collector::GarbageCollector* collector = nullptr; - tl->SuspendAll(); + tl->SuspendAll(__FUNCTION__); switch (collector_type) { case kCollectorTypeSS: { if (!IsMovingGc(collector_type_)) { diff --git a/runtime/gc/space/rosalloc_space.cc b/runtime/gc/space/rosalloc_space.cc index f140021..eb1d5f4 100644 --- a/runtime/gc/space/rosalloc_space.cc +++ b/runtime/gc/space/rosalloc_space.cc @@ -303,7 +303,7 @@ void RosAllocSpace::InspectAllRosAllocWithSuspendAll( // TODO: NO_THREAD_SAFETY_ANALYSIS. Thread* self = Thread::Current(); ThreadList* tl = Runtime::Current()->GetThreadList(); - tl->SuspendAll(); + tl->SuspendAll(__FUNCTION__); { MutexLock mu(self, *Locks::runtime_shutdown_lock_); MutexLock mu2(self, *Locks::thread_list_lock_); diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc index 5a7b7e1..b822613 100644 --- a/runtime/hprof/hprof.cc +++ b/runtime/hprof/hprof.cc @@ -1180,7 +1180,7 @@ void DumpHeap(const char* filename, int fd, bool direct_to_ddms) { // comment in Heap::VisitObjects(). heap->IncrementDisableMovingGC(self); } - Runtime::Current()->GetThreadList()->SuspendAll(); + Runtime::Current()->GetThreadList()->SuspendAll(__FUNCTION__); Hprof hprof(filename, fd, direct_to_ddms); hprof.Dump(); Runtime::Current()->GetThreadList()->ResumeAll(); diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc index 085062c..b53b8cd 100644 --- a/runtime/instrumentation.cc +++ b/runtime/instrumentation.cc @@ -607,7 +607,7 @@ void Instrumentation::SetEntrypointsInstrumented(bool instrumented) { Locks::mutator_lock_->AssertNotHeld(self); Locks::instrument_entrypoints_lock_->AssertHeld(self); if (runtime->IsStarted()) { - tl->SuspendAll(); + tl->SuspendAll(__FUNCTION__); } { MutexLock mu(self, *Locks::runtime_shutdown_lock_); diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 897287b..82b7ba7 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -167,7 +167,7 @@ Jit::~Jit() { void Jit::CreateInstrumentationCache(size_t compile_threshold) { CHECK_GT(compile_threshold, 0U); Runtime* const runtime = Runtime::Current(); - runtime->GetThreadList()->SuspendAll(); + runtime->GetThreadList()->SuspendAll(__FUNCTION__); // Add Jit interpreter instrumentation, tells the interpreter when to notify the jit to compile // something. instrumentation_cache_.reset(new jit::JitInstrumentationCache(compile_threshold)); diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index ddfbebd..1ab0093 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -448,13 +448,13 @@ size_t ThreadList::FlipThreadRoots(Closure* thread_flip_visitor, Closure* flip_c return runnable_threads.size() + other_threads.size() + 1; // +1 for self. } -void ThreadList::SuspendAll() { +void ThreadList::SuspendAll(const char* cause) { Thread* self = Thread::Current(); if (self != nullptr) { - VLOG(threads) << *self << " SuspendAll starting..."; + VLOG(threads) << *self << " SuspendAll for " << cause << " starting..."; } else { - VLOG(threads) << "Thread[null] SuspendAll starting..."; + VLOG(threads) << "Thread[null] SuspendAll for " << cause << " starting..."; } ATRACE_BEGIN("Suspending mutator threads"); const uint64_t start_time = NanoTime(); @@ -503,7 +503,7 @@ void ThreadList::SuspendAll() { } ATRACE_END(); - ATRACE_BEGIN("Mutator threads suspended"); + ATRACE_BEGIN((std::string("Mutator threads suspended for ") + cause).c_str()); if (self != nullptr) { VLOG(threads) << *self << " SuspendAll complete"; diff --git a/runtime/thread_list.h b/runtime/thread_list.h index de0dd79..c18e285 100644 --- a/runtime/thread_list.h +++ b/runtime/thread_list.h @@ -61,7 +61,7 @@ class ThreadList { LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_); // Suspends all threads and gets exclusive access to the mutator_lock_. - void SuspendAll() + void SuspendAll(const char* cause) EXCLUSIVE_LOCK_FUNCTION(Locks::mutator_lock_) LOCKS_EXCLUDED(Locks::thread_list_lock_, Locks::thread_suspend_count_lock_); diff --git a/runtime/trace.cc b/runtime/trace.cc index 8833a85..88be23f 100644 --- a/runtime/trace.cc +++ b/runtime/trace.cc @@ -313,7 +313,7 @@ void* Trace::RunSamplingThread(void* arg) { } } - runtime->GetThreadList()->SuspendAll(); + runtime->GetThreadList()->SuspendAll(__FUNCTION__); { MutexLock mu(self, *Locks::thread_list_lock_); runtime->GetThreadList()->ForEach(GetSample, the_trace); @@ -367,7 +367,7 @@ void Trace::Start(const char* trace_filename, int trace_fd, int buffer_size, int // Enable count of allocs if specified in the flags. bool enable_stats = false; - runtime->GetThreadList()->SuspendAll(); + runtime->GetThreadList()->SuspendAll(__FUNCTION__); // Create Trace object. { @@ -421,7 +421,7 @@ void Trace::Stop() { CHECK_PTHREAD_CALL(pthread_join, (sampling_pthread, NULL), "sampling thread shutdown"); sampling_pthread_ = 0U; } - runtime->GetThreadList()->SuspendAll(); + runtime->GetThreadList()->SuspendAll(__FUNCTION__); if (the_trace != nullptr) { stop_alloc_counting = (the_trace->flags_ & kTraceCountAllocs) != 0; the_trace->FinishTracing(); |