News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Another CPU ID Program

Started by dedndave, January 03, 2010, 11:26:03 AM

Previous topic - Next topic

Magicle

Sorry for my ignorance but, what exactly are you trying to accomplish?

dedndave

lol nothing ignorant there
not sure what i am doing   :P

the idea is to write a routine that programmers can use to identify the platform at runtime
i have another thread on "OS Info Dump", and one to measure CPU frequency
Hutch has one for getting the disk free space and another for getting the memory stats
put them all together, and a programmer can select algorithms and/or data sizes (or even DLL's) based on the runtime platform
of particular intrest in this case, is which instruction sets can be used
if the progam is running on a machine that supports SSE 4.1 instructions, for example, those instructions can be used
a more complicated scenerio might be one where the programmer wants to control thread scheduling
he might need to know how many cores there are and which affinity bits correspond to which cores
there are simpler cases where we just want to know what processor a piece of test code is running on
if you look at a few of the posts in the Laboratory forum, you will see some of the test programs name the CPU

Magicle

Cool, thanks for the info Dave (Me has gotten wiser me thinks!)  :P

dedndave

no prob - you have a nice processor, there
you might be able to find it in the Laboratory
if not, d/l some of the test attachments in there and run them to see how it compares

here's an example by JJ...
http://www.masm32.com/board/index.php?topic=12984.0

FORTRANS

Hi,

   Perhaps we should have a sticky topic to point to the various
CPU/OS/System identification threads?

Cheers,

Steve N.

dedndave

well - we are still in the development stage
once we get the bugs worked out, we could put them all in one sticky place   :U

herge

Hi *.*:


          EAX: 0
          ECX: 120
          EDX: 00403AB0h
       cbSize: 120
dwCoreAffMask: 00000000000000000000000000000001b
dwIdCpuStatus: 00000000h
    bVendorID: 2
      bFamily: 15
   bExtFamily: 0
       bModel: 15
    bExtModel: 2
        bType: 0
        bStep: 2
     bMmxBits: 00000011b
   w3DNowBits: 0000000000000011b
     wSseBits: 0000000000000111b
   dwMiscBits: 00000000000000001000111101111111b
      szBrand: AMD Athlon(tm) 64 Processor 3200+
     szVendor: AuthenticAMD
        szMmx: MMX+
      sz3DNow: 3DNow!+
        szSse: SSE3
Press any key to continue ...


Regards: herge
// Herge born  Brussels, Belgium May 22, 1907
// Died March 3, 1983
// Cartoonist of Tintin and Snowy

BlackVortex

          EAX: 0
          ECX: 120
          EDX: 00403AB0h
       cbSize: 120
dwCoreAffMask: 00000000000000000000000000000001b
dwIdCpuStatus: 00000000h
    bVendorID: 1
      bFamily: 6
   bExtFamily: 0
       bModel: 7
    bExtModel: 1
        bType: 0
        bStep: 10
     bMmxBits: 00000001b
   w3DNowBits: 0000000000000000b
     wSseBits: 0000000000011111b
   dwMiscBits: 00000000000000101011101101111111b
      szBrand: Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
     szVendor: GenuineIntel
        szMmx: MMX
      sz3DNow:
        szSse: SSE4.1

:U

dacid


          EAX: 0
          ECX: 120
          EDX: 00403AB0h
       cbSize: 120
dwCoreAffMask: 00000000000000000000000000000001b
dwIdCpuStatus: 00000000h
    bVendorID: 2
      bFamily: 15
   bExtFamily: 0
       bModel: 11
    bExtModel: 6
        bType: 0
        bStep: 2
     bMmxBits: 00000011b
   w3DNowBits: 0000000000000011b
     wSseBits: 0000000000000111b
   dwMiscBits: 00000000000000101011111101111111b
      szBrand: AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
     szVendor: AuthenticAMD
        szMmx: MMX+
      sz3DNow: 3DNow!+
        szSse: SSE3
Press any key to continue ...

PBrennick


          EAX: 0
          ECX: 120
          EDX: 00403AB0h
       cbSize: 120
dwCoreAffMask: 00000000000000000000000000000001b
dwIdCpuStatus: 00000000h
    bVendorID: 2
      bFamily: 15
   bExtFamily: 1
       bModel: 6
    bExtModel: 0
        bType: 0
        bStep: 2
     bMmxBits: 00000011b
   w3DNowBits: 0000000000000011b
     wSseBits: 0000000001000111b
   dwMiscBits: 00000000000000101011111111111111b
      szBrand: AMD Turion(tm) II Dual-Core Mobile M500
     szVendor: AuthenticAMD
        szMmx: MMX+
      sz3DNow: 3DNow!+
        szSse: SSE4a
Press any key to continue ...

The GeneSys Project is available from:
The Repository or My crappy website

dedndave

the routine seems to work well for Intel and AMD processors
but, it may return inaccurate results for off-brand cores
there are more things i wanted this routine to do, but first, i have to make it do what it does correctly - lol

after some thought, i realize that naming the processor, creating the codename string, enumerating packages, enumerating cores,
mapping cores to affinity mask bits, feature detection and creating feature strings are all very different goals
different applications require different treatment
to be completely successful, ring 0 access is needed to do some of it - a bit beyond the scope of identifying features

i may seperate the functions so that if feature information is desired, the bloat of performing all the other tasks is not included

and - if you think CPUID is a mess now, wait until you see what they are doing with AVX - lol
so far, i count 9 different feature bits to describe AVX capabilities, and i am sure there will be more
Intel and AMD are completely different with regard to AVX

PBrennick

.... and the beat goes on. Where does it end? Certainly, never. You certainly are not afraid of complicated tasks!

Paul
The GeneSys Project is available from:
The Repository or My crappy website

dedndave

QuoteYou certainly are not afraid of complicated tasks!

lol - in the world of engineering, i always get the crap-jobs
i get the stuff noone else wants to tackle
i have learned to just stay with it and finish it
a job is a job, after all - and - it can be rather lucrative   :bg

as for assembly language, i am much the same way, but it is a spare-time hobby
so, i don't always get to finish what i want when i want to
with CPUID, i realized that many of us had tackled it at one time or another
after you toil through a pile of documentation, you still don't know how it works - lol
you wind up leaving it in a "this will be good enough" state
i wanted to tackle it and get it right, just so noone else would have to mess with it
i think splitting it up makes sense - i can finish some requirements now
for some of it, i need to learn more to do it - that can wait til later

as it is, i have some non-technical tasks to be done before the summer arrives
so, i want to get things in a state where i can set them aside for a month and finish all that stuff
then, i can come back to it - if i finish my other tasks, i can play with code all summer and stay inside with the A/C   :bg

Bill Cravener

Quote from: dedndave on February 15, 2010, 05:39:07 AM
- if i finish my other tasks, i can play with code all summer and stay inside with the A/C   :bg

I spent a year in the Dallas Fort Worth area and I just couldn't take the heat down there. Exact opposite of our northeastern winters. The summer I spent down there average temp was 100 F. Up here in the cold you can add more layers, in the heat there is only so much the law allows you to remove when outdoors. :bg
My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

dedndave

around here, 100 is nice weather in the summer
it is when it gets over 110 that you must stay indoors during the day
at midnight - it might get down to 90 - great time for a swim