PDA

View Full Version : CPU Info


markstaylor
12-10-2004, 12:46 PM
How can I report CPU information like; Type, Speed, Load etc.
I use the memory function in AMS just fine just looking for more info.

Mark

Josué Alba
12-10-2004, 01:39 PM
Well just a question you ask for type, but type of waht?? you mean the pocessor info??

markstaylor
12-10-2004, 01:42 PM
Yes, Intel, AMD, Pent IV any info I can get from a system.

Intrigued
12-10-2004, 01:48 PM
This link has a couple ways of accomplishing such:

http://www.indigorose.com/forums/showthread.php?t=7655&highlight=msinfo32

Sincerely,

Brett
12-10-2004, 01:57 PM
There is no built-in variables for those things in AMS50. We have looked at doing that in the past but due to the fact that we need to support a wide range of operating systems and the different ways to get this information for different processors, it has not been feasible so far.

markstaylor
12-10-2004, 04:28 PM
Thanks again for the quick responces.

SUF6NEWBIE
12-10-2004, 11:13 PM
You may also like to explore the below Registry Key:

[HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Cen tralProcessor\0]

There is a wealth of reliable information that can be returned from this area
of the registry:

the value: ~MHZ if read by AMS will return the CPU Clock speed
(if the 'length' of returned string is 4 - then you are in the GigHz range)

the value: VendorIdentifier will return CPU manuafacturer

Above are present on Win2K and later..so could use the first two at least

not on all systems: ProcessorNameString

note: if system is 'Multi-threading' capable and has been Enabled in the BIOS

[HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\Cen tralProcessor\1]

is present also (or if genuine 'Dual Processors)

May come in handy for quick Cpu speed checking at least ..(and manufacturer

SUF6NEWBIE
12-11-2004, 02:12 AM
Here's some LUA code for AMS5 and SUF70
(tested on Win2k and later OSs only)

Returns a boolean as to whether 'required CPU specs' have been met

function GetCPUSpecs() --test for Cpu Speed and Manufacturer
--set some values for 'Min CPu speed' and 'Supported Manufacturer'
local CpuMin = 500; --500 Mhz clock speed-minimum requirement
local Man1 = "intel"; -- approved manufacturer target strings
local Man2 = "amd"; -- " " " "
bCpuspecsmet = false; -- set global initial value
local strCpuRegKey = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0 \\";
local CpuInfo_T = Registry.GetValueNames(HKEY_LOCAL_MACHINE, strCpuRegKey);
--cycle valuenames for 'required' specifications
for cpuindex, cpuvalue in CpuInfo_T do
Dialog.Message("Debug info only: valuename-", cpuvalue);
if (cpuvalue == "~MHz") then
Cpuspec = String.ToNumber(Registry.GetValue(HKEY_LOCAL_MACHI NE, strCpuRegKey, cpuvalue, true));
end
if (cpuvalue == "VendorIdentifier") then
Manspec = Registry.GetValue(HKEY_LOCAL_MACHINE, strCpuRegKey, cpuvalue, true);
end
end
if (Cpuspec ~= "") and (Manspec ~= "") then
if (Cpuspec >= CpuMin) then
if (String.Find(Manspec, Man1, 1, false) ~= "-1") or (String.Find(Manspec, Man2, 1, false) ~= "-1") then
Dialog.Message("Debug info only: returned Specs", "CPU clock speed:-"..Cpuspec.."\r\nManufacturer:-"..Manspec.."\r\n\r\nMin target Cpu speed:-"..CpuMin);
bCpuspecsmet = true;
end
end
end
return bCpuspecsmet;
end --GetCPUSpecs()

TO CALL IT ..say in startup actions..

GetCPUSpecs();
-- will return true or false as below example:

if (not bCpuspecsmet) then
Dialog.Message("This Application Cannot Continue","Minimum Required System CPU Specifications were not met");
end
if (bCpuspecsmet) then
Dialog.Message("This Application Can Continue","Minimum Required System CPU Specifications Have been met");
end

..there is also another value named: Identifier.
(if you wish to include this one in above function..what you are looking for is
eG: Stepping 3)
as far as I am aware:
'Stepping 1' equates to Celeron -Amd Duron equiv
'Stepping 3' equates to PIII or equivelent
'Stepping 9' is one known value for PIV (with multi threading)

I anyone can confirm the 'stepping values' during testing let us know..
Please report if Code Functions reliably for your testing.
(so far so good at my end..)

SUF6NEWBIE
12-11-2004, 02:52 AM
..fiddle with the code if only wish to check for and or display CPu speed etc.
(supported manufacturer 'required' stuff --only if essential ?)

..if want to display CPu speed suggest checking if length of string is 4
then string.mid (first 2) then modify the string to show eg:
if value is 2411 for cpu speed , a 'user friendly' would be 2.4ghz or similar

SUF6NEWBIE
12-11-2004, 05:33 AM
Here's a 'safer' modifiaction ..only does CPu Check and provides a display string

function GetCPUSpecs()
bCpuspecsmet = true;
local CpuMin = 500; --500 Mhz min req
local strCpuRegKey = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0 \\";
local CpuInfo_T = Registry.GetValueNames(HKEY_LOCAL_MACHINE, strCpuRegKey);
for cpuindex, cpuvalue in CpuInfo_T do
if (cpuvalue == "~MHz") then
strCpuspec = Registry.GetValue(HKEY_LOCAL_MACHINE, strCpuRegKey, cpuvalue, true);
if (String.Length(strCpuspec) == 4) then
strcpumid = String.Mid(strCpuspec, 1, 2);
CpuDisp = String.Left(strcpumid, 1).."."..String.Right(strcpumid, 1).." Ghz"; --display ready
else
CpuDisp = strCpuspec.." Mhz"; --display ready
end
Cpuspec = String.ToNumber(strCpuspec);
break;
end
end
if (Cpuspec < CpuMin) then
bCpuspecsmet = false;
elseif (strCpuspec == "") then
CpuDisp = "No Data"; --display ready
end
return bCpuspecsmet;
end --GetCPUSpecs

works for Win2k and later(may work for Win98 -Me..hav'nt tested)

markstaylor
12-12-2004, 06:04 PM
Thanks alot for the HELPFUL info. I didn't even think about the Registry.

Your code works fine on XP Pro SP2.

Thanks again.

SUF6NEWBIE
12-13-2004, 04:17 AM
noproblemo Mark...happy its doin its thing...tks for the confirmation

csd214
12-13-2004, 05:22 AM
as far as I am aware:
'Stepping 1' equates to Celeron -Amd Duron equiv
'Stepping 3' equates to PIII or equivelent
'Stepping 9' is one known value for PIV (with multi threading)

I didn't know, but are you sure? I could give my word that my old laptop was equipped with a Celeron processor, but the Registry has these data:
"Identifier"="x86 Family 6 Model 6 Stepping 10"
"ProcessorNameString" = value does not exist

On the Intel site I found:
* The "family" and "model" information determines what kind of processor it is (Pentium® processor, Pentium® Pro processor, Pentium® II processor, etc.).
* The "stepping" of a processor can be compared to the "version" of a piece of software.
* Intel Pentium 4 processors have a Family value of "F"

I think 'value of F' means the hex value = decimal 15. At least my main computer returns:
"Identifier" = x86 Family 15 Model 2 Stepping 4
"ProcessorNameString" = Intel(R) Pentium(R) 4 CPU 2.40GHz

The old Intel Utility CPUID.exe displays:
This system has an unknown Genuine Intel processor with MMX(TM) technology
Processor Family: F / Model: 2 / Stepping: 4
Intel has some test apps at http://support.intel.com/support/processors/sb/CS-015477.htm

Thanks to the flexibility in both AMS50 and SUF70 (the LUA engine) it is possible to get the information you need (with the conditions that are suitable to your needs). But, what to do in another app without the capabilities of reading the Registry? Thanks to a previous link in this forum I use AutoIt (http://www.autoitscript.com/autoit3/). It's a really nice tool. You use Notepad to write a script file (.au3) like this:
$Speed = RegRead("HKLM\Hardware\Description\System\CentralProcessor\ 0","~MHz")
If $Speed <> "" Then
$Speed = Round($Speed / 1000,1) & " GHz"
Endif
You can compile the script to an exe file (with your own icon). In the attached example I write the info to an ini file which can be read by "the other app". Of course you can run the Env_info.exe from AMS and then read the ini file…

My main computer has this output (Env_Info.ini, with Norwegian data labels, sorry):
[System]
WindowsVersjon=Windows XP 5.1.2600 Service Pack 2
Prosessor=Intel(R) Pentium(R) 4 CPU 2.40GHz
CPU Speed=2.4 GHz
CPU Identifier=x86 Family 15 Model 2 Stepping 4

My old laptop:
[System]
WindowsVersjon=Windows NT4 4.0.1381 Service Pack 6
Prosessor=x86 Family 6 Model 6 Stepping 10
CPU Speed=0.4 GHz <== Impressive!
CPU Identifier=x86 Family 6 Model 6 Stepping 10

A real OLD Compaq (with a 1.95 GB hard disk); from the trash dump)
[System]
WindowsVersjon=Windows 98 4.10.2222 A
Prosessor=Pentium(r) Processor
CPU Speed=
CPU Identifier=Pentium(r) Processor

It should be nice to have more reports about the "Family" issue.

SUF6NEWBIE
12-13-2004, 08:39 AM
'If anyone can confirm the 'stepping values' during testing let us know..'


Thanks for all the Information CSD...yep the Proccessor 'Capabilities' I mentioned (stepping value) is obviously not reliable info...

It would be great if we could get basic CPU capability ....

sasakrek
08-24-2005, 07:05 AM
It is all ok... but... can anyone help me to get my hard disk id....

csd214
08-24-2005, 10:35 AM
Do you mean the manufacturer’s name of the disk? If you want more than the label, serial number and so on, you have to search the Registry; I guess. What about this little snippet

sRegKeyDisk = "SYSTEM\\CurrentControlSet\\Services\\Disk\\Enum";
sDiskName = Registry.GetValue(HKEY_LOCAL_MACHINE, sRegKeyDisk, "0", true);
sDiskName = String.TrimLeft(sDiskName, "IDE\\Disk"); -- remove IDE\\Disk

-- find pos of first multiple underscore char
nPos = String.Find(sDiskName, "__", 1, false);
if nPos ~= -1 then
sDiskName = String.Left(sDiskName, nPos - 1);
end
Dialog.Message("First Physical Disk", "Name: "..sDiskName);

Is this the ID you request?