From b965a1c9363f0a31e01ed81fe5f37820452e635e Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 5 Oct 2017 23:47:51 +0200 Subject: [PATCH] Show which threads are blocking/blocked. --- server/TracyView.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 23d0b694..4e7ee470 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -1660,11 +1660,36 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, ImGui::Text( "Thread \"%s\" has lock. No other threads are waiting.", GetThreadString( tid ) ); break; case State::HasBlockingLock: - ImGui::Text( "Thread \"%s\" has lock. Other threads are blocked.", GetThreadString( tid ) ); + { + ImGui::Text( "Thread \"%s\" has lock. Other threads are blocked:", GetThreadString( tid ) ); + auto it = next; + do + { + --it; + if( (*it)->type == LockEvent::Type::Wait ) + { + ImGui::Text( "\"%s\"", GetThreadString( (*it)->thread ) ); + } + } + while( it != vbegin ); break; + } case State::WaitLock: - ImGui::Text( "Thread \"%s\" is blocked by other threads.", GetThreadString( tid ) ); + { + ImGui::Text( "Thread \"%s\" is blocked by other thread:", GetThreadString( tid ) ); + auto it = vbegin; + --it; + for(;;) + { + if( (*it)->type == LockEvent::Type::Obtain ) + { + ImGui::Text( "\"%s\"", GetThreadString( (*it)->thread ) ); + break; + } + --it; + } break; + } default: assert( false ); break;