From 3ba82ba4d6d84a69b9ca8f2b8b4364ba41e97ee8 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 20 May 2021 19:56:23 +0200 Subject: [PATCH] Separate IPC, cache and branch data in tooltip. --- server/TracySourceView.cpp | 55 +++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 91a135e1..8487fda7 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -2626,34 +2626,45 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr const auto hw = worker.GetHwSampleData( line.addr ); if( hw ) { - ImGui::Separator(); - if( hw->cycles && hw->retired ) + if( hw->cycles || hw->retired ) { - char buf[32]; - auto end = PrintFloat( buf, buf+32, float( hw->retired ) / hw->cycles, 2 ); - *end = '\0'; - TextFocused( "IPC:", buf ); + ImGui::Separator(); + if( hw->cycles && hw->retired ) + { + char buf[32]; + auto end = PrintFloat( buf, buf+32, float( hw->retired ) / hw->cycles, 2 ); + *end = '\0'; + TextFocused( "IPC:", buf ); + } + if( hw->cycles ) TextFocused( "Cycles:", RealToString( hw->cycles ) ); + if( hw->retired ) TextFocused( "Retirements:", RealToString( hw->retired ) ); } - if( hw->cycles ) TextFocused( "Cycles:", RealToString( hw->cycles ) ); - if( hw->retired ) TextFocused( "Retirements:", RealToString( hw->retired ) ); - if( hw->cacheRef ) + if( hw->cacheRef || hw->cacheMiss ) { - char buf[32]; - auto end = PrintFloat( buf, buf+32, float( 100 * hw->cacheMiss ) / hw->cacheRef, 2 ); - memcpy( end, "%", 2 ); - TextFocused( "Cache miss rate:", buf ); - TextFocused( "Cache references:", RealToString( hw->cacheRef ) ); + ImGui::Separator(); + if( hw->cacheRef ) + { + char buf[32]; + auto end = PrintFloat( buf, buf+32, float( 100 * hw->cacheMiss ) / hw->cacheRef, 2 ); + memcpy( end, "%", 2 ); + TextFocused( "Cache miss rate:", buf ); + TextFocused( "Cache references:", RealToString( hw->cacheRef ) ); + } + if( hw->cacheMiss ) TextFocused( "Cache misses:", RealToString( hw->cacheMiss ) ); } - if( hw->cacheMiss ) TextFocused( "Cache misses:", RealToString( hw->cacheMiss ) ); - if( hw->branchRetired ) + if( hw->branchRetired || hw->branchMiss ) { - char buf[32]; - auto end = PrintFloat( buf, buf+32, float( 100 * hw->branchMiss ) / hw->branchRetired, 2 ); - memcpy( end, "%", 2 ); - TextFocused( "Branch mispredictions rate:", buf ); - TextFocused( "Retired branches:", RealToString( hw->branchRetired ) ); + ImGui::Separator(); + if( hw->branchRetired ) + { + char buf[32]; + auto end = PrintFloat( buf, buf+32, float( 100 * hw->branchMiss ) / hw->branchRetired, 2 ); + memcpy( end, "%", 2 ); + TextFocused( "Branch mispredictions rate:", buf ); + TextFocused( "Retired branches:", RealToString( hw->branchRetired ) ); + } + if( hw->branchMiss ) TextFocused( "Branch mispredictions:", RealToString( hw->branchMiss ) ); } - if( hw->branchMiss ) TextFocused( "Branch mispredictions:", RealToString( hw->branchMiss ) ); } const auto& stats = *worker.GetSymbolStats( symAddrParents ); if( !stats.parents.empty() )