Use TooltipIfHovered() where appropriate.

This commit is contained in:
Bartosz Taudul 2022-01-01 16:57:48 +01:00
parent d5f12744c4
commit c6da04a18b
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 31 additions and 186 deletions

View File

@ -824,12 +824,7 @@ static void DrawContents()
{ {
ImGui::SameLine(); ImGui::SameLine();
tracy::TextColoredUnformatted( 0xFF00FFFF, ICON_FA_EXCLAMATION_TRIANGLE ); tracy::TextColoredUnformatted( 0xFF00FFFF, ICON_FA_EXCLAMATION_TRIANGLE );
if( ImGui::IsItemHovered() ) tracy::TooltipIfHovered( "Filters are active" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Filters are active" );
ImGui::EndTooltip();
}
if( showFilter ) if( showFilter )
{ {
ImGui::SameLine(); ImGui::SameLine();

View File

@ -1052,12 +1052,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
{ {
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 );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Context is limited to an inline function" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Context is limited to an inline function" );
ImGui::EndTooltip();
}
} }
if( SmallCheckbox( ICON_FA_SITEMAP " Function:", &m_calcInlineStats ) ) if( SmallCheckbox( ICON_FA_SITEMAP " Function:", &m_calcInlineStats ) )
{ {
@ -1325,21 +1320,11 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
{ {
ImGui::PopStyleVar(); ImGui::PopStyleVar();
ImGui::PopItemFlag(); ImGui::PopItemFlag();
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Please wait, processing data..." );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Please wait, processing data..." );
ImGui::EndTooltip();
}
} }
else else
{ {
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Press Z key to temporarily reverse selection." );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Press Z key to temporarily reverse selection." );
ImGui::EndTooltip();
}
} }
ImGui::SameLine(); ImGui::SameLine();
if( ImGui::SmallButton( m_childCallList ? " " ICON_FA_CARET_UP " " : " " ICON_FA_CARET_DOWN " " ) ) m_childCallList = !m_childCallList; if( ImGui::SmallButton( m_childCallList ? " " ICON_FA_CARET_UP " " : " " ICON_FA_CARET_DOWN " " ) ) m_childCallList = !m_childCallList;
@ -1358,12 +1343,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
{ {
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextDisabled( "(%c%s)", m_childCalls ? '-' : '+', TimeToString( as.ipTotalAsm.ext * worker.GetSamplingPeriod() ) ); ImGui::TextDisabled( "(%c%s)", m_childCalls ? '-' : '+', TimeToString( as.ipTotalAsm.ext * worker.GetSamplingPeriod() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Child call samples" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Child call samples" );
ImGui::EndTooltip();
}
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::Spacing(); ImGui::Spacing();
@ -1380,12 +1360,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
{ {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text( "(%c%s)", m_childCalls ? '-' : '+', RealToString( as.ipTotalAsm.ext ) ); ImGui::Text( "(%c%s)", m_childCalls ? '-' : '+', RealToString( as.ipTotalAsm.ext ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Child call samples" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Child call samples" );
ImGui::EndTooltip();
}
} }
} }
else else
@ -1405,12 +1380,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
ImGui::Checkbox( "Limit range", &val ); ImGui::Checkbox( "Limit range", &val );
ImGui::PopItemFlag(); ImGui::PopItemFlag();
ImGui::PopStyleVar(); ImGui::PopStyleVar();
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Please wait, processing data..." );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Please wait, processing data..." );
ImGui::EndTooltip();
}
} }
else else
{ {
@ -1716,12 +1686,7 @@ void SourceView::RenderSymbolSourceView( const AddrStatData& as, Worker& worker,
if( m_source.is_cached() ) if( m_source.is_cached() )
{ {
TextColoredUnformatted( ImVec4( 0.4f, 0.8f, 0.4f, 1.f ), ICON_FA_DATABASE ); TextColoredUnformatted( ImVec4( 0.4f, 0.8f, 0.4f, 1.f ), ICON_FA_DATABASE );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Source file cached during profiling run" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Source file cached during profiling run" );
ImGui::EndTooltip();
}
} }
else else
{ {
@ -2243,12 +2208,7 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
if( m_selMicroArch == m_profileMicroArch ) if( m_selMicroArch == m_profileMicroArch )
{ {
TextColoredUnformatted( ImVec4( 0.4f, 0.8f, 0.4f, 1.f ), ICON_FA_MICROCHIP ); TextColoredUnformatted( ImVec4( 0.4f, 0.8f, 0.4f, 1.f ), ICON_FA_MICROCHIP );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Selected microarchitecture is the same as the profiled application was running on" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Selected microarchitecture is the same as the profiled application was running on" );
ImGui::EndTooltip();
}
} }
else else
{ {

View File

@ -1026,12 +1026,7 @@ bool View::DrawImpl()
auto cx = ImGui::GetCursorPosX(); auto cx = ImGui::GetCursorPosX();
ImGui::Text( ICON_FA_EYE " %s", TimeToString( m_vd.zvEnd - m_vd.zvStart ) ); ImGui::Text( ICON_FA_EYE " %s", TimeToString( m_vd.zvEnd - m_vd.zvStart ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "View span" );
{
ImGui::BeginTooltip();
ImGui::Text( "View span" );
ImGui::EndTooltip();
}
ImGui::SameLine(); ImGui::SameLine();
auto dx = ImGui::GetCursorPosX() - cx; auto dx = ImGui::GetCursorPosX() - cx;
if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize ); if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize );
@ -1054,12 +1049,7 @@ bool View::DrawImpl()
cx = ImGui::GetCursorPosX(); cx = ImGui::GetCursorPosX();
ImGui::Text( ICON_FA_MEMORY " %s", MemSizeToString( memUsage ) ); ImGui::Text( ICON_FA_MEMORY " %s", MemSizeToString( memUsage ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Profiler memory usage" );
{
ImGui::BeginTooltip();
ImGui::Text( "Profiler memory usage" );
ImGui::EndTooltip();
}
if( m_totalMemory != 0 ) if( m_totalMemory != 0 )
{ {
ImGui::SameLine(); ImGui::SameLine();
@ -1382,12 +1372,7 @@ void View::DrawNotificationArea()
{ {
ImGui::SameLine(); ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1, 0.5, 0, 1 ), ICON_FA_EYE_DROPPER ); TextColoredUnformatted( ImVec4( 1, 0.5, 0, 1 ), ICON_FA_EYE_DROPPER );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Sampling data and ghost zones may be displayed wrongly due to data inconsistency. Save and reload the trace to fix this." );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Sampling data and ghost zones may be displayed wrongly due to data inconsistency. Save and reload the trace to fix this." );
ImGui::EndTooltip();
}
} }
if( m_vd.drawEmptyLabels ) if( m_vd.drawEmptyLabels )
{ {
@ -2487,12 +2472,7 @@ void View::DrawZoneFramesHeader()
const auto step = pow( 10, scale ); const auto step = pow( 10, scale );
ImGui::InvisibleButton( "##zoneFrames", ImVec2( w, ty * 1.5f ) ); ImGui::InvisibleButton( "##zoneFrames", ImVec2( w, ty * 1.5f ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( TimeToStringExact( m_vd.zvStart + ( ImGui::GetIO().MousePos.x - wpos.x ) * nspx ) );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( TimeToStringExact( m_vd.zvStart + ( ImGui::GetIO().MousePos.x - wpos.x ) * nspx ) );
ImGui::EndTooltip();
}
const auto dx = step * pxns; const auto dx = step * pxns;
double x = 0; double x = 0;
@ -7700,12 +7680,7 @@ void View::DrawZoneInfoWindow()
ImGui::TextUnformatted( DecodeContextSwitchReasonCode( reason ) ); ImGui::TextUnformatted( DecodeContextSwitchReasonCode( reason ) );
desc = DecodeContextSwitchReason( reason ); desc = DecodeContextSwitchReason( reason );
} }
if( *desc && ImGui::IsItemHovered() ) if( *desc ) TooltipIfHovered( desc );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( desc );
ImGui::EndTooltip();
}
} }
ImGui::PopID(); ImGui::PopID();
} }
@ -9032,12 +9007,7 @@ void View::DrawOptions()
const auto expand = ImGui::TreeNode( "Locks" ); const auto expand = ImGui::TreeNode( "Locks" );
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextDisabled( "(%zu)", lockCnt ); ImGui::TextDisabled( "(%zu)", lockCnt );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Locks with no recorded events are counted, but not listed." );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Locks with no recorded events are counted, but not listed." );
ImGui::EndTooltip();
}
if( expand ) if( expand )
{ {
ImGui::SameLine(); ImGui::SameLine();
@ -10554,12 +10524,7 @@ void View::DrawFindZone()
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();
TextFocused( "\xcf\x83:", TimeToString( sd ) ); TextFocused( "\xcf\x83:", TimeToString( sd ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Standard deviation" );
{
ImGui::BeginTooltip();
ImGui::Text( "Standard deviation" );
ImGui::EndTooltip();
}
} }
TextDisabledUnformatted( "Selection range:" ); TextDisabledUnformatted( "Selection range:" );
@ -12433,12 +12398,7 @@ void View::DrawCompare()
TextColoredUnformatted( ImVec4( 0xDD/511.f, 0xDD/511.f, 0x22/511.f, 1.f ), ICON_FA_LEMON ); TextColoredUnformatted( ImVec4( 0xDD/511.f, 0xDD/511.f, 0x22/511.f, 1.f ), ICON_FA_LEMON );
ImGui::SameLine(); ImGui::SameLine();
TextFocused( "\xcf\x83 (this):", TimeToString( sd ) ); TextFocused( "\xcf\x83 (this):", TimeToString( sd ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Standard deviation" );
{
ImGui::BeginTooltip();
ImGui::Text( "Standard deviation" );
ImGui::EndTooltip();
}
} }
@ -12464,12 +12424,7 @@ void View::DrawCompare()
TextColoredUnformatted( ImVec4( 0xDD/511.f, 0x22/511.f, 0x22/511.f, 1.f ), ICON_FA_GEM ); TextColoredUnformatted( ImVec4( 0xDD/511.f, 0x22/511.f, 0x22/511.f, 1.f ), ICON_FA_GEM );
ImGui::SameLine(); ImGui::SameLine();
TextFocused( "\xcf\x83 (ext.):", TimeToString( sd ) ); TextFocused( "\xcf\x83 (ext.):", TimeToString( sd ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Standard deviation" );
{
ImGui::BeginTooltip();
ImGui::Text( "Standard deviation" );
ImGui::EndTooltip();
}
} }
ImGui::PushStyleColor( ImGuiCol_Text, ImVec4( 0xDD/511.f, 0xDD/511.f, 0x22/511.f, 1.f ) ); ImGui::PushStyleColor( ImGuiCol_Text, ImVec4( 0xDD/511.f, 0xDD/511.f, 0x22/511.f, 1.f ) );
@ -13080,12 +13035,7 @@ void View::DrawStatistics()
ImGui::Checkbox( "Limit range", &val ); ImGui::Checkbox( "Limit range", &val );
ImGui::PopItemFlag(); ImGui::PopItemFlag();
ImGui::PopStyleVar(); ImGui::PopStyleVar();
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Waiting for background tasks to finish" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Waiting for background tasks to finish" );
ImGui::EndTooltip();
}
} }
else else
{ {
@ -14447,12 +14397,7 @@ void View::DrawInfo()
{ {
ImGui::SetClipboardText( save ); ImGui::SetClipboardText( save );
} }
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Copy user settings location to clipboard." );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Copy user settings location to clipboard." );
ImGui::EndTooltip();
}
} }
} }
} }
@ -14486,29 +14431,14 @@ void View::DrawInfo()
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();
TextFocused( "Extra data:", RealToString( m_worker.GetZoneExtraCount() ) ); TextFocused( "Extra data:", RealToString( m_worker.GetZoneExtraCount() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Count of zones containing any of the following: call stack trace, custom name, user text" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Count of zones containing any of the following: call stack trace, custom name, user text" );
ImGui::EndTooltip();
}
TextFocused( "GPU zones:", RealToString( m_worker.GetGpuZoneCount() ) ); TextFocused( "GPU zones:", RealToString( m_worker.GetGpuZoneCount() ) );
TextFocused( "Lock events:", RealToString( m_worker.GetLockCount() ) ); TextFocused( "Lock events:", RealToString( m_worker.GetLockCount() ) );
TextFocused( "Plot data points:", RealToString( m_worker.GetPlotCount() ) ); TextFocused( "Plot data points:", RealToString( m_worker.GetPlotCount() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "User plots" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "User plots" );
ImGui::EndTooltip();
}
ImGui::SameLine(); ImGui::SameLine();
TextFocused( "+", RealToString( m_worker.GetTracyPlotCount() ) ); TextFocused( "+", RealToString( m_worker.GetTracyPlotCount() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Automated Tracy plots" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Automated Tracy plots" );
ImGui::EndTooltip();
}
auto& memNameMap = m_worker.GetMemNameMap(); auto& memNameMap = m_worker.GetMemNameMap();
TextFocused( "Memory pools:", RealToString( memNameMap.size() ) ); TextFocused( "Memory pools:", RealToString( memNameMap.size() ) );
uint64_t memTotalCnt = 0; uint64_t memTotalCnt = 0;
@ -14518,36 +14448,21 @@ void View::DrawInfo()
TextFocused( "Strings:", RealToString( m_worker.GetStringsCount() ) ); TextFocused( "Strings:", RealToString( m_worker.GetStringsCount() ) );
TextFocused( "Symbols:", RealToString( m_worker.GetSymbolsCount() ) ); TextFocused( "Symbols:", RealToString( m_worker.GetSymbolsCount() ) );
TextFocused( "Symbol code fragments:", RealToString( m_worker.GetSymbolCodeCount() ) ); TextFocused( "Symbol code fragments:", RealToString( m_worker.GetSymbolCodeCount() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( MemSizeToString( m_worker.GetSymbolCodeSize() ) );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( MemSizeToString( m_worker.GetSymbolCodeSize() ) );
ImGui::EndTooltip();
}
TextFocused( "Code locations:", RealToString( m_worker.GetCodeLocationsSize() ) ); TextFocused( "Code locations:", RealToString( m_worker.GetCodeLocationsSize() ) );
TextFocused( "Call stacks:", RealToString( m_worker.GetCallstackPayloadCount() ) ); TextFocused( "Call stacks:", RealToString( m_worker.GetCallstackPayloadCount() ) );
if( m_worker.AreCallstackSamplesReady() ) if( m_worker.AreCallstackSamplesReady() )
{ {
ImGui::SameLine(); ImGui::SameLine();
TextFocused( "+", RealToString( m_worker.GetCallstackParentPayloadCount() ) ); TextFocused( "+", RealToString( m_worker.GetCallstackParentPayloadCount() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Parent call stacks for stack samples" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Parent call stacks for stack samples" );
ImGui::EndTooltip();
}
} }
TextFocused( "Call stack frames:", RealToString( m_worker.GetCallstackFrameCount() ) ); TextFocused( "Call stack frames:", RealToString( m_worker.GetCallstackFrameCount() ) );
if( m_worker.AreCallstackSamplesReady() ) if( m_worker.AreCallstackSamplesReady() )
{ {
ImGui::SameLine(); ImGui::SameLine();
TextFocused( "+", RealToString( m_worker.GetCallstackParentFrameCount() ) ); TextFocused( "+", RealToString( m_worker.GetCallstackParentFrameCount() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Parent call stack frames for stack samples" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Parent call stack frames for stack samples" );
ImGui::EndTooltip();
}
} }
TextFocused( "Call stack samples:", RealToString( m_worker.GetCallstackSampleCount() ) ); TextFocused( "Call stack samples:", RealToString( m_worker.GetCallstackSampleCount() ) );
TextFocused( "Ghost zones:", RealToString( m_worker.GetGhostZonesCount() ) ); TextFocused( "Ghost zones:", RealToString( m_worker.GetGhostZonesCount() ) );
@ -14582,20 +14497,10 @@ void View::DrawInfo()
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
TextFocused( "Context switch regions:", RealToString( m_worker.GetContextSwitchCount() ) ); TextFocused( "Context switch regions:", RealToString( m_worker.GetContextSwitchCount() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Detailed context switch data regarding application threads" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Detailed context switch data regarding application threads" );
ImGui::EndTooltip();
}
ImGui::SameLine(); ImGui::SameLine();
TextFocused( "+", RealToString( m_worker.GetContextSwitchPerCpuCount() ) ); TextFocused( "+", RealToString( m_worker.GetContextSwitchPerCpuCount() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( "Coarse CPU core context switch data" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Coarse CPU core context switch data" );
ImGui::EndTooltip();
}
if( m_worker.GetSourceFileCacheCount() == 0 ) if( m_worker.GetSourceFileCacheCount() == 0 )
{ {
TextFocused( "Source file cache:", "0" ); TextFocused( "Source file cache:", "0" );
@ -14607,12 +14512,7 @@ void View::DrawInfo()
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextUnformatted( RealToString( m_worker.GetSourceFileCacheCount() ) ); ImGui::TextUnformatted( RealToString( m_worker.GetSourceFileCacheCount() ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( MemSizeToString( m_worker.GetSourceFileCacheSize() ) );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( MemSizeToString( m_worker.GetSourceFileCacheSize() ) );
ImGui::EndTooltip();
}
if( expand ) if( expand )
{ {
auto& cache = m_worker.GetSourceFileCache(); auto& cache = m_worker.GetSourceFileCache();
@ -15693,12 +15593,7 @@ void View::DrawPlayback()
ImGui::SameLine(); ImGui::SameLine();
ImGui::Checkbox( "Zoom 2\xc3\x97", &m_playback.zoom ); ImGui::Checkbox( "Zoom 2\xc3\x97", &m_playback.zoom );
TextFocused( "Timestamp:", TimeToString( tstart ) ); TextFocused( "Timestamp:", TimeToString( tstart ) );
if( ImGui::IsItemHovered() ) TooltipIfHovered( TimeToStringExact( tstart ) );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( TimeToStringExact( tstart ) );
ImGui::EndTooltip();
}
ImGui::SameLine(); ImGui::SameLine();
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();
@ -16106,12 +16001,7 @@ void View::DrawAnnotationList()
{ {
remove = idx; remove = idx;
} }
if( !ctrl && ImGui::IsItemHovered() ) if( !ctrl ) TooltipIfHovered( "Press ctrl key to enable removal" );
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Press ctrl key to enable removal" );
ImGui::EndTooltip();
}
ImGui::SameLine(); ImGui::SameLine();
ImGui::ColorButton( "c", ImGui::ColorConvertU32ToFloat4( ann->color ), ImGuiColorEditFlags_NoTooltip ); ImGui::ColorButton( "c", ImGui::ColorConvertU32ToFloat4( ann->color ), ImGuiColorEditFlags_NoTooltip );
ImGui::SameLine(); ImGui::SameLine();