Can you post fortran snippet using WIN API function which tells how many processors in the computer, their stepping etc
Processor type, number, stepping
Try looking at the data returned by GetSystemInfo. You will find this in win32api.ins. Documentation is in Microsoft MSDN.
You can use getenv@ to return environmental values, as here:-
SUBROUTINE GET_NUMBER_OF_PROCESSORS(NPROC)
CHARACTER*10 getenv@
READ(getenv@('NUMBER_OF_PROCESSORS'),*)NPROC
RETURN
END
SUBROUTINE GET_PROCESSOR_IDENTIFIER
CHARACTER*80 getenv@,IDENTIFIER
IDENTIFIER=' '
IDENTIFIER=getenv@('PROCESSOR_IDENTIFIER')
WRITE(6,'(1X,A,/)')IDENTIFIER
RETURN
END
which yields this on my PC:-
Number of processors = 4
AMD64 Family 16 Model 2 Stepping 2, AuthenticAMD
And also to get processor info:-
CHARACTER*400 LDATA
LSTR=400
k = REGOPENKEYEX(HKEY_LOCAL_MACHINE,
& 'HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0',
& 0,KEY_READ,MyKey)
IF (MyKey.GT.0) THEN
k = REGQUERYVALUEEX(MyKey,'ProcessorNameString',
& CORE4(0),CORE4(0),LDATA,LSTR)
WRITE(6,'(/,'' Processor : '',A,/)')LDATA(1:LSTR)
END IF
k = REGCLOSEKEY(MyKey)
which yields this on my PC:-
Processor : AMD Phenom(tm) 9600 Quad-Core Processor
That GetSysteminfo stuff is soooo confusing with fortran. Here is the code to extract the processor info
Program CPU
use mswin
implicit none
integer*1 si(36)
si = 0
call GetSystemInfo(si)
write(*, '(a,I3)') 'Number of Processors :', 100*si(19)+10*si(20)+si(21)
write(*, '(a,3I3)')'Processor Family/Model/Step:', 10*si(32)+si(33), si(36),10*si(34)+si(35)
End Program CPU
It works though, thanks Paul
What John proposed with getenv@ was cool, actually just two lines of text and it's done!
write(,) getenv@('NUMBER_OF_PROCESSORS') write(,) getenv@('PROCESSOR_IDENTIFIER')
The REGOPENKEYEX way is also nice to know, while it's kinda unusual
All methods though give processor model=23 while CPU-Z produces Model=7, Extended Model=17. Any idea why ?
Curiosity for, is it hard to get also CPU Revsion, real Core Clock (not stock one, cores are overclocked), Bus Speed, Cores Temperature, all that stuff CPU-Z, GPU-Z give ? How they get this info ? Things are that all these codes and additionally the CPUCool, CoreTemp and others give often different numbers for core voltage, core temperatures, core speed etc
If you still want to use GetSysteminfo then it may be simpler to have
integer*4 si(9)
because most of the members are effectively DWORDs.