|
这个是个数。 字节数:
IFEX %&CurFile%.LOG, LOGS * %&CurFile%.LOG
ENVI^ ForceLocal=1
CALC #&len0=1M
^SET#$ &buf=*%len0% 0
SET#$ &count=*8 0
SET-long count=%len0%
SET &RelationProcessorCore=0 //核心Core
SET &RelationNumaNode=1 //NUMA
SET &RelationCache=2 //CACHE
SET &RelationProcessorPackage=3 //物理CPU
CALC &&SZ1=%ptrlen%*2+8*2 //SYSTEM_LOGICAL_PROCESSOR_INFORMATION 0x20:0x18
SET &len=0
CALL $--ret:&&r --qd kernel32,GetLogicalProcessorInformation,*&buf,*&count
IFEX #%r%=1, SET?long count=&len //实际长度
CALC len=%len%
IFEX $%%
SET &i=%ptrlen%
SET &LgCore=0 //逻辑核心数
SET &PhyCore=0 //物理核心数
SET &CPUPak=0 //物理处理器封装个数,即俗称的“物理CPU数”。
SET &NUMA=0 //非均匀访存模块
SET &CACHE=0
SET &processorL1CacheCount=0
SET &processorL1CacheBytes=0
SET &processorL2CacheCount=0
SET &processorL2CacheBytes=0
SET &processorL3CacheCount=0
SET &processorL3CacheBytes=0
SET &Relationship=-1
LOOP #%i%<%len%,
{*
^ENVI?int &buf=&&Relationship:%i%
IFEX #%Relationship%=%RelationProcessorCore%,
{ ^ENVI?ptr &buf=&&ProcessorMask:(%i%-%ptrlen%)
SET &k=0
LOOP #[ %k%<%ptrlen% & %ProcessorMask%<>0 ],
{* CALC #&&b0=%ProcessorMask% & 1
CALC -base=16 #&ProcessorMask=shr(%ProcessorMask%,1)
CALC #&k=%k% + 1
IFEX #%b0%=1, CALC LgCore=%LgCore%+1
}
CALC PhyCore=%PhyCore%+1
}
IFEX #%Relationship%=%&RelationCache%,
{
// Cache data is in ptr->Cache, one CACHE_DESCRIPTOR structure for each cache.
^ENVI?char &buf=&&Level:(%i%+%ptrlen%)
^ENVI?long &buf=&&size:(%i%+%ptrlen%+4)
IFEX #%&Level%=1, TEAM CALC #&processorL1CacheCount=%processorL1CacheCount%+1| CALC #&processorL1CacheBytes=%processorL1CacheBytes%+%&size%
IFEX #%&Level%=2, TEAM CALC #&processorL2CacheCount=%processorL2CacheCount%+1| CALC #&processorL2CacheBytes=%processorL2CacheBytes%+%&size%
IFEX #%&Level%=3, TEAM CALC #&processorL3CacheCount=%processorL3CacheCount%+1| CALC #&processorL3CacheBytes=%processorL3CacheBytes%+%&size%
}
IFEX #%Relationship%=%RelationNumaNode%, CALC NUMA=%NUMA%+1
IFEX #%Relationship%=%RelationProcessorPackage%, CALC CPUPak=%CPUPak%+1
CALC i=%i%+%SZ1%
}
MESS. 逻辑核心数(LgCore)=%LgCore% 物理核心数(PhyCore)=%PhyCore% 物理CPU数(CPUPak)=%CPUPak% NUMA数(NUMA)=%NUMA% 3级缓存分别为:%processorL1CacheCount%个(%processorL1CacheBytes%字节):%processorL2CacheCount%个(%processorL2CacheBytes%字节):%processorL3CacheCount%个(%processorL3CacheBytes%字节)
///////////////////结果:
逻辑核心数(LgCore)=4 物理核心数(PhyCore)=2 物理CPU数(CPUPak)=1 NUMA数(NUMA)=1 3级缓存分别为:4个(131072字节):2个(524288字节):1个(3145728字节)
|
|