mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Get CPU die information on windows.
This commit is contained in:
parent
f7b810a3d1
commit
8f3b312b7c
@ -3746,6 +3746,12 @@ void Profiler::ReportTopology()
|
||||
auto res = _GetLogicalProcessorInformationEx( RelationProcessorPackage, packageInfo, &psz );
|
||||
assert( res );
|
||||
|
||||
DWORD dsz = 0;
|
||||
_GetLogicalProcessorInformationEx( RelationProcessorDie, nullptr, &dsz );
|
||||
auto dieInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)tracy_malloc( dsz );
|
||||
res = _GetLogicalProcessorInformationEx( RelationProcessorDie, dieInfo, &dsz );
|
||||
assert( res );
|
||||
|
||||
DWORD csz = 0;
|
||||
_GetLogicalProcessorInformationEx( RelationProcessorCore, nullptr, &csz );
|
||||
auto coreInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)tracy_malloc( csz );
|
||||
@ -3778,6 +3784,24 @@ void Profiler::ReportTopology()
|
||||
idx++;
|
||||
}
|
||||
|
||||
idx = 0;
|
||||
ptr = dieInfo;
|
||||
while( (char*)ptr < ((char*)dieInfo) + dsz )
|
||||
{
|
||||
assert( ptr->Relationship == RelationProcessorDie );
|
||||
// FIXME account for GroupCount
|
||||
auto mask = ptr->Processor.GroupMask[0].Mask;
|
||||
int core = 0;
|
||||
while( mask != 0 )
|
||||
{
|
||||
if( mask & 1 ) cpuData[core].die = idx;
|
||||
core++;
|
||||
mask >>= 1;
|
||||
}
|
||||
ptr = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)(((char*)ptr) + ptr->Size);
|
||||
idx++;
|
||||
}
|
||||
|
||||
idx = 0;
|
||||
ptr = coreInfo;
|
||||
while( (char*)ptr < ((char*)coreInfo) + csz )
|
||||
|
Loading…
Reference in New Issue
Block a user