| | |
Get the speed of your processor (CPU)
// The Windows form is simple, having only one button titled // "Click to get CPU speed" and a label to show the results // written for Delphi 3.0 (vegaseat) unit CPUspeedz; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Label1: TLabel; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} // get the speed of your CPU in MHz 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 mov TimerLo, eax mov TimerHi, edx end; Sleep(DelayTime); asm dw 310Fh sub eax, TimerLo sbb edx, TimerHi mov TimerLo, eax mov TimerHi, edx end; SetThreadPriority(GetCurrentThread, Priority); SetPriorityClass(GetCurrentProcess, PriorityClass); Result := TimerLo / (1000 * DelayTime); end; procedure TForm1.Button1Click(Sender: TObject); begin Label1.Caption := (Format('Your CPU speed: %f MHz', [GetCPUSpeed])); end; end.
0
•
•
•
•
Cool.
I've heard of the language but never had experience with it. Is it a proprietary language? Where could one get access to a compiler?
I've heard of the language but never had experience with it. Is it a proprietary language? Where could one get access to a compiler? 0
•
•
•
•
I think Borland gave one of the older versions (4?) of Delphi away for free. Check their site.
0
•
•
•
•
In September 2006 borland released a free version of the Delphi compiler.
Look for Turbo Delphi (explorer edition) on borland's website http://www.borland.com or CodeGear's website http://www.codegear.com
Eddie
P.S. CodeGear is a new company (2006) that I believe is owned by Borland. CodeGear is taking over development of some of Borland's developer tools (like Delphi).
Look for Turbo Delphi (explorer edition) on borland's website http://www.borland.com or CodeGear's website http://www.codegear.com
Eddie
P.S. CodeGear is a new company (2006) that I believe is owned by Borland. CodeGear is taking over development of some of Borland's developer tools (like Delphi).
Similar Threads
Other Threads in the Pascal and Delphi Forum
- help to speed up my processor! (Windows NT / 2000 / XP)
- Processor (cpu), Faced With Tough Choices, Which Is Better? Please Help Me!!! (Windows Vista and Windows 7)
- java code that display cpu ver, cpu speed and ram size. (Java)
- AMD-K6(tm)3D Processor speed query (Motherboards, CPUs and RAM)
- Processor clock speed project (Motherboards, CPUs and RAM)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: so...tutorials, tips and tricks, and many more....
- Next Thread: Synthesize a program
| Thread Tools | Search this Thread |
Tag cloud for Pascal and Delphi
animation api app array button compile console data database dbisam delete delphi delphihelpimageforloop documentcomplete2 edit environment error errors events file form function gdi gis lasrautoinc media navigatecomplete2 network object open opengl pascal passing path player procedure search set sql table twebbrowser username variable win7 windows



