Color kernel frames in callstack trees.

This commit is contained in:
Bartosz Taudul 2021-11-14 02:06:22 +01:00
parent 0666dc0813
commit 2040ef945f
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -17559,6 +17559,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, MemCallstackFr
for( auto& _v : sorted ) for( auto& _v : sorted )
{ {
auto& v = _v->second; auto& v = _v->second;
const auto isKernel = ( m_worker.GetCanonicalPointer( v.frame ) >> 63 ) != 0;
idx++; idx++;
auto frameDataPtr = m_worker.GetCallstackFrame( v.frame ); auto frameDataPtr = m_worker.GetCallstackFrame( v.frame );
if( frameDataPtr ) if( frameDataPtr )
@ -17566,15 +17567,24 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, MemCallstackFr
auto& frameData = *frameDataPtr; auto& frameData = *frameDataPtr;
auto frame = frameData.data[frameData.size-1]; auto frame = frameData.data[frameData.size-1];
bool expand = false; bool expand = false;
if( v.children.empty() ) if( v.children.empty() )
{ {
ImGui::Indent( ImGui::GetTreeNodeToLabelSpacing() ); ImGui::Indent( ImGui::GetTreeNodeToLabelSpacing() );
ImGui::TextUnformatted( m_worker.GetString( frame.name ) ); if( isKernel )
{
TextColoredUnformatted( 0xFF8888FF, m_worker.GetString( frame.name ) );
}
else
{
ImGui::TextUnformatted( m_worker.GetString( frame.name ) );
}
ImGui::Unindent( ImGui::GetTreeNodeToLabelSpacing() ); ImGui::Unindent( ImGui::GetTreeNodeToLabelSpacing() );
} }
else else
{ {
ImGui::PushID( lidx++ ); ImGui::PushID( lidx++ );
if( isKernel ) ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF );
if( tree.size() == 1 ) if( tree.size() == 1 )
{ {
expand = ImGui::TreeNodeEx( m_worker.GetString( frame.name ), ImGuiTreeNodeFlags_DefaultOpen ); expand = ImGui::TreeNodeEx( m_worker.GetString( frame.name ), ImGuiTreeNodeFlags_DefaultOpen );
@ -17583,6 +17593,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, MemCallstackFr
{ {
expand = ImGui::TreeNode( m_worker.GetString( frame.name ) ); expand = ImGui::TreeNode( m_worker.GetString( frame.name ) );
} }
if( isKernel ) ImGui::PopStyleColor();
ImGui::PopID(); ImGui::PopID();
} }
@ -17678,6 +17689,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrame
for( auto& _v : sorted ) for( auto& _v : sorted )
{ {
auto& v = _v->second; auto& v = _v->second;
const auto isKernel = ( m_worker.GetCanonicalPointer( v.frame ) >> 63 ) != 0;
idx++; idx++;
auto frameDataPtr = m_worker.GetCallstackFrame( v.frame ); auto frameDataPtr = m_worker.GetCallstackFrame( v.frame );
if( frameDataPtr ) if( frameDataPtr )
@ -17688,12 +17700,20 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrame
if( v.children.empty() ) if( v.children.empty() )
{ {
ImGui::Indent( ImGui::GetTreeNodeToLabelSpacing() ); ImGui::Indent( ImGui::GetTreeNodeToLabelSpacing() );
ImGui::TextUnformatted( m_worker.GetString( frame.name ) ); if( isKernel )
{
TextColoredUnformatted( 0xFF8888FF, m_worker.GetString( frame.name ) );
}
else
{
ImGui::TextUnformatted( m_worker.GetString( frame.name ) );
}
ImGui::Unindent( ImGui::GetTreeNodeToLabelSpacing() ); ImGui::Unindent( ImGui::GetTreeNodeToLabelSpacing() );
} }
else else
{ {
ImGui::PushID( lidx++ ); ImGui::PushID( lidx++ );
if( isKernel ) ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF );
if( tree.size() == 1 ) if( tree.size() == 1 )
{ {
expand = ImGui::TreeNodeEx( m_worker.GetString( frame.name ), ImGuiTreeNodeFlags_DefaultOpen ); expand = ImGui::TreeNodeEx( m_worker.GetString( frame.name ), ImGuiTreeNodeFlags_DefaultOpen );
@ -17702,6 +17722,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrame
{ {
expand = ImGui::TreeNode( m_worker.GetString( frame.name ) ); expand = ImGui::TreeNode( m_worker.GetString( frame.name ) );
} }
if( isKernel ) ImGui::PopStyleColor();
ImGui::PopID(); ImGui::PopID();
} }