Add notification when source file is loaded from cache.

This commit is contained in:
Bartosz Taudul 2020-05-23 15:27:00 +02:00
parent dc0f2db3f2
commit 5b96809f6f

View File

@ -864,11 +864,20 @@ void SourceView::Render( const Worker& worker, View& view )
if( m_symAddr == 0 ) if( m_symAddr == 0 )
{ {
if( m_file ) TextFocused( ICON_FA_FILE " File:", m_file ); if( m_file ) TextFocused( ICON_FA_FILE " File:", m_file );
if( m_data == m_dataBuf )
{
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE ); TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
ImGui::SameLine(); ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1.f, 0.3f, 0.3f, 1.f ), "The source file contents might not reflect the actual profiled code!" ); TextColoredUnformatted( ImVec4( 1.f, 0.3f, 0.3f, 1.f ), "The source file contents might not reflect the actual profiled code!" );
ImGui::SameLine(); ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE ); TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
}
else
{
TextColoredUnformatted( ImVec4( 0.4f, 0.8f, 0.4f, 1.f ), ICON_FA_DATABASE );
ImGui::SameLine();
ImGui::TextUnformatted( "Source file cached during profiling run" );
}
RenderSimpleSourceView(); RenderSimpleSourceView();
} }
@ -1186,6 +1195,8 @@ static uint32_t GetHotnessColor( uint32_t ipSum, uint32_t maxIpCount )
void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<uint64_t, uint32_t> ipcount, unordered_flat_map<uint64_t, uint32_t> ipcountAsm, uint32_t ipmax, const Worker& worker, const View& view ) void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<uint64_t, uint32_t> ipcount, unordered_flat_map<uint64_t, uint32_t> ipcountAsm, uint32_t ipmax, const Worker& worker, const View& view )
{ {
if( m_sourceFiles.empty() ) if( m_sourceFiles.empty() )
{
if( m_data == m_dataBuf )
{ {
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE ); TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
ImGui::SameLine(); ImGui::SameLine();
@ -1194,6 +1205,15 @@ void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<ui
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE ); TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
} }
else else
{
TextColoredUnformatted( ImVec4( 0.4f, 0.8f, 0.4f, 1.f ), ICON_FA_DATABASE );
ImGui::SameLine();
ImGui::TextUnformatted( "Source file cached during profiling run" );
}
}
else
{
if( m_data == m_dataBuf )
{ {
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE ); TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
@ -1206,6 +1226,17 @@ void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<ui
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE ); TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
}
else
{
TextColoredUnformatted( ImVec4( 0.4f, 0.8f, 0.4f, 1.f ), ICON_FA_DATABASE );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Source file cached during profiling run" );
ImGui::EndTooltip();
}
}
ImGui::SameLine(); ImGui::SameLine();
TextDisabledUnformatted( ICON_FA_FILE " File:" ); TextDisabledUnformatted( ICON_FA_FILE " File:" );
ImGui::SameLine(); ImGui::SameLine();