If your platform is windows and you want the advertised CPU speed then you can simply check the HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0\~MHz
DWORD value in the Registry:
program SO21757165;
{$APPTYPE CONSOLE}
{$R *.res}
uses
Registry,
Windows,
System.SysUtils;
function GetCPUSpeed : String;
var
Reg : TRegistry;
begin
Reg := TRegistry.Create(KEY_QUERY_VALUE);
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKeyReadOnly('HARDWARE\DESCRIPTION\System\CentralProcessor\0') then
begin
Result := Format('CPU Speed is %dMHz', [Reg.ReadInteger('~MHz')]);
Reg.CloseKey;
end;
finally
Reg.Free;
end;
end;
begin
try
{ TODO -oUser -cConsole Main : Insert code here }
Writeln(GetCPUSpeed);
Readln;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
EDIT
rewrote above code snippet to a compileable example. This example has been verified in XE7and works in 32bit and 64 bit environments (with UAC enabled)