Use proper thread id for wait stacks.

ContextSwitchData::Thread() is something related to fibers. Pass and use
known thread id from external context instead.
This commit is contained in:
Bartosz Taudul
2026-06-17 00:21:51 +02:00
parent 2e252d3988
commit 073cd266ac
3 changed files with 4 additions and 4 deletions

View File

@@ -293,7 +293,7 @@ private:
void DrawSampleList( const TimelineContext& ctx, const std::vector<SamplesDraw>& drawList, const Vector<SampleData>& vec, int offset, uint64_t tid );
void DrawZoneList( const TimelineContext& ctx, const std::vector<TimelineDraw>& drawList, int offset, uint64_t tid, int maxDepth, double margin );
void DrawThreadCropper( const int depth, const uint64_t tid, const float xPos, const float yPos, const float ostep, const float cropperWidth, const bool hasCtxSwitches );
void DrawContextSwitchList( const TimelineContext& ctx, const std::vector<ContextSwitchDraw>& drawList, const Vector<ContextSwitchData>& ctxSwitch, int offset, int endOffset, bool isFiber );
void DrawContextSwitchList( const TimelineContext& ctx, const std::vector<ContextSwitchDraw>& drawList, const Vector<ContextSwitchData>& ctxSwitch, int offset, int endOffset, bool isFiber, uint64_t tid );
int DispatchGpuZoneLevel( const Vector<short_ptr<GpuEvent>>& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift );
template<typename Adapter, typename V>
int DrawGpuZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, const ImVec2& wpos, int offset, int depth, uint64_t thread, float yMin, float yMax, int64_t begin, int drift );

View File

@@ -166,7 +166,7 @@ const char* View::DecodeContextSwitchState( uint8_t state )
}
}
void View::DrawContextSwitchList( const TimelineContext& ctx, const std::vector<ContextSwitchDraw>& drawList, const Vector<ContextSwitchData>& ctxSwitch, int offset, int endOffset, bool isFiber )
void View::DrawContextSwitchList( const TimelineContext& ctx, const std::vector<ContextSwitchDraw>& drawList, const Vector<ContextSwitchData>& ctxSwitch, int offset, int endOffset, bool isFiber, uint64_t tid )
{
constexpr float MinCtxSize = 4;
@@ -293,7 +293,7 @@ void View::DrawContextSwitchList( const TimelineContext& ctx, const std::vector<
{
m_callstackView = {
.id = waitStack,
.thread = m_worker.DecompressThread( ev.Thread() ),
.thread = tid,
.wait = {
.time = waitTime,
.reason = waitReason,

View File

@@ -84,7 +84,7 @@ void View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, con
{
auto ctxSwitch = m_worker.GetContextSwitchData( thread.id );
assert( ctxSwitch );
DrawContextSwitchList( ctx, ctxDraw, ctxSwitch->v, ctxOffset, offset, thread.isFiber );
DrawContextSwitchList( ctx, ctxDraw, ctxSwitch->v, ctxOffset, offset, thread.isFiber, thread.id );
}
if( hasSamples && !samplesDraw.empty() )
{