Memoria, processador ...

Delphi

10/05/2004

Gente

Alguem tem alguma classe, componente ou algum programa com fonte que obtenha dados da maquina, como processador, memoria, versao do windows? Parecido com o AIDA.

Rafael Colucci


Colutti

Colutti

Curtidas 0

Respostas

Cebikyn

Cebikyn

10/05/2004

Informações sobre o processador (velocidade, fabriancante, Instruction Set, etc...):
http://www.swissdelphicenter.ch/en/showcode.php?id=2044

Memória RAM total e disponível:
http://www.swissdelphicenter.ch/en/showcode.php?id=94

Versão do WIndows:
http://www.swissdelphicenter.ch/en/showcode.php?id=1126

Se precisar ainda mais, o site indicado ofere um recurso de pesquisa, em que vc pode obter muito mais códigos fonte interessantes.


GOSTEI 0
Colutti

Colutti

10/05/2004

Cara ... o bicho que vc me passou ..
porem com esta funcao eu nao sei qual a velocidade do processador ... os dados aparecem muito em baixo nivel ...


Rafael


GOSTEI 0
Cebikyn

Cebikyn

10/05/2004

Velocidade do Processador:

uses 
  Registry; 

function GetCpuSpeed: string; 
var 
  Reg: TRegistry; 
begin 
  Reg := TRegistry.Create; 
  try 
    Reg.RootKey := HKEY_LOCAL_MACHINE; 
    if Reg.OpenKey(´Hardware\Description\System\CentralProcessor\0´, False) then 
    begin 
      Result := IntToStr(Reg.ReadInteger(´~MHz´)) + ´ MHz´; 
      Reg.CloseKey; 
    end; 
  finally 
    Reg.Free; 
  end; 
end;


Eu tinha uma em assembler que pega a velocidade real, mas tá em casa...


GOSTEI 0
Colutti

Colutti

10/05/2004

opa

esta funcao ate funciona, porem so no windows 2000 pra cima. no windows 98 e 95 nao existe esta chave no registro.

Rafael


GOSTEI 0
Cebikyn

Cebikyn

10/05/2004

Então pode usar esta outra que pega a velocidade real do processador, através de trechos em assembler:

function GetCPUSpeed: Double;
const
  DelayTime = 500;
var
  TimerHi, TimerLo: DWORD;
  PriorityClass, Priority: Integer;
begin
  PriorityClass := GetPriorityClass(GetCurrentProcess);
  Priority := GetThreadPriority(GetCurrentThread);

  SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
  SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);

  Sleep(10);
  asm
    dw 310Fh // rdtsc
    mov TimerLo, eax
    mov TimerHi, edx
  end;
  Sleep(DelayTime);
  asm
    dw 310Fh // rdtsc
    sub eax, TimerLo
    sbb edx, TimerHi
    mov TimerLo, eax
    mov TimerHi, edx
  end;


  SetThreadPriority(GetCurrentThread, Priority);
  SetPriorityClass(GetCurrentProcess, PriorityClass);

  Result := TimerLo / (1000.0 * DelayTime);
end;



GOSTEI 0
POSTAR