Fix printing percentage.

This commit is contained in:
Bartosz Taudul 2021-05-20 02:53:49 +02:00
parent bcb7b94272
commit df50eb890f
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -2638,17 +2638,19 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
if( hw->retired ) TextFocused( "Retirements:", RealToString( hw->retired ) ); if( hw->retired ) TextFocused( "Retirements:", RealToString( hw->retired ) );
if( hw->cacheRef ) if( hw->cacheRef )
{ {
TextDisabledUnformatted( "Cache miss rate:" ); char buf[32];
ImGui::SameLine(); auto end = PrintFloat( buf, buf+32, float( 100 * hw->cacheMiss ) / hw->cacheRef, 2 );
PrintPercentage( float( 100 * hw->cacheMiss ) / hw->cacheRef ); memcpy( end, "%", 2 );
TextFocused( "Cache miss rate:", buf );
TextFocused( "Cache references:", RealToString( hw->cacheRef ) ); 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 )
{ {
TextDisabledUnformatted( "Branch mispredictions rate:" ); char buf[32];
ImGui::SameLine(); auto end = PrintFloat( buf, buf+32, float( 100 * hw->branchMiss ) / hw->branchRetired, 2 );
PrintPercentage( float( 100 * hw->branchMiss ) / hw->branchRetired ); memcpy( end, "%", 2 );
TextFocused( "Branch mispredictions rate:", buf );
TextFocused( "Retired branches:", RealToString( hw->branchRetired ) ); TextFocused( "Retired branches:", RealToString( hw->branchRetired ) );
} }
if( hw->branchMiss ) TextFocused( "Branch mispredictions:", RealToString( hw->branchMiss ) ); if( hw->branchMiss ) TextFocused( "Branch mispredictions:", RealToString( hw->branchMiss ) );