Detect over-long thread suspends and time out fatally.
Bug: 5726434
Change-Id: Ib7d4429c2b195f59133bb6dc7f9072b705c53e82
diff --git a/src/runtime.cc b/src/runtime.cc
index 6491138..b41ebde 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -639,6 +639,19 @@
thread_list_->Dump(os);
}
+void Runtime::DumpLockHolders(std::ostream& os) {
+ pid_t heap_lock_owner = Heap::GetLockOwner();
+ pid_t thread_list_lock_owner = GetThreadList()->GetLockOwner();
+ pid_t classes_lock_owner = GetClassLinker()->GetClassesLockOwner();
+ pid_t dex_lock_owner = GetClassLinker()->GetDexLockOwner();
+ if ((heap_lock_owner | thread_list_lock_owner | classes_lock_owner | dex_lock_owner) != 0) {
+ os << "Heap lock owner tid: " << heap_lock_owner << "\n"
+ << "ThreadList lock owner tid: " << thread_list_lock_owner << "\n"
+ << "ClassLinker classes lock owner tid: " << classes_lock_owner << "\n"
+ << "ClassLinker dex lock owner tid: " << dex_lock_owner << "\n";
+ }
+}
+
void Runtime::SetStatsEnabled(bool new_state) {
if (new_state == true) {
GetStats()->Clear(~0);