Author Topic: My version of a CPU identification utility  (Read 24494 times)

TWell

  • Member
  • ****
  • Posts: 748
Re: My version of a CPU identification utility
« Reply #45 on: February 26, 2014, 06:28:07 AM »
Code: [Select]
Processor name: AMD Athlon(tm) II X2 220 Processor
Extended + family ID: 1f
Extended + model ID: 06
Stepping: 3
Microarchitecture: Unknown
CPU has FP unit.
CPU supports MMX.
CPU supports SSE.
CPU supports SSE2.
CPU supports SSE3.
CPU does not support SSE 4.1.
CPU does not support SSE 4.2.
CPU does not support AVX.
CPU and OS do not support AVX2.

MichaelW

  • Global Moderator
  • Member
  • *****
  • Posts: 1204
Re: My version of a CPU identification utility
« Reply #46 on: February 26, 2014, 06:30:18 AM »
Dave,

Have you tried executing any SSE3 instructions?
Well Microsoft, here’s another nice mess you’ve gotten us into.

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: My version of a CPU identification utility
« Reply #47 on: February 26, 2014, 08:51:44 AM »
SSE3, yes
SSSE3, no - not supported on my processor

fearless

  • Member
  • ****
  • Posts: 515
    • Github
Re: My version of a CPU identification utility
« Reply #48 on: February 26, 2014, 10:34:10 AM »
Any way to get the correct amount of physical cores?

I had tried using the following code, but for my i5 3570K it returns too many for logical cores 16 and physical cores 8. Im not sure if this is some issue with hyperthreading or some other issue i havent identified. Im assuming if it is hyperthreading, then logical should be 8 and physical should be 4.

Code: [Select]
        mov eax, 1
        xor ebx, ebx
        xor ecx, ecx
        xor edx, edx
        cpuid
        and ebx, 000FF0000h
        shr ebx, 16
        mov LogicalCores, ebx

Code: [Select]
         mov eax, 4
        xor ebx, ebx
        xor ecx, ecx
        xor edx, edx
        cpuid
        and eax, 0FC000000h; 11111100000000000000000000000000b  ; bits 26-31
        shr eax, 26
        inc eax
        mov PhysicalCores, eax
fearless

Lian Li PC-O11DW Case, ASUS ROG Crosshair VIII Hero WiFi, AMD Ryzen 9 5950X, 32GB DDR4-3600MHz, MSI RX 5700XT Gaming X, NZXT Kraken Z73 360mm Cooler, Seasonic PRIME 1000W PSU

My Github  Twitter

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: My version of a CPU identification utility
« Reply #49 on: February 26, 2014, 11:12:28 AM »
easiest way.....

use GetProcessAffinityMask and count bits
it's only fully valid for machines with 32 cores or less   ::)
as far as i know - the most made so far is 24 cores

Code: [Select]
    INVOKE  GetModuleHandle,NULL
    push    eax
    mov     ecx,esp
    push    eax
    mov     edx,esp
    INVOKE  GetProcessAffinityMask,eax,edx,ecx
    pop     ecx
    pop     edx
    bsr     eax,edx
    inc     eax

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: My version of a CPU identification utility
« Reply #50 on: February 26, 2014, 11:22:21 AM »
oh - that returns the number of logical cores
to get the number of physical cores....
for AMD processors, physical count = logical count
for Intel processors, divide by 2 if HTT bit is set

Mark44

  • Regular Member
  • *
  • Posts: 40
Re: My version of a CPU identification utility
« Reply #51 on: February 26, 2014, 12:49:07 PM »
timppa,
Try this version on your AMD Athlon machine... I added a small amount of code to test for SSSE3.

Dave,
That bsr in your code threw me for a minute. I thought it was Branch to Subroutine, which if memory serves, is a Motorola 68x00 instruction. I had to look it up to find out that it's bit scan reverse.

Mark

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: My version of a CPU identification utility
« Reply #52 on: February 26, 2014, 01:18:20 PM »
works here - SSSE3 not supported

TWell

  • Member
  • ****
  • Posts: 748
Re: My version of a CPU identification utility
« Reply #53 on: February 26, 2014, 05:33:30 PM »
timppa,
Try this version on your AMD Athlon machine... I added a small amount of code to test for
Code: [Select]
Processor name: AMD Athlon(tm) II X2 220 Processor
Extended + family ID: 1f
Extended + model ID: 06
Stepping: 3
Microarchitecture: Unknown
CPU has FP unit.
CPU supports MMX.
CPU supports SSE.
CPU supports SSE2.
CPU supports SSE3.
CPU does not support SSSE3.
CPU does not support SSE 4.1.
CPU does not support SSE 4.2.
CPU does not support AVX.
CPU and OS do not support AVX2.

jj2007

  • Member
  • *****
  • Posts: 11551
  • Assembler is fun ;-)
    • MasmBasic
Re: My version of a CPU identification utility
« Reply #54 on: February 26, 2014, 06:52:19 PM »
Processor name: AMD Athlon(tm) Dual Core Processor 4450B
Extended + family ID: 0f
Extended + model ID: 6b
Stepping: 2
Microarchitecture: Unknown
CPU has FP unit.
CPU supports MMX.
CPU supports SSE.
CPU supports SSE2.
CPU supports SSE3.
CPU does not support SSSE3.
CPU does not support SSE 4.1.
CPU does not support SSE 4.2.
CPU does not support AVX.
CPU and OS do not support AVX2.