Fix formating issues

This commit is contained in:
Clément Grégoire
2025-04-08 13:48:50 +02:00
parent df76b376a7
commit 6486d8147d
7 changed files with 37 additions and 36 deletions

View File

@@ -144,7 +144,7 @@ int64_t TimelineItemThread::RangeEnd() const
void TimelineItemThread::HeaderTooltip( const char* label ) const
{
m_view.HighlightThread(m_thread->id, false);
m_view.HighlightThread( m_thread->id, false );
ImGui::BeginTooltip();
SmallColorBox( GetThreadColor( m_thread->id, 0, m_view.GetViewData().dynamicColors ) );
@@ -277,9 +277,9 @@ void TimelineItemThread::DrawOverlay( const ImVec2& ul, const ImVec2& dr )
void TimelineItemThread::DrawExtraPopupItems()
{
if (ImGui::MenuItem(ICON_FA_TIMELINE " Select in CPU timeline"))
if( ImGui::MenuItem( ICON_FA_TIMELINE " Select in CPU timeline" ) )
{
m_view.HighlightThread(m_thread->id, true);
m_view.HighlightThread( m_thread->id, true );
}
}

View File

@@ -266,7 +266,7 @@ void View::DrawContextSwitchList( const TimelineContext& ctx, const std::vector<
{
ZoomToRange( prev.End(), ev.WakeupVal() );
}
TextFocused("Readied by CPU:", RealToString(ev.WakeupCpu()));
TextFocused( "Readied by CPU:", RealToString( ev.WakeupCpu() ) );
tooltip = true;
}
if( tooltip )

View File

@@ -40,7 +40,7 @@ bool View::DrawCpuData( const TimelineContext& ctx, const std::vector<CpuUsageDr
const auto cpuUsageHeight = floor( 30.f * GetScale() );
if( wpos.y + offset + cpuUsageHeight + 3 >= yMin && wpos.y + offset <= yMax )
{
if (IsMouseClickReleased(ImGuiMouseButton_Left))
if( IsMouseClickReleased( ImGuiMouseButton_Left ) )
{
m_freezeCpuDataSelectedThread = false;
}
@@ -293,11 +293,11 @@ bool View::DrawCpuData( const TimelineContext& ctx, const std::vector<CpuUsageDr
TextFocused( "Thread:", m_worker.GetThreadName( thread ) );
ImGui::SameLine();
ImGui::TextDisabled( "(%s)", RealToString( thread ) );
if (!m_freezeCpuDataSelectedThread)
if ( !m_freezeCpuDataSelectedThread )
{
m_drawThreadMigrations = thread;
m_cpuDataThread = thread;
if (IsMouseClickReleased(ImGuiMouseButton_Left))
if( IsMouseClickReleased( ImGuiMouseButton_Left ) )
{
m_freezeCpuDataSelectedThread = true;
}
@@ -408,10 +408,11 @@ bool View::DrawCpuData( const TimelineContext& ctx, const std::vector<CpuUsageDr
const auto lnSize = GetScale() * 2.f;
auto computeScreenPos = [&](uint64_t t, uint8_t cpu) {
const auto px = (t - m_vd.zvStart) * pxns;
return dpos + ImVec2(px, origOffset + sty * 0.5f + cpu * sstep);
};
auto computeScreenPos = [&]( uint64_t t, uint8_t cpu ) {
const auto px = ( t - m_vd.zvStart ) * pxns;
return dpos + ImVec2( px, origOffset + sty * 0.5f + cpu * sstep );
};
while( it < end )
{
const auto t0 = it->End();
@@ -425,32 +426,32 @@ bool View::DrawCpuData( const TimelineContext& ctx, const std::vector<CpuUsageDr
const auto t1 = it->Start();
const auto cpu1 = it->Cpu();
const auto p0 = computeScreenPos(t0, cpu0);
const auto p1 = computeScreenPos(t1, cpu1);
const auto p0 = computeScreenPos( t0, cpu0 );
const auto p1 = computeScreenPos( t1, cpu1 );
if (p1.x - p0.x < 2)
if( p1.x - p0.x < 2 )
{
DrawLine(draw, p0, p1, color);
DrawLine( draw, p0, p1, color );
}
else
{
DrawLine(draw, p0, p1, 0xFF000000, bgSize);
DrawLine(draw, p0, p1, color, lnSize);
DrawLine( draw, p0, p1, 0xFF000000, bgSize );
DrawLine( draw, p0, p1, color, lnSize );
}
if (t1 != it->WakeupVal())
if( t1 != it->WakeupVal() )
{
const auto wakeup = it->WakeupVal();
const auto wakeupcpu = it->WakeupCpu();
const auto pw = computeScreenPos(wakeup, wakeupcpu);
const auto pw = computeScreenPos( wakeup, wakeupcpu );
const auto hue = 0.38f * float(waitReason); // Golden angle
const auto wakecolor = ImColor::HSV(hue, 1.f, 1.f);
const auto hue = 0.38f * float( waitReason ); // Golden angle
const auto wakecolor = ImColor::HSV( hue, 1.f, 1.f );
DrawLine(draw, pw, p1, wakecolor);
draw->AddCircleFilled(pw, bgSize, wakecolor);
DrawLine(draw, ImVec2{ p1.x ,p1.y - sty * 0.75f }, ImVec2{ p1.x , p1.y + sty * 0.75f }, 0xFF000000, bgSize);
DrawLine(draw, ImVec2{ p1.x ,p1.y - sty * 0.75f }, ImVec2{ p1.x , p1.y + sty * 0.75f }, wakecolor);
DrawLine( draw, pw, p1, wakecolor );
draw->AddCircleFilled( pw, bgSize, wakecolor );
DrawLine( draw, ImVec2{ p1.x ,p1.y - sty * 0.75f }, ImVec2{ p1.x , p1.y + sty * 0.75f }, 0xFF000000, bgSize );
DrawLine( draw, ImVec2{ p1.x ,p1.y - sty * 0.75f }, ImVec2{ p1.x , p1.y + sty * 0.75f }, wakecolor );
}
}
}

View File

@@ -242,11 +242,11 @@ void View::DrawTimeline()
m_msgHighlight.Decay( nullptr );
m_zoneSrcLocHighlight.Decay( 0 );
m_lockHoverHighlight.Decay( InvalidId );
if (!m_freezeCpuDataSelectedThread)
if ( !m_freezeCpuDataSelectedThread )
{
m_drawThreadMigrations.Decay(0);
m_drawThreadHighlight.Decay(0);
m_cpuDataThread.Decay(0);
m_drawThreadMigrations.Decay( 0 );
m_drawThreadHighlight.Decay( 0 );
m_cpuDataThread.Decay( 0 );
}
m_zoneHover = nullptr;
m_zoneHover2.Decay( nullptr );

View File

@@ -1500,8 +1500,8 @@ void SysTraceWorker( void* ptr )
TracyLfqPrepare( QueueType::ThreadWakeup );
MemWrite( &item->threadWakeup.time, t0 );
MemWrite( &item->threadWakeup.thread, pid );
decltype(item->threadWakeup.cpu) cpu = target_cpu;
MemWrite( &item->threadWakeup.cpu, target_cpu);
uint8_t cpu = target_cpu;
MemWrite( &item->threadWakeup.cpu, target_cpu );
int8_t adjustReason = -1; // Does not exist on Linux
int8_t adjustIncrement = 0; // Should perhaps store the new prio?

View File

@@ -606,8 +606,8 @@ struct ContextSwitchData
tracy_force_inline uint16_t Thread() const { return _thread; }
tracy_force_inline void SetThread( uint16_t thread ) { _thread = thread; }
tracy_force_inline void SetStartCpu(int64_t start, uint8_t cpu) { assert(start < (int64_t)(1ull << 47)); _start.SetVal(start); _cpu = cpu; }
tracy_force_inline void SetEndReasonState(int64_t end, int8_t reason, int8_t state) { assert(end < (int64_t)(1ull << 47)); _end = end; _reason = reason; _state = state; }
tracy_force_inline void SetStartCpu( int64_t start, uint8_t cpu ) { assert( start < (int64_t)( 1ull << 47 ) ); _start.SetVal( start ); _cpu = cpu; }
tracy_force_inline void SetEndReasonState( int64_t end, int8_t reason, int8_t state ) { assert( end < (int64_t)( 1ull << 47 ) ); _end = end; _reason = reason; _state = state; }
Int48 _start;
uint8_t _cpu;

View File

@@ -1441,7 +1441,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks, bool allow
uint8_t cpu, wakeupcpu;
int8_t reason, state;
f.Read7( deltaWakeup, deltaStart, diff, cpu, reason, state, thread );
if (fileVer >= FileVersion(0, 12, 0))
if ( fileVer >= FileVersion( 0, 12, 0 ) )
{
f.Read(wakeupcpu);
}
@@ -6785,7 +6785,7 @@ void Worker::ProcessContextSwitch( const QueueContextSwitch& ev )
// We should handle this properly in some way, but it is unclear how. We can't even really detect it properly other than when cpu doesn't match.
assert( item.Cpu() == ev.cpu );
item.SetEnd( time );
item.SetReason( ev.oldThreadWaitReason);
item.SetReason( ev.oldThreadWaitReason );
item.SetState( ev.oldThreadState );
const auto dt = time - item.Start();
@@ -6892,7 +6892,7 @@ void Worker::ProcessThreadWakeup( const QueueThreadWakeup& ev )
it = m_data.ctxSwitch.emplace( ev.thread, ctx ).first;
}
auto& data = it->second->v;
if (!data.empty() && !data.back().IsEndValid())
if( !data.empty() && !data.back().IsEndValid() )
{
// We received the wakeup before thread switches out. This can actually happen!
// So instead of dropping the information, keep the last one around so that we