mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Use lock thread ranges in lock tooltips.
This commit is contained in:
parent
833151b868
commit
6db1a9ccd4
@ -3031,13 +3031,8 @@ 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();
|
const auto& range = lockmap.range[tid];
|
||||||
auto eptr = lptr + lockmap.timeline.size() - 1;
|
const auto activity = range.end - range.start;
|
||||||
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();
|
const auto traceLen = m_worker.GetLastTime() - m_worker.GetTimeBegin();
|
||||||
|
|
||||||
int64_t timeAnnounce = lockmap.timeAnnounce;
|
int64_t timeAnnounce = lockmap.timeAnnounce;
|
||||||
@ -3071,13 +3066,13 @@ 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
|
#ifdef TRACY_EXTENDED_FONT
|
||||||
TextFocused( ICON_FA_RANDOM " Appeared at", TimeToString( first - m_worker.GetTimeBegin() ) );
|
TextFocused( ICON_FA_RANDOM " Appeared at", TimeToString( range.start - m_worker.GetTimeBegin() ) );
|
||||||
TextFocused( ICON_FA_RANDOM " Last event at", TimeToString( last - m_worker.GetTimeBegin() ) );
|
TextFocused( ICON_FA_RANDOM " Last event at", TimeToString( range.end - m_worker.GetTimeBegin() ) );
|
||||||
TextFocused( ICON_FA_RANDOM " Activity time:", TimeToString( activity ) );
|
TextFocused( ICON_FA_RANDOM " Activity time:", TimeToString( activity ) );
|
||||||
#else
|
#else
|
||||||
ImGui::TextUnformatted( "This thread" );
|
ImGui::TextUnformatted( "This thread" );
|
||||||
TextFocused( "Appeared at", TimeToString( first - m_worker.GetTimeBegin() ) );
|
TextFocused( "Appeared at", TimeToString( range.start - m_worker.GetTimeBegin() ) );
|
||||||
TextFocused( "Last event at", TimeToString( last - m_worker.GetTimeBegin() ) );
|
TextFocused( "Last event at", TimeToString( range.end - m_worker.GetTimeBegin() ) );
|
||||||
TextFocused( "Activity time:", TimeToString( activity ) );
|
TextFocused( "Activity time:", TimeToString( activity ) );
|
||||||
#endif
|
#endif
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -3106,7 +3101,7 @@ void View::DrawLockHeader( uint32_t id, const LockMap& lockmap, const SourceLoca
|
|||||||
}
|
}
|
||||||
if( ImGui::IsMouseClicked( 2 ) )
|
if( ImGui::IsMouseClicked( 2 ) )
|
||||||
{
|
{
|
||||||
ZoomToRange( first, last );
|
ZoomToRange( range.start, range.end );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user