1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Don't show callstack column in messages, if no callstacks.

This commit is contained in:
Bartosz Taudul 2022-04-18 15:06:23 +02:00
parent 468add6799
commit 1e762c246a
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 10 additions and 1 deletions

View File

@ -9567,6 +9567,7 @@ void View::DrawMessages()
const bool msgsChanged = msgs.size() != m_prevMessages; const bool msgsChanged = msgs.size() != m_prevMessages;
if( filterChanged || threadsChanged ) if( filterChanged || threadsChanged )
{ {
bool showCallstack = false;
m_msgList.reserve( msgs.size() ); m_msgList.reserve( msgs.size() );
m_msgList.clear(); m_msgList.clear();
if( m_messageFilter.IsActive() ) if( m_messageFilter.IsActive() )
@ -9580,6 +9581,7 @@ void View::DrawMessages()
const auto text = m_worker.GetString( msgs[i]->ref ); const auto text = m_worker.GetString( msgs[i]->ref );
if( m_messageFilter.PassFilter( text ) ) if( m_messageFilter.PassFilter( text ) )
{ {
if( !showCallstack && msgs[i]->callstack.Val() != 0 ) showCallstack = true;
m_msgList.push_back_no_space_check( uint32_t( i ) ); m_msgList.push_back_no_space_check( uint32_t( i ) );
} }
} }
@ -9593,16 +9595,19 @@ void View::DrawMessages()
const auto tid = m_worker.DecompressThread( v->thread ); const auto tid = m_worker.DecompressThread( v->thread );
if( VisibleMsgThread( tid ) ) if( VisibleMsgThread( tid ) )
{ {
if( !showCallstack && msgs[i]->callstack.Val() != 0 ) showCallstack = true;
m_msgList.push_back_no_space_check( uint32_t( i ) ); m_msgList.push_back_no_space_check( uint32_t( i ) );
} }
} }
} }
m_messagesShowCallstack = showCallstack;
m_visibleMessages = m_msgList.size(); m_visibleMessages = m_msgList.size();
if( msgsChanged ) m_prevMessages = msgs.size(); if( msgsChanged ) m_prevMessages = msgs.size();
} }
else if( msgsChanged ) else if( msgsChanged )
{ {
assert( m_prevMessages < msgs.size() ); assert( m_prevMessages < msgs.size() );
bool showCallstack = m_messagesShowCallstack;
m_msgList.reserve( msgs.size() ); m_msgList.reserve( msgs.size() );
if( m_messageFilter.IsActive() ) if( m_messageFilter.IsActive() )
{ {
@ -9615,6 +9620,7 @@ void View::DrawMessages()
const auto text = m_worker.GetString( msgs[i]->ref ); const auto text = m_worker.GetString( msgs[i]->ref );
if( m_messageFilter.PassFilter( text ) ) if( m_messageFilter.PassFilter( text ) )
{ {
if( !showCallstack && msgs[i]->callstack.Val() != 0 ) showCallstack = true;
m_msgList.push_back_no_space_check( uint32_t( i ) ); m_msgList.push_back_no_space_check( uint32_t( i ) );
} }
} }
@ -9628,15 +9634,17 @@ void View::DrawMessages()
const auto tid = m_worker.DecompressThread( v->thread ); const auto tid = m_worker.DecompressThread( v->thread );
if( VisibleMsgThread( tid ) ) if( VisibleMsgThread( tid ) )
{ {
if( !showCallstack && msgs[i]->callstack.Val() != 0 ) showCallstack = true;
m_msgList.push_back_no_space_check( uint32_t( i ) ); m_msgList.push_back_no_space_check( uint32_t( i ) );
} }
} }
} }
m_messagesShowCallstack = showCallstack;
m_visibleMessages = m_msgList.size(); m_visibleMessages = m_msgList.size();
m_prevMessages = msgs.size(); m_prevMessages = msgs.size();
} }
bool hasCallstack = m_worker.GetCallstackFrameCount() != 0; bool hasCallstack = m_messagesShowCallstack;
ImGui::Separator(); ImGui::Separator();
ImGui::BeginChild( "##messages" ); ImGui::BeginChild( "##messages" );
const int colNum = hasCallstack ? 4 : 3; const int colNum = hasCallstack ? 4 : 3;

View File

@ -409,6 +409,7 @@ private:
bool m_showMessageImages = false; bool m_showMessageImages = false;
int m_visibleMessages = 0; int m_visibleMessages = 0;
size_t m_prevMessages = 0; size_t m_prevMessages = 0;
bool m_messagesShowCallstack = false;
Vector<uint32_t> m_msgList; Vector<uint32_t> m_msgList;
bool m_disconnectIssued = false; bool m_disconnectIssued = false;
DecayValue<uint64_t> m_drawThreadMigrations = 0; DecayValue<uint64_t> m_drawThreadMigrations = 0;