Autor Beitrag
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: So 27.04.03 17:56 
Hi

Wie kann ich berechnen, wie lange eine Funktion von Anfang bis Ende für das Ausführen braucht?


Zuletzt bearbeitet von Moritz M. am Mo 28.04.03 16:27, insgesamt 1-mal bearbeitet
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 27.04.03 18:10 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var
  t1, t2, res: TLargeInteger; 

begin
  QueryPerformanceFrequency(Res); 
  QueryPerformanceCounter(Zeit1); // Oder: Zeit1 := TimeGetTime;

  // ... Deine Routine;

  QueryPerformanceCounter(Zeit2); // Oder: Zeit2 := TimeGetTime;

  MessageDlg('Der Schleifendurchlauf dauerte: ' + Format('%g Sekunden.', 
    [(t2 - t1) / Res]));

end;


Siehe auch www.swissdelphicente.../showcode.php?id=498
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 28.04.03 15:26 
wie wäre es wenn du am anfang per GETTickCount die WIndows uptime in eine var reinmachst und am ende der procedure diesen wert von der aktuellen GetTickCount abziehst ?? dann bekommst du die dauer in MilliSec.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Moritz M. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Mo 28.04.03 16:27 
Habs schon rausgefunden. Danke für die Tipps.