Sign in Join
Wiki copytemporary

EpikTimer/fr: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: EpikTimer/fr

OldNewLine
1+### A propos
2+
3+EpikTimer un chronomètre pour le programmeur qui est capable de mesurer des événements très court avec une précision traçable sur de longues périodes de temps. Il est simple à utiliser, consomme pratiquement pas de temps processeur et ne nécessite que 25 octets de RAM pour mettre en œuvre une instance de l'horloge. Le composant fournit un seul temporisateur interne... mais un nombre illimité peut être déclarée extérieurement et lié à un seul composant EpikTimer sur le formulaire(form).
4+
5+Le téléchargement contient le composant, un paquet d'installation et une application de démonstration, qui illustre les caractéristiques du composante ainsi que certains outils pour évaluer les sources d'horloge sur un système donné.
6+
7+Ce composant a été conçu pour des applications multi-plateformes et a été écrit spécifiquement pour l'IDE Lazarus et le compilateur Free Pascal et comprend une application de démonstration.
8+
9+### Auteur
10+
11+Tom Lisjac
12+
13+#### Contributeurs
14+
15+- Felipe Monteiro de Carvalho
16+- Marcel Minderhoud
17+
18+### Licence
19+
20+[LGPL](http://www.opensource.org/licenses/lgpl-license.php) (veuillez contacter l'auteur si la licence LGPL ne correspond pas avec la licence de votre projet)
21+
22+### Subversion
23+
24+ svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/epiktimer epiktimer
25+
26+### Téléchargement
27+
28+La dernière version stable peut être trouvée sur la [page des fichiers Lazarus CCR](http://sourceforge.net/project/showfiles.php?group_id=92177) ou [ici](http://sourceforge.net/project/showfiles.php?group_id=92177&package_id=98235).
29+
30+Statut: Production/Stable
31+
32+### Change Log
33+
34+- Initially written on 24-06-2003 TL
35+- Pre-release 30-06-2003 TL - Needs testing on the BSD's and Win32
36+- Version 0.1 1-7-2003 TL
37+
38+1. initial beta release
39+
40+- Version 0.2 3-7-2003 TL
41+
42+1. Revised logic around hardware detection to prevent executing extended instructions if the HasCapabilityData call returns false.
43+2. Removed exposed low level diagnositic functions from unit interface.
44+3. Revised demo.
45+
46+- Version 0.3 15-11-2005
47+
48+1. Updated 0.2 version to make it compile on the latest Lazarus (0.9.10).
49+2. Added LCL to the required packages.
50+3. Changed mode to Delphi in order to compile.
51+4. Changed windows timebase to use QueryPerformanceCounter, because has a much greater precision then GetSystemTime.
52+5. Added changes to ensure the component compiles on Delphi 7.0
53+6. Made tests on Windows and Linux
54+7. Small changes to the demo to make it compile
55+
56+- Version 1.0 06-10-2006
57+
58+1. Changes for 64 bits operation
59+2. Added units BaseUnix, Unix and UnixUtil, removed oldlinux (obsolete)
60+3. Gettimeofday -\> fpGettimeofday
61+4. Changed systemsleep for 64 bits systems
62+5. Some changes in timeval
63+6. Tested on AMD64 (linux)
64+
65+### Dépendances / Configuration requise
66+
67+- la résolution nanoseconde est prise en charge sur les versions Intel Pentium avec un compteur d'évènements dans le temps.
68+- l'horloge système microseconde est la base de temps par défaut.
69+
70+Testé sur:
71+
72+- Pentium IV 3,2Mhz sur Windows et Linux avec une grande précision (~ 3,220,000,000 impulsions par seconde)
73+- Pentium 233Mhz avec Damn Small Linux. Fonctionne merveilleusement avec l'horloge matérielle.
74+- Mobile AMD 64 Athlon 3200+ sur Windows XP Home (32 bit), Lazarus 9.13
75+- AMD 64 CPU, exécution de la version 64 bit d'Ubuntu Linux, Lazarus 9.18.
76+
77+Issues: Besoins de test sur FreeBSD et de plus vieilles machines qui manquent de matériel TSC.
78+
79+### Installation
80+
81+- In Components/Open Package File, open etpackage.lpk.
82+- Compile the component to verify that everything is there.
83+- Install and let Lazarus rebuild
84+- Component will be in the System Palette (stopwatch-ruler icon)
85+
86+### Usage
87+
88+Drop the component on a form. The component contains a single timer instance and parameterless calls to start, stop, elapsed and clear will implicitly reference it.
89+
90+**If the timer is named ET**
91+
92+``` pascal
93+uses epiktimer;
94+
95+var
96+ ET: TEpikTimer;
97+
98+procedure InitTimer;
99+begin
100+ ET := TEpikTimer.Create(Application);
101+end;
102+
103+procedure InstrumentedCall;
104+Begin
105+ ET.Clear; // optional... timer is cleared at creation
106+ ET.Start;
107+ ExecuteFirstTimedSection;
108+ ET.Stop; // the timer is actually paused and can be restarted later
109+ TimedSection1:=ET.Elapsed; // store the elapsed in a global
110+ MakeAnUntimedOverheadCall; // not counted in the timer
111+ ET.Start; //resume the timer... continue accumulating ticks
112+ CallTimedSection2;
113+ TimedSection2:=ET.Elapsed; //timer keeps running... we've just sample it.
114+ CallTimedSection3;
115+ CallSomethingElse;
116+ TimedSection3:=ET.Elapsed; //keep counting... tap the elapsed
117+ CallTimedSection4;
118+ TimedSection4:=ET.Elapsed; //keep counting... tap the elapsed
119+ ET.clear // done... timer is stopped and zeroed
120+end;
121+```
122+
123+You can also create any number of timers from a single component on the form by declaring a TimerData record and passing it as a parameter to start, stop, elapsed and clear using the overloaded methods in the component. An example would be:
124+
125+``` pascal
126+Function TimedExecution: Extended;
127+Var
128+ DiskAccessTime:TimerData;
129+Begin
130+ ET.Clear(DiskAccessTimer); // Declared timers *must* be cleared before use.
131+ ET.Start(DiskAccessTimer);
132+ ExecuteTheTimedSection;
133+ Result:=ET.Elapsed(DiskAccessTimer); // the timer keeps running...
134+ etc...
135+```
136+
137+One particular use for EpikTimer is checking if a given amount of time has elapsed before continuing with a task or to another iteration of the same task.
138+
139+``` pascal
140+DelayInSeconds := 8.5; // or any value
141+OldTime := ET.Elapse;
142+
143+while ((ET.Elapsed - OldTime) < DelayInSeconds) do
144+begin
145+ ET.SystemSleep(10);
146+end;
147+
148+// DelayInSeconds has elapsed and now you can continue executing the code
149+```
150+
151+See etdemo.pas for additional examples of component usage
152+
153+#### EpikTimer as a profiler
154+
155+EpikTimer can be used to profile the speed of procedures:
156+
157+``` pascal
158+uses
159+ {$ifdef PROFILING}epiktimer,{$endif}
160+ ...
161+
162+type
163+ TMyClass = class
164+ private
165+ {$ifdef PROFILING}
166+ profiler: Tepiktimer;
167+ {$endif}
168+ ...
169+ end;
170+
171+implementation
172+
173+constructor TMyClass.Create(AOwner: TComponent);
174+begin
175+ inherited Create(AOwner);
176+
177+ ...
178+
179+ {$ifdef CARDROOM_PROFILING}
180+ profiler := TEpikTimer.Create(Self)
181+ {$endif}
182+end;
183+
184+procedure TMyClass.MethodToBeProfiled;
185+begin
186+ {$ifdef PROFILING}
187+ profiler.Clear;
188+ profiler.Start;
189+ {$endif}
190+ // do stuff
191+ {$ifdef PROFILING}
192+ OPDebugLn('TMyClass.MethodToBeProfiled ' + FloatToStr(profiler.Elapsed));
193+ {$endif}
194+end;
195+```
196+
197+### The ETDemo Application
198+
199+The ETDemo application does not require EpikTimer to be installed in order to compile and operate. I never liked having to install a palette full of components only to find out that I didn't like any of them! :)
200+
201+**Installation**
202+
203+- Open etdemo.lpi
204+- compile
205+- run
206+
207+### Original contributors
208+
209+This page has been converted from epikwiki. Original content by Tom Lisjac.
210+
211+---
212+*From the Free Pascal wiki, page "EpikTimer/fr", as it stood on 2020-02-14 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
213+Category: Components/fr

Back to history