aynı işi gören iki kod var. ben bunların hangisinin daha verimli çalıştığını nasıl anlayabilirim? timer nesnesindeki en küçük zaman 1 ms. olduğundan ikisi için de 0 ms çıkıyo. Milisaniyenin altına nasıl inilebilir?


tşk...
Kod: Tümünü seç
WinExec('command.com /c md c:\deneme',sw_Hide);
Kod: Tümünü seç
var St1: array[0..MAX_PATH-1] of Char;
..
St1:='c:\deneme';
CreateDirectory(St1, nil);
http://www.delphiforfun.org/Programs/De ... timing.htmhe best way I've found to implement accurate timing is to use QueryPerformanceCounter and QueryPerformanceFrequency procedures to access the hardware timer in Windows - typically with 1 microsecond (millionths of a second) resolution. It's easy to use, and and accurate. Beginners can get more information about these routines is to put the cursor on the routine name in Delphi and press F1 to bring up a Help screen. (This works for any Delphi component or language element by the way.)
Kod: Tümünü seç
procedure TForm1.Button1Click(Sender: TObject);
var
start,stop1,stop2,freq:int64;
i:integer;
begin
screen.cursor:=crHourGlass; {show busy cursor}
QueryPerformanceFrequency(freq); {Get frequency}
QueryPerformanceCounter(start); {Get initial count}
for i:=1 to 1000000 do; {empty loop}
QueryPerformanceCounter(stop1); {Get 1st end count}
for i:=1 to 1000000 do application.processmessages; {do it loop}
QueryPerformanceCounter(stop2); {Get 2nd end count}
screen.cursor:=crDefault; {show normal cursor}
If freq>0 {Display (loop2 count - loop1 count)/freq
to get time in microseconds}
then showmessage('Time for a call to processmessages is '
+ inttostr(((stop2-stop1)-(stop1-start)) div freq)
+' microseconds')
else showmessage('No hardware timer available');
end;