From d2ebe341f267e588e9482e45ab0d89576d58d99a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 16 Jun 2021 01:43:09 +0200 Subject: [PATCH] Allow filtering out kernel symbols from statistics view. --- server/TracyView.cpp | 16 ++++++++++------ server/TracyView.hpp | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index a7a9443a..1e950143 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -12508,6 +12508,10 @@ void View::DrawStatistics() ImGui::SameLine(); ImGui::Spacing(); ImGui::SameLine(); + ImGui::Checkbox( ICON_FA_HAT_WIZARD " Include kernel", &m_statShowKernel ); + ImGui::SameLine(); + ImGui::Spacing(); + ImGui::SameLine(); } if( m_statMode == 1 && !m_worker.AreSymbolSamplesReady() ) { @@ -12731,13 +12735,13 @@ void View::DrawStatistics() if( m_showAllSymbols ) { data.reserve( symMap.size() ); - if( m_statisticsFilter.IsActive() || m_statisticsImageFilter.IsActive() ) + if( m_statisticsFilter.IsActive() || m_statisticsImageFilter.IsActive() || !m_statShowKernel ) { for( auto& v : symMap ) { const auto name = m_worker.GetString( v.second.name ); const auto image = m_worker.GetString( v.second.imageName ); - bool pass = m_statisticsFilter.PassFilter( name ) && m_statisticsImageFilter.PassFilter( image ); + bool pass = ( m_statShowKernel || ( v.first >> 63 ) == 0 ) && m_statisticsFilter.PassFilter( name ) && m_statisticsImageFilter.PassFilter( image ); if( !pass && v.second.size.Val() == 0 ) { const auto parentAddr = m_worker.GetSymbolForAddress( v.first ); @@ -12747,7 +12751,7 @@ void View::DrawStatistics() if( pit != symMap.end() ) { const auto parentName = m_worker.GetString( pit->second.name ); - pass = m_statisticsFilter.PassFilter( parentName ) && m_statisticsImageFilter.PassFilter( image ); + pass = ( m_statShowKernel || ( parentAddr >> 63 ) == 0 ) && m_statisticsFilter.PassFilter( parentName ) && m_statisticsImageFilter.PassFilter( image ); } } } @@ -12834,7 +12838,7 @@ void View::DrawStatistics() else { data.reserve( symStat.size() ); - if( m_statisticsFilter.IsActive() || m_statisticsImageFilter.IsActive() ) + if( m_statisticsFilter.IsActive() || m_statisticsImageFilter.IsActive() || !m_statShowKernel ) { for( auto& v : symStat ) { @@ -12843,7 +12847,7 @@ void View::DrawStatistics() { const auto name = m_worker.GetString( sit->second.name ); const auto image = m_worker.GetString( sit->second.imageName ); - bool pass = m_statisticsFilter.PassFilter( name ) && m_statisticsImageFilter.PassFilter( image ); + bool pass = ( m_statShowKernel || ( v.first >> 63 ) == 0 ) && m_statisticsFilter.PassFilter( name ) && m_statisticsImageFilter.PassFilter( image ); if( !pass && sit->second.size.Val() == 0 ) { const auto parentAddr = m_worker.GetSymbolForAddress( v.first ); @@ -12853,7 +12857,7 @@ void View::DrawStatistics() if( pit != symMap.end() ) { const auto parentName = m_worker.GetString( pit->second.name ); - pass = m_statisticsFilter.PassFilter( parentName ) && m_statisticsImageFilter.PassFilter( image ); + pass = ( m_statShowKernel || ( parentAddr >> 63 ) == 0 ) && m_statisticsFilter.PassFilter( parentName ) && m_statisticsImageFilter.PassFilter( image ); } } } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 53d10990..3b81c4dc 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -398,6 +398,7 @@ private: bool m_showUnknownFrames = true; bool m_statSeparateInlines = false; bool m_statShowAddress = false; + bool m_statShowKernel = true; bool m_groupChildrenLocations = false; bool m_allocTimeRelativeToZone = true; bool m_ctxSwitchTimeRelativeToZone = true;