mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Check provider id in etw callback.
This commit is contained in:
parent
ba0715b295
commit
539ccf5a61
@ -75,42 +75,49 @@ void WINAPI EventRecordCallback( PEVENT_RECORD record )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
const auto& hdr = record->EventHeader;
|
const auto& hdr = record->EventHeader;
|
||||||
if( hdr.EventDescriptor.Opcode == 36 )
|
switch( hdr.ProviderId.Data1 )
|
||||||
{
|
{
|
||||||
const auto cswitch = (const CSwitch*)record->UserData;
|
case 0x3d6fa8d1: // Thread Guid
|
||||||
|
if( hdr.EventDescriptor.Opcode == 36 )
|
||||||
|
{
|
||||||
|
const auto cswitch = (const CSwitch*)record->UserData;
|
||||||
|
|
||||||
TracyLfqPrepare( QueueType::ContextSwitch );
|
TracyLfqPrepare( QueueType::ContextSwitch );
|
||||||
MemWrite( &item->contextSwitch.time, hdr.TimeStamp.QuadPart );
|
MemWrite( &item->contextSwitch.time, hdr.TimeStamp.QuadPart );
|
||||||
memcpy( &item->contextSwitch.oldThread, &cswitch->oldThreadId, sizeof( cswitch->oldThreadId ) );
|
memcpy( &item->contextSwitch.oldThread, &cswitch->oldThreadId, sizeof( cswitch->oldThreadId ) );
|
||||||
memcpy( &item->contextSwitch.newThread, &cswitch->newThreadId, sizeof( cswitch->newThreadId ) );
|
memcpy( &item->contextSwitch.newThread, &cswitch->newThreadId, sizeof( cswitch->newThreadId ) );
|
||||||
memset( ((char*)&item->contextSwitch.oldThread)+4, 0, 4 );
|
memset( ((char*)&item->contextSwitch.oldThread)+4, 0, 4 );
|
||||||
memset( ((char*)&item->contextSwitch.newThread)+4, 0, 4 );
|
memset( ((char*)&item->contextSwitch.newThread)+4, 0, 4 );
|
||||||
MemWrite( &item->contextSwitch.cpu, record->BufferContext.ProcessorNumber );
|
MemWrite( &item->contextSwitch.cpu, record->BufferContext.ProcessorNumber );
|
||||||
MemWrite( &item->contextSwitch.reason, cswitch->oldThreadWaitReason );
|
MemWrite( &item->contextSwitch.reason, cswitch->oldThreadWaitReason );
|
||||||
MemWrite( &item->contextSwitch.state, cswitch->oldThreadState );
|
MemWrite( &item->contextSwitch.state, cswitch->oldThreadState );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
else if( hdr.EventDescriptor.Opcode == 50 )
|
else if( hdr.EventDescriptor.Opcode == 50 )
|
||||||
{
|
{
|
||||||
const auto rt = (const ReadyThread*)record->UserData;
|
const auto rt = (const ReadyThread*)record->UserData;
|
||||||
|
|
||||||
TracyLfqPrepare( QueueType::ThreadWakeup );
|
TracyLfqPrepare( QueueType::ThreadWakeup );
|
||||||
MemWrite( &item->threadWakeup.time, hdr.TimeStamp.QuadPart );
|
MemWrite( &item->threadWakeup.time, hdr.TimeStamp.QuadPart );
|
||||||
memcpy( &item->threadWakeup.thread, &rt->threadId, sizeof( rt->threadId ) );
|
memcpy( &item->threadWakeup.thread, &rt->threadId, sizeof( rt->threadId ) );
|
||||||
memset( ((char*)&item->threadWakeup.thread)+4, 0, 4 );
|
memset( ((char*)&item->threadWakeup.thread)+4, 0, 4 );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
else if( hdr.EventDescriptor.Opcode == 1 || hdr.EventDescriptor.Opcode == 3 )
|
else if( hdr.EventDescriptor.Opcode == 1 || hdr.EventDescriptor.Opcode == 3 )
|
||||||
{
|
{
|
||||||
const auto tt = (const ThreadTrace*)record->UserData;
|
const auto tt = (const ThreadTrace*)record->UserData;
|
||||||
|
|
||||||
uint64_t tid = tt->threadId;
|
uint64_t tid = tt->threadId;
|
||||||
if( tid == 0 ) return;
|
if( tid == 0 ) return;
|
||||||
uint64_t pid = tt->processId;
|
uint64_t pid = tt->processId;
|
||||||
TracyLfqPrepare( QueueType::TidToPid );
|
TracyLfqPrepare( QueueType::TidToPid );
|
||||||
MemWrite( &item->tidToPid.tid, tid );
|
MemWrite( &item->tidToPid.tid, tid );
|
||||||
MemWrite( &item->tidToPid.pid, pid );
|
MemWrite( &item->tidToPid.pid, pid );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user