forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Processor type, number, stepping

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Apr 01, 2008 5:44 pm    Post subject: Processor type, number, stepping Reply with quote

Can you post fortran snippet using WIN API function which tells how many processors in the computer, their stepping etc
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Wed Apr 02, 2008 10:03 am    Post subject: Reply with quote

Try looking at the data returned by GetSystemInfo.
You will find this in win32api.ins.
Documentation is in Microsoft MSDN.
Back to top
View user's profile Send private message AIM Address
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Wed Apr 02, 2008 1:50 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Apr 03, 2008 12:24 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Apr 03, 2008 7:08 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group