mirror of
https://github.com/wolfpld/tracy
synced 2025-05-03 14:03:52 +00:00
Cache ThreadData pointer for current thread context.
This commit is contained in:
parent
ded49edf4c
commit
b1c88cd1f2
@ -2841,7 +2841,8 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread )
|
|||||||
CountZoneStatistics( zone );
|
CountZoneStatistics( zone );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto td = NoticeThread( thread );
|
auto td = m_threadCtxData;
|
||||||
|
if( !td ) td = m_threadCtxData = NoticeThread( thread );
|
||||||
td->count++;
|
td->count++;
|
||||||
if( td->stack.empty() )
|
if( td->stack.empty() )
|
||||||
{
|
{
|
||||||
@ -3519,8 +3520,12 @@ bool Worker::Process( const QueueItem& ev )
|
|||||||
|
|
||||||
void Worker::ProcessThreadContext( const QueueThreadContext& ev )
|
void Worker::ProcessThreadContext( const QueueThreadContext& ev )
|
||||||
{
|
{
|
||||||
m_threadCtx = ev.thread;
|
|
||||||
m_refTimeThread = 0;
|
m_refTimeThread = 0;
|
||||||
|
if( m_threadCtx != ev.thread )
|
||||||
|
{
|
||||||
|
m_threadCtx = ev.thread;
|
||||||
|
m_threadCtxData = RetrieveThread( ev.thread );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev )
|
void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev )
|
||||||
@ -3594,12 +3599,8 @@ void Worker::ProcessZoneBeginAllocSrcLocCallstack( const QueueZoneBegin& ev )
|
|||||||
|
|
||||||
void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
|
||||||
{
|
{
|
||||||
auto td = RetrieveThread( m_threadCtx );
|
auto td = m_threadCtxData;
|
||||||
if( !td )
|
assert( td );
|
||||||
{
|
|
||||||
ZoneEndFailure( m_threadCtx );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto zoneId = td->zoneIdStack.back_and_pop();
|
auto zoneId = td->zoneIdStack.back_and_pop();
|
||||||
if( zoneId != td->nextZoneId )
|
if( zoneId != td->nextZoneId )
|
||||||
@ -3669,13 +3670,6 @@ void Worker::ZoneStackFailure( uint64_t thread, const ZoneEvent* ev )
|
|||||||
m_failureData.srcloc = ev->SrcLoc();
|
m_failureData.srcloc = ev->SrcLoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::ZoneEndFailure( uint64_t thread )
|
|
||||||
{
|
|
||||||
m_failure = Failure::ZoneEnd;
|
|
||||||
m_failureData.thread = thread;
|
|
||||||
m_failureData.srcloc = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Worker::ZoneTextFailure( uint64_t thread )
|
void Worker::ZoneTextFailure( uint64_t thread )
|
||||||
{
|
{
|
||||||
m_failure = Failure::ZoneText;
|
m_failure = Failure::ZoneText;
|
||||||
@ -3699,7 +3693,7 @@ void Worker::MemFreeFailure( uint64_t thread )
|
|||||||
|
|
||||||
void Worker::FrameEndFailure()
|
void Worker::FrameEndFailure()
|
||||||
{
|
{
|
||||||
m_failure = Failure::ZoneEnd;
|
m_failure = Failure::FrameEnd;
|
||||||
m_failureData.thread = 0;
|
m_failureData.thread = 0;
|
||||||
m_failureData.srcloc = 0;
|
m_failureData.srcloc = 0;
|
||||||
}
|
}
|
||||||
@ -5941,7 +5935,6 @@ void Worker::WriteTimelineImpl( FileWrite& f, const V& vec, int64_t& refTime, in
|
|||||||
static const char* s_failureReasons[] = {
|
static const char* s_failureReasons[] = {
|
||||||
"<unknown reason>",
|
"<unknown reason>",
|
||||||
"Invalid order of zone begin and end events.",
|
"Invalid order of zone begin and end events.",
|
||||||
"Received zone end event without a matching zone begin event.",
|
|
||||||
"Zone text transfer destination doesn't match active zone.",
|
"Zone text transfer destination doesn't match active zone.",
|
||||||
"Zone name transfer destination doesn't match active zone.",
|
"Zone name transfer destination doesn't match active zone.",
|
||||||
"Memory free event without a matching allocation.",
|
"Memory free event without a matching allocation.",
|
||||||
|
@ -275,7 +275,6 @@ public:
|
|||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
ZoneStack,
|
ZoneStack,
|
||||||
ZoneEnd,
|
|
||||||
ZoneText,
|
ZoneText,
|
||||||
ZoneName,
|
ZoneName,
|
||||||
MemFree,
|
MemFree,
|
||||||
@ -481,7 +480,6 @@ private:
|
|||||||
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev, bool serial );
|
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev, bool serial );
|
||||||
|
|
||||||
void ZoneStackFailure( uint64_t thread, const ZoneEvent* ev );
|
void ZoneStackFailure( uint64_t thread, const ZoneEvent* ev );
|
||||||
void ZoneEndFailure( uint64_t thread );
|
|
||||||
void ZoneTextFailure( uint64_t thread );
|
void ZoneTextFailure( uint64_t thread );
|
||||||
void ZoneNameFailure( uint64_t thread );
|
void ZoneNameFailure( uint64_t thread );
|
||||||
void MemFreeFailure( uint64_t thread );
|
void MemFreeFailure( uint64_t thread );
|
||||||
@ -680,6 +678,7 @@ private:
|
|||||||
size_t m_frameImageCompressedBufferSize = 0;
|
size_t m_frameImageCompressedBufferSize = 0;
|
||||||
|
|
||||||
uint64_t m_threadCtx = 0;
|
uint64_t m_threadCtx = 0;
|
||||||
|
ThreadData* m_threadCtxData = nullptr;
|
||||||
int64_t m_refTimeThread = 0;
|
int64_t m_refTimeThread = 0;
|
||||||
int64_t m_refTimeSerial = 0;
|
int64_t m_refTimeSerial = 0;
|
||||||
int64_t m_refTimeCtx = 0;
|
int64_t m_refTimeCtx = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user