|
2003-9-16
获得代码执行时间使用Windows API 函数GetTickCount,GetTickCount 函数返回从启动Windows后消逝的毫秒数。如果函数成 功的返回,返回值就是从启动Windows后消逝的毫秒数。 举例如下: procedure TForm1.Button1Click(Sender: TObject); i:Longint; starttime,endtime:Double; Const clock_tick:double=1000; Begin i:=0; starttime:=GetTickCount; While (i<10000000) do i:=i+1; endtime:=GetTickCount-starttime; ShowMessage(Format('循环执行时间:%0.2f 秒',[endtime/clock_tick])); End; 热门文章
推荐信息
|