Если Вам необходимо не только "вычислить" частоту процессора, а и узнать о процессоре как можно больше, пожалуйста, пользуйтесь следующим модулем:
unit ExpandCPUInfo; interface type TCPUInfo = packed recordIDString : array [0..11] of Char;Stepping : Integer;Model : Integer;Family : Integer;FPU,VirtualModeExtensions,DebuggingExtensions,PageSizeExtensions,TimeStampCounter,K86ModelSpecificRegisters,MachineCheckException,CMPXCHG8B,APIC,MemoryTypeRangeRegisters,GlobalPagingExtension,ConditionalMoveInstruction,MMX : Boolean;SYSCALLandSYSRET,FPConditionalMoveInstruction,AMD3DNow : Boolean;CPUName : String;end;{информация об идентификации процессора} function ExistCPUID:Boolean; function CPUIDInfo(out info: TCPUInfo):Boolean; {инф-я о технологии процессора} function ExistMMX:Boolean; function Exist3DNow:Boolean; function ExistKNI:Boolean; {------------------------} procedure EMMS; procedure FEMMS; procedure PREFETCH(p: Pointer); register; implementation function ExistCPUID : Boolean; asm pushfdpop eaxmov ebx, eaxxor eax, 00200000hpush eaxpopfdpushfdpop ecxmov eax,0cmp ecx, ebxjz @NO_CPUIDinc eax@NO_CPUID: end; function CPUIDInfo(out info: TCPUIDInfo):Boolean; function ExistExtendedCPUIDFunctions:Boolean;asmmov eax,080000000hdb $0F,$A2end;var name : array [0..47] of Char;p : Pointer;begin if ExistCPUID then asmjmp @Start@BitLoop:mov al,dland al,1mov [edi],alshr edx,1inc ediloop @BitLoopret@Start:mov edi,infomov eax,0db $0F,$A2mov [edi],ebxmov [edi+4],edxmov [edi+8],ecxmov eax,1db $0F,$A2mov ebx,eaxand eax,0fh;mov [edi+12],eax;shr ebx,4mov eax,ebxand eax,0fhmov [edi+12+4],eaxshr ebx,4mov eax,ebxand eax,0fhmov [edi+12+8],eaxadd edi,24mov ecx,6call @BitLoopshr edx,1mov ecx,3call @BitLoopshr edx,2mov ecx,2call @BitLoopshr edx,1mov ecx,1call @BitLoopshr edx,7mov ecx,1call @BitLoopmov p,ediend;if (info.IDString = 'AuthenticAMD') and ExistExtendedCPUIDFunctions then beginasmmov edi,pmov eax,080000001hdb $0F,$A2mov eax,edxshr eax,11and al,1mov [edi],almov eax,edxshr eax,16and al,1mov [edi+1],almov eax,edxshr eax,31and al,1mov [edi+2],allea edi,namemov eax,0mov [edi],eaxmov eax,080000000hdb $0F,$A2cmp eax,080000004hjl @NoStringmov eax,080000002hdb $0F,$A2mov [edi],eaxmov [edi+4],ebxmov [edi+8],ecxmov [edi+12],edxadd edi,16mov eax,080000003hdb $0F,$A2mov [edi],eaxmov [edi+4],ebxmov [edi+8],ecxmov [edi+12],edxadd edi,16mov eax,080000004hdb $0F,$A2mov [edi],eaxmov [edi+4],ebxmov [edi+8],ecxmov [edi+12],edx@NoString:end;info.CPUName:=name;end else with info do beginSYSCALLandSYSRET:=False;FPConditionalMoveInstruction:=False;AMD3DNow:=False;CPUName:='';end;Result:=ExistCPUID;end; function ExistMMX:Boolean; var info : TCPUIDInfo;begin if CPUIDInfo(info) thenResult:=info.MMXelseResult:=False;end; function Exist3DNow:Boolean; var info : TCPUIDInfo;begin if CPUIDInfo(info) thenResult:=info.AMD3DNowelseResult:=False;end; function ExistKNI:Boolean; begin Result:=False;end; procedure EMMS; asm db $0F,$77end; procedure FEMMS; asm db $0F,$03end; procedure PREFETCH(p: Pointer); register; asm // PREFETCH byte ptr [eax]end; end. |