Autor Beitrag
Johannes Maier
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 173

Win XP
D7 Prof
BeitragVerfasst: Sa 13.11.04 13:05 
Hallo,

gibt es bestimmte Tools, die messen, wie lange ein Programm braucht, bis es ausgeführt ist? Oder muss ich das irgendwie selbst timen?
Da ganze bräuchte ich, um herauszufinden, ob mit Assembler optimierte Codestellen die Geschwindigkeit relevant verändern. Wie macht ihr das, wenn ich irgendwo lese, "2,3 ms zur Berechnung gebraucht" oder so in der Art ;)

Danke schonmal im Voraus
Johannes

_________________
MfG
Johannes ehem. jbmaier
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Sa 13.11.04 13:14 
Johannes Maier hat folgendes geschrieben:
Wie macht ihr das, wenn ich irgendwo lese, "2,3 ms zur Berechnung gebraucht"


Zu dieser Frage: QueryPerformanceCounter (o.ä.). Auf die erste Frage wüsst ich auf Anhieb keine Antwort

AXMD
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 13.11.04 20:47 
Das erstere kannst du dir relativ einfach bauen:

1. Programm:
Mit CreateProcess dein zu testendes Programm starten
Zeitmessung vor CreateProcess beginnen

2. Programm:
Im OnIdle-Ereignis sendest du an das erste Programm eine Windows-Message und deaktivierst damit die Zeitmessung. Im ersten Programm brauchst du dann nur noch die gemessene Zeit ausgeben.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Johannes Maier Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 173

Win XP
D7 Prof
BeitragVerfasst: So 14.11.04 12:38 
OK danke für die Tipps. Da ich das QueryCounterDing nicht kenne, halte ich mich an Lösung zwei 8) Die hört sich auch nicht so schwer an :)

_________________
MfG
Johannes ehem. jbmaier
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 14.11.04 22:15 
Die zweite Möglichkeit ist auch nicht kompliziert

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
    T1,T2,T3:Int64;
begin
    QueryPerformanceCounter(T1);
    DoSomething;
    QueryPerformanceCounter(T2);
    QueryPerformanceFrequency(T3);
    Time := FloatToStr((T2-T1) / D3);
End;

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.