mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Always display threads in their original appearance order.
This commit is contained in:
parent
3141d17988
commit
3ea18dcbfd
@ -858,39 +858,40 @@ void View::DrawZones()
|
|||||||
{
|
{
|
||||||
auto& timeline = v.timeline;
|
auto& timeline = v.timeline;
|
||||||
auto it = std::lower_bound( timeline.begin(), timeline.end(), m_zvStart, [] ( const auto& l, const auto& r ) { return l->end < r; } );
|
auto it = std::lower_bound( timeline.begin(), timeline.end(), m_zvStart, [] ( const auto& l, const auto& r ) { return l->end < r; } );
|
||||||
if( it == timeline.end() ) continue;
|
if( it != timeline.end() )
|
||||||
const auto zitend = std::lower_bound( timeline.begin(), timeline.end(), m_zvEnd, [] ( const auto& l, const auto& r ) { return l->start < r; } );
|
|
||||||
|
|
||||||
while( it < zitend )
|
|
||||||
{
|
{
|
||||||
auto& ev = **it;
|
const auto zitend = std::lower_bound( timeline.begin(), timeline.end(), m_zvEnd, [] ( const auto& l, const auto& r ) { return l->start < r; } );
|
||||||
const auto& srcFile = m_srcFile[ev.srcloc];
|
while( it < zitend )
|
||||||
const char* func = GetString( srcFile.function );
|
|
||||||
const auto zsz = ( ev.end - ev.start ) * pxns;
|
|
||||||
const auto tsz = ImGui::CalcTextSize( func );
|
|
||||||
draw->AddRectFilled( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, offset + tsz.y ), 0xDDDD6666, 2.f );
|
|
||||||
draw->AddRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, offset + tsz.y ), 0xAAAAAAAA, 2.f );
|
|
||||||
if( tsz.x < zsz )
|
|
||||||
{
|
{
|
||||||
draw->AddText( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns + ( ( ev.end - ev.start ) * pxns - tsz.x ) / 2, offset ), 0xFFFFFFFF, func );
|
auto& ev = **it;
|
||||||
}
|
const auto& srcFile = m_srcFile[ev.srcloc];
|
||||||
else
|
const char* func = GetString( srcFile.function );
|
||||||
{
|
const auto zsz = ( ev.end - ev.start ) * pxns;
|
||||||
ImGui::PushClipRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, offset + tsz.y ), true );
|
const auto tsz = ImGui::CalcTextSize( func );
|
||||||
draw->AddText( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), 0xFFFFFFFF, func );
|
draw->AddRectFilled( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, offset + tsz.y ), 0xDDDD6666, 2.f );
|
||||||
ImGui::PopClipRect();
|
draw->AddRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, offset + tsz.y ), 0xAAAAAAAA, 2.f );
|
||||||
}
|
if( tsz.x < zsz )
|
||||||
|
{
|
||||||
|
draw->AddText( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns + ( ( ev.end - ev.start ) * pxns - tsz.x ) / 2, offset ), 0xFFFFFFFF, func );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::PushClipRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, offset + tsz.y ), true );
|
||||||
|
draw->AddText( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), 0xFFFFFFFF, func );
|
||||||
|
ImGui::PopClipRect();
|
||||||
|
}
|
||||||
|
|
||||||
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, offset + tsz.y ) ) )
|
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), wpos + ImVec2( ( ev.end - m_zvStart ) * pxns, offset + tsz.y ) ) )
|
||||||
{
|
{
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::Text( func );
|
ImGui::Text( func );
|
||||||
ImGui::Text( "%s:%i", GetString( srcFile.filename ), srcFile.line );
|
ImGui::Text( "%s:%i", GetString( srcFile.filename ), srcFile.line );
|
||||||
ImGui::Text( "Execution time: %s", TimeToString( ev.end - ev.start ) );
|
ImGui::Text( "Execution time: %s", TimeToString( ev.end - ev.start ) );
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
it++;
|
it++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
draw->AddText( wpos + ImVec2( 0, offset ), 0xFFFFFFFF, GetThreadString( v.id ) );
|
draw->AddText( wpos + ImVec2( 0, offset ), 0xFFFFFFFF, GetThreadString( v.id ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user