Retrieving machine information
[1/3] from: henrik::webz::dk at: 31-May-2004 19:56
Hi Is there any way to retrieve machine information such as CPU type, speed, memory, etc. within REBOL? Would be nice for benchmarking programs. -- Regards, Henrik Mikael Kristensen
[2/3] from: atruter:labyrinth:au at: 1-Jun-2004 9:35
> Is there any way to retrieve machine information such as CPU type, > speed, memory, etc. within REBOL?
Not without using an OS specific API call. Note that some of the info you require might be available as environment variables, eg. (on WinXP):
>> get-env "PROCESSOR_ARCHITECTURE"
>> get-env "PROCESSOR_IDENTIFIER"
== "x86 Family 15 Model 2 Stepping 9, GenuineIntel"
>> get-env "PROCESSOR_LEVEL"
>> get-env "PROCESSOR_REVISION"
== "0209" Regards, Ashley
[3/3] from: greggirwin:mindspring at: 31-May-2004 17:52
Hi Henrik, HMK> Is there any way to retrieve machine information such as CPU type, HMK> speed, memory, etc. within REBOL? Under Windows you would use the GetSystemInfo API. Below is a quick mapping of it; I can flesh out the details to make it more useful if you need, just let me know (just short of time right at the moment or I'd do it now). -- Gregg REBOL  kernel32.dll: load/library %kernel32.dll SYSTEM_INFO: make struct! SYSTEM_INFO-def: [ ;OemID [integer!] ; Obsolete; used for NT 3.51 and < WIndows 95 ProcessorArchitecture [short] ; \_ union with OemID Reserved [short] ; / PageSize [integer!] lpMinAppAddress [integer!] lpMaxAppAddress [integer!] ActiveProcessorMask [integer!] NumberOfProcessors [integer!] ProcessorType [integer!] ; Obsolete on NT. Still used on 95. AllocationGranularity [integer!] ProcessorLevel [short] ; Not used by 95. ProcessorRevision [short] ; Not used by 95. ] none GetSystemInfo: make routine! compose/deep/only [ lpSysInfo [struct! (SYSTEM_INFO-def)] ] kernel32.dll "GetSystemInfo" get-system-info: does [GetSystemInfo SYSTEM_INFO SYSTEM_INFO] probe get-system-info free kernel32.dll halt