Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjacob <benoitjacob@google.com>2022-04-21 19:30:55 +0300
committerGitHub <noreply@github.com>2022-04-21 19:30:55 +0300
commite6a29862ec6b11fbe427183da54ead7c9fe2d6c8 (patch)
treef321653c3271e1df1c829875effd4763ff0adeb6
parent3d10a7dfed40516a3cbfe8fc59e56647f644929c (diff)
Fix column widths for hw counts and source location (#369)
Fix column widths for hw counts and source location
-rw-r--r--server/TracySourceView.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp
index 483979d2..7a4d8bc3 100644
--- a/server/TracySourceView.cpp
+++ b/server/TracySourceView.cpp
@@ -3069,6 +3069,7 @@ void SourceView::RenderLine( const Tokenizer::Line& line, int lineNum, const Add
const bool showHwSamples = worker && m_hwSamples && worker->GetHwSampleCountAddress() != 0;
if( showHwSamples )
{
+ const auto startPos = ImGui::GetCursorScreenPos();
if( hasHwData )
{
if( m_hwSamplesRelative )
@@ -3088,10 +3089,11 @@ void SourceView::RenderLine( const Tokenizer::Line& line, int lineNum, const Add
RenderHwLinePart( cycles, retired, branchRetired, branchMiss, cacheRef, cacheMiss, 0, 0, 0, 0, ts );
}
}
- else
- {
- ImGui::ItemSize( ImVec2( 17 * ts.x, ts.y ) );
- }
+ ImGui::SameLine( 0, 0 );
+ const auto endPos = ImGui::GetCursorScreenPos();
+ const auto itemsWidth = ( endPos - startPos ).x;
+ const auto fixedWidth = 17 * ts.x;
+ ImGui::ItemSize( ImVec2( fixedWidth - itemsWidth, 0 ) );
ImGui::SameLine( 0, ty );
}
@@ -3380,6 +3382,7 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
const bool showHwSamples = m_hwSamples && worker.GetHwSampleCountAddress() != 0;
if( showHwSamples )
{
+ const auto startPos = ImGui::GetCursorScreenPos();
if( hw )
{
if( m_hwSamplesRelative )
@@ -3399,10 +3402,11 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
RenderHwLinePart( cycles, retired, branchRetired, branchMiss, cacheRef, cacheMiss, 0, 0, 0, 0, ts );
}
}
- else
- {
- ImGui::ItemSize( ImVec2( 17 * ts.x, ts.y ) );
- }
+ ImGui::SameLine( 0, 0 );
+ const auto endPos = ImGui::GetCursorScreenPos();
+ const auto itemsWidth = ( endPos - startPos ).x;
+ const auto fixedWidth = 17 * ts.x;
+ ImGui::ItemSize( ImVec2( fixedWidth - itemsWidth, 0 ) );
ImGui::SameLine( 0, ty );
}
@@ -3473,6 +3477,7 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
if( m_asmShowSourceLocation && !m_sourceFiles.empty() )
{
ImGui::SameLine();
+ ImVec2 startPos;
uint32_t srcline;
const auto srcidx = worker.GetLocationForAddress( line.addr, srcline );
if( srcline != 0 )
@@ -3481,6 +3486,7 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
const auto fileColor = GetHsvColor( srcidx.Idx(), 0 );
SmallColorBox( fileColor );
ImGui::SameLine();
+ startPos = ImGui::GetCursorScreenPos();
char buf[64];
const auto fnsz = strlen( fileName );
if( fnsz < 30 - m_maxLine )
@@ -3553,17 +3559,20 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
m_hoveredSource = srcidx.Idx();
}
}
- ImGui::SameLine( 0, 0 );
- ImGui::ItemSize( ImVec2( stw * ( 32 - bufsz ), ty ), 0 );
}
else
{
SmallColorBox( 0 );
ImGui::SameLine();
+ startPos = ImGui::GetCursorScreenPos();
TextDisabledUnformatted( "[unknown]" );
- ImGui::SameLine( 0, 0 );
- ImGui::ItemSize( ImVec2( stw * 23, ty ), 0 );
}
+ ImGui::SameLine( 0, 0 );
+ const auto endPos = ImGui::GetCursorScreenPos();
+ const auto itemsWidth = ( endPos - startPos ).x;
+ const auto fixedWidth = 32 * ts.x;
+ ImGui::ItemSize( ImVec2( fixedWidth - itemsWidth, 0 ) );
+
}
if( m_asmBytes )
{