1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Draw thread context switches using precalculated data.

This commit is contained in:
Bartosz Taudul
2023-03-22 19:38:58 +01:00
parent 88f0b9c754
commit 50ccdc1ef4
4 changed files with 97 additions and 130 deletions
+3 -7
View File
@@ -23,7 +23,7 @@ static tracy_force_inline uint32_t MixGhostColor( uint32_t c0, uint32_t c1 )
( ( ( ( ( c0 & 0x000000FF ) ) + 3 * ( ( c1 & 0x000000FF ) ) ) >> 2 ) );
}
bool View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, const std::vector<TimelineDraw>& draw, int& offset, int depth )
bool View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, const std::vector<TimelineDraw>& draw, const std::vector<ContextSwitchDraw>& ctxDraw, int& offset, int depth )
{
const auto& wpos = ctx.wpos;
const auto ty = ctx.ty;
@@ -41,7 +41,7 @@ bool View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, con
const auto sampleOffset = offset;
const auto hasSamples = m_vd.drawSamples && !thread.samples.empty();
const auto hasCtxSwitch = m_vd.drawContextSwitches && m_worker.GetContextSwitchData( thread.id );
const auto hasCtxSwitch = m_vd.drawContextSwitches && !ctxDraw.empty();
if( hasSamples )
{
@@ -70,11 +70,7 @@ bool View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, con
if( hasCtxSwitch )
{
auto ctxSwitch = m_worker.GetContextSwitchData( thread.id );
if( ctxSwitch )
{
DrawContextSwitches( ctxSwitch, thread.samples, hover, pxns, int64_t( nspx ), wpos, ctxOffset, offset, thread.isFiber );
}
DrawContextSwitchList( ctx, ctxDraw, ctxOffset, offset, thread.isFiber );
}
if( hasSamples )
{