Page 2 of 2

Re: cpuinfo module

Posted: Thu Jun 09, 2016 9:02 am
by alen
Hello,

Very nice !

Works great on my two Linux distributions with different Hardware:
- Fedora 23 - 64 Bit
- Manjaro Linux (Archlinux) - 64 Bit

Mini ITX Intel® Quad-Core Processor J1900 @ 2 Ghz
Dell Latitude E5430 with Intel® i5-3340M Processor @ 2,7 Ghz


Regards,
Alen

Re: cpuinfo module

Posted: Sat Jun 11, 2016 10:40 am
by RSBasic
Image
GenuineIntel
Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
4 cores
Running on core number 6
Running at 3300 mhz
SSE2 mode
(Tested on Windows 10 too.)

Re: cpuinfo module

Posted: Sun Jun 12, 2016 9:22 am
by idle
RSBasic wrote:Image
GenuineIntel
Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
4 cores
Running on core number 6
Running at 3300 mhz
SSE2 mode
(Tested on Windows 10 too.)
thanks for testing it
I'll have a look and see if I can check for threads per core since it says it's running on core 6 out of 4 cores

Re: cpuinfo module

Posted: Sun Jun 12, 2016 12:12 pm
by Helle
Hi idle,
even APIC_ID´s are for the phys.Cores (start with 0), odd APIC_ID´s are for the log.Cores (start with 1, if HT). Without HT the APIC_ID must div.2 for GetActiveCore():

Code: Select all

APIC_ID.l
j = 1
hThread = GetCurrentThread_()
OldThreadAffinityMask = SetThreadAffinityMask_(hThread, j) ;Save
While SetThreadAffinityMask_(hThread, j)
  Number_Threads + 1
  !MOV eax,1
  !CPUID
  !SHR ebx,24                ;Initial APIC ID. Bit24: 0=phys., 1=log.Core
  !TEST ebx,1
  !JNZ @f
  !mov [v_APIC_ID],ebx
 Debug APIC_ID               ;0, 2, 4, 6... with/without HT
  Number_Cores + 1 
  Core_Sequence$ + "P"
  !JMP NextCore
!@@:
  !mov [v_APIC_ID],ebx
 Debug APIC_ID               ;1, 3, 5, 7... with HT 
  Core_Sequence$ + "L"
  Hyper_Threading + 1
!NextCore:
  j << 1
Wend
SetThreadAffinityMask_(hThread, OldThreadAffinityMask)     ;Restore

If Hyper_Threading
  Hyper_Threading$ = "Yes"
 Else 
  Hyper_Threading$ = "No"
EndIf

Debug "----------"
Debug Number_Cores
Debug Number_Threads
Debug Core_Sequence$         ;Horror with AMD, I saw this with Bulldozer, confirmed with Pscheck (AMD Prog.)
Debug Hyper_Threading$
GetFrequency(): On CPUs with Invariant TSC (all new CPUs) this gives the Base-Clock (e.g. for Timings), not the "Running at ..."!

Helle

Re: cpuinfo module

Posted: Sun Jun 12, 2016 8:48 pm
by davido
Two of my machines produce the following:

PC - Windows 10
GenuineIntel
Intel(R) Core(TM) i7-5960X CPU @ 3.00GHz
16 cores
Running on core number 5
Running at 3030 mhz
SSE2 mode

MacBook Pro
GenuineIntel
Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
4 cores
Running on core number 1
Running at 3115 mhz
SSE2 mode

Re: cpuinfo module

Posted: Sun Dec 06, 2020 12:24 pm
by BarryG
How do you use #PB_CPU_HYPERVISOR from the original post in this thread? I tried the following line but I get an error about the constant #PB_CPU_HYPERVISOR not found, but it's in the Enumerations?

Code: Select all

Debug CPUInfo::IsCPU(#PB_CPU_HYPERVISOR)

Re: cpuinfo module

Posted: Sun Dec 06, 2020 10:51 pm
by tester
BarryG wrote:How do you use #PB_CPU_HYPERVISOR from the original post in this thread? I tried the following line but I get an error about the constant #PB_CPU_HYPERVISOR not found, but it's in the Enumerations?

Code: Select all

Debug CPUInfo::IsCPU(#PB_CPU_HYPERVISOR)

Code: Select all

Debug CPUInfo::IsCPU(CPUInfo::#PB_CPU_HYPERVISOR)

Re: cpuinfo module

Posted: Mon Dec 07, 2020 8:45 am
by BarryG
Thanks, tester!

Re: cpuinfo module

Posted: Tue Mar 15, 2022 1:09 am
by idle
updated module and changed IsCpu parameter to a string, so it can work with a map to print the features

Re: cpuinfo module

Posted: Sun May 07, 2023 5:53 am
by idle
updated v1.1 added GetCPUSerialNumber - jassing