mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Improve lock label tooltips.
This commit is contained in:
parent
c78aedae62
commit
9f621bf67f
@ -2959,6 +2959,30 @@ void View::DrawLockHeader( uint32_t id, const LockMap& lockmap, const SourceLoca
|
|||||||
|
|
||||||
if( ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + ImGui::CalcTextSize( buf ).x, offset + ty ) ) )
|
if( ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + ImGui::CalcTextSize( buf ).x, offset + ty ) ) )
|
||||||
{
|
{
|
||||||
|
auto lptr = lockmap.timeline.data();
|
||||||
|
auto eptr = lptr + lockmap.timeline.size() - 1;
|
||||||
|
while( (*lptr)->thread != tid ) lptr++;
|
||||||
|
const auto first = (*lptr)->time;
|
||||||
|
while( (*eptr)->thread != tid ) eptr--;
|
||||||
|
const auto last = (*eptr)->time;
|
||||||
|
const auto activity = last - first;
|
||||||
|
const auto traceLen = m_worker.GetLastTime() - m_worker.GetTimeBegin();
|
||||||
|
|
||||||
|
int64_t timeAnnounce = lockmap.timeAnnounce;
|
||||||
|
int64_t timeTerminate = lockmap.timeTerminate;
|
||||||
|
if( !lockmap.timeline.empty() )
|
||||||
|
{
|
||||||
|
if( timeAnnounce == 0 )
|
||||||
|
{
|
||||||
|
timeAnnounce = lockmap.timeline.front()->time;
|
||||||
|
}
|
||||||
|
if( timeTerminate == 0 )
|
||||||
|
{
|
||||||
|
timeTerminate = lockmap.timeline.back()->time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const auto lockLen = timeTerminate - timeAnnounce;
|
||||||
|
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
switch( lockmap.type )
|
switch( lockmap.type )
|
||||||
{
|
{
|
||||||
@ -2974,6 +2998,25 @@ void View::DrawLockHeader( uint32_t id, const LockMap& lockmap, const SourceLoca
|
|||||||
}
|
}
|
||||||
ImGui::Text( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line );
|
ImGui::Text( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
#ifdef TRACY_EXTENDED_FONT
|
||||||
|
TextFocused( ICON_FA_RANDOM " Appeared at", TimeToString( first - m_worker.GetTimeBegin() ) );
|
||||||
|
TextFocused( ICON_FA_RANDOM " Last event at", TimeToString( last - m_worker.GetTimeBegin() ) );
|
||||||
|
TextFocused( ICON_FA_RANDOM " Activity time:", TimeToString( activity ) );
|
||||||
|
#else
|
||||||
|
ImGui::TextUnformatted( "This thread" );
|
||||||
|
TextFocused( "Appeared at", TimeToString( first - m_worker.GetTimeBegin() ) );
|
||||||
|
TextFocused( "Last event at", TimeToString( last - m_worker.GetTimeBegin() ) );
|
||||||
|
TextFocused( "Activity time:", TimeToString( activity ) );
|
||||||
|
#endif
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextDisabled( "(%.2f%% of lock lifetime)", activity / double( lockLen ) * 100 );
|
||||||
|
ImGui::Separator();
|
||||||
|
TextFocused( "Announce time:", TimeToString( timeAnnounce - m_worker.GetTimeBegin() ) );
|
||||||
|
TextFocused( "Terminate time:", TimeToString( timeTerminate - m_worker.GetTimeBegin() ) );
|
||||||
|
TextFocused( "Lifetime:", TimeToString( lockLen ) );
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextDisabled( "(%.2f%% of trace time)", lockLen / double( traceLen ) * 100 );
|
||||||
|
ImGui::Separator();
|
||||||
TextDisabledUnformatted( "Thread list:" );
|
TextDisabledUnformatted( "Thread list:" );
|
||||||
ImGui::Indent( ty );
|
ImGui::Indent( ty );
|
||||||
for( const auto& t : lockmap.threadList )
|
for( const auto& t : lockmap.threadList )
|
||||||
@ -2991,11 +3034,7 @@ void View::DrawLockHeader( uint32_t id, const LockMap& lockmap, const SourceLoca
|
|||||||
}
|
}
|
||||||
if( ImGui::IsMouseClicked( 2 ) )
|
if( ImGui::IsMouseClicked( 2 ) )
|
||||||
{
|
{
|
||||||
auto lptr = lockmap.timeline.data();
|
ZoomToRange( first, last );
|
||||||
auto eptr = lptr + lockmap.timeline.size() - 1;
|
|
||||||
while( (*lptr)->thread != tid ) lptr++;
|
|
||||||
while( (*eptr)->thread != tid ) eptr--;
|
|
||||||
ZoomToRange( (*lptr)->time, (*eptr)->time );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8124,17 +8163,21 @@ void View::DrawLockInfoWindow()
|
|||||||
const auto announce = timeAnnounce - m_worker.GetTimeBegin();
|
const auto announce = timeAnnounce - m_worker.GetTimeBegin();
|
||||||
const auto terminate = timeTerminate - m_worker.GetTimeBegin();
|
const auto terminate = timeTerminate - m_worker.GetTimeBegin();
|
||||||
const auto lifetime = timeTerminate - timeAnnounce;
|
const auto lifetime = timeTerminate - timeAnnounce;
|
||||||
|
const auto traceLen = m_worker.GetLastTime() - m_worker.GetTimeBegin();
|
||||||
|
|
||||||
TextFocused( "Announce time:", TimeToString( announce ) );
|
TextFocused( "Announce time:", TimeToString( announce ) );
|
||||||
TextFocused( "Terminate time:", TimeToString( terminate ) );
|
TextFocused( "Terminate time:", TimeToString( terminate ) );
|
||||||
TextFocused( "Lifetime:", TimeToString( lifetime ) );
|
TextFocused( "Lifetime:", TimeToString( lifetime ) );
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextDisabled( "(%.2f%% of trace time)", lifetime / double( traceLen ) * 100 );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
TextFocused( "Lock hold time:", TimeToString( holdTotalTime ) );
|
TextFocused( "Lock hold time:", TimeToString( holdTotalTime ) );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextDisabled( "(%.2f%%)", holdTotalTime / float( lifetime ) * 100.f );
|
ImGui::TextDisabled( "(%.2f%% of lock lifetime)", holdTotalTime / float( lifetime ) * 100.f );
|
||||||
TextFocused( "Lock wait time:", TimeToString( waitTotalTime ) );
|
TextFocused( "Lock wait time:", TimeToString( waitTotalTime ) );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextDisabled( "(%.2f%%)", waitTotalTime / float( lifetime ) * 100.f );
|
ImGui::TextDisabled( "(%.2f%% of lock lifetime)", waitTotalTime / float( lifetime ) * 100.f );
|
||||||
TextFocused( "Max waiting threads:", RealToString( maxWaitingThreads, true ) );
|
TextFocused( "Max waiting threads:", RealToString( maxWaitingThreads, true ) );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user