Difference between revisions of "EpikTimer/fr"

From Free Pascal wiki
Jump to navigationJump to search
m (Fixed syntax highlighting)
 
(6 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
===  A propos ===
 
===  A propos ===
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).
+
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).
  
 
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é.
 
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é.
Line 15: Line 15:
 
*Marcel Minderhoud
 
*Marcel Minderhoud
  
=== License ===
+
=== Licence ===
[http://www.opensource.org/licenses/lgpl-license.php LGPL] (please contact the author if the LGPL doesn't work with your project licensing)
+
[http://www.opensource.org/licenses/lgpl-license.php LGPL] (veuillez contacter l'auteur si la licence LGPL ne correspond pas avec la licence de votre projet)
+
 
 
===Subversion===
 
===Subversion===
  
Line 24: Line 24:
 
</pre>
 
</pre>
  
=== Download ===
+
=== Téléchargement ===
The latest stable release can be found on the [http://sourceforge.net/project/showfiles.php?group_id=92177 Lazarus CCR Files page] or [http://sourceforge.net/project/showfiles.php?group_id=92177&package_id=98235 here].
+
La dernière version stable peut être trouvée sur la [http://sourceforge.net/project/showfiles.php?group_id=92177 page des fichiers Lazarus CCR ] ou [http://sourceforge.net/project/showfiles.php?group_id=92177&package_id=98235 ici].
  
Status: Production/Stable
+
Statut: Production/Stable
  
 
=== Change Log ===
 
=== Change Log ===
Line 54: Line 54:
 
# Tested on AMD64 (linux)
 
# Tested on AMD64 (linux)
  
=== Dependencies / System Requirements ===
+
=== Dépendances / Configuration requise ===
* Nanosecond resolution is supported on Intel Pentium versions with a Timestamp Counter.
+
* la  résolution nanoseconde est prise en charge sur les versions Intel Pentium avec un compteur d'évènements dans le temps.
* Microsecond system clock is the default timebase.
+
* l'horloge système microseconde est la base de temps par défaut.
  
Tested on:
+
Testé sur:
  
* Pentium IV 3,2Mhz on Windows and Linux with great precision (~ 3,220,000,000 ticks per second)
+
* Pentium IV 3,2Mhz sur Windows et Linux avec une grande précision (~ 3,220,000,000 impulsions par seconde)
* Pentium 233Mhz with Damn Small Linux. Works great with hardware clock.
+
* Pentium 233Mhz avec Damn Small Linux. Fonctionne merveilleusement avec l'horloge matérielle.
* Mobile AMD 64 Athlon 3200+ on Windows XP Home (32 bit), Lazarus 9.13
+
* Mobile AMD 64 Athlon 3200+ sur Windows XP Home (32 bit), Lazarus 9.13
* AMD 64 CPU, running 64 bit version of Ubuntu Linux, Lazarus 9.18.
+
* AMD 64 CPU, exécution de la version 64 bit d'Ubuntu Linux, Lazarus 9.18.
  
Issues: Needs testing on FreeBSD and older machines that lack TSC hardware.
+
Issues: Besoins de test sur FreeBSD et de plus vieilles machines qui manquent de matériel TSC.
  
 
=== Installation ===
 
=== Installation ===
Line 77: Line 77:
  
 
'''If the timer is named ET'''
 
'''If the timer is named ET'''
<delphi>
+
<syntaxhighlight lang=pascal>
 
uses epiktimer;
 
uses epiktimer;
  
Line 105: Line 105:
 
   TimedSection4:=ET.Elapsed; //keep counting... tap the elapsed
 
   TimedSection4:=ET.Elapsed; //keep counting... tap the elapsed
 
   ET.clear // done... timer is stopped and zeroed
 
   ET.clear // done... timer is stopped and zeroed
end;</delphi>
+
end;</syntaxhighlight>
  
 
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:
 
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:
  
<delphi>Function TimedExecution: Extended;
+
<syntaxhighlight lang=pascal>Function TimedExecution: Extended;
 
Var  
 
Var  
 
   DiskAccessTime:TimerData;
 
   DiskAccessTime:TimerData;
Line 117: Line 117:
 
   ExecuteTheTimedSection;
 
   ExecuteTheTimedSection;
 
   Result:=ET.Elapsed(DiskAccessTimer); // the timer keeps running...
 
   Result:=ET.Elapsed(DiskAccessTimer); // the timer keeps running...
   etc...</delphi>
+
   etc...</syntaxhighlight>
  
 
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.
 
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.
  
<delphi>DelayInSeconds := 8.5; // or any value
+
<syntaxhighlight lang=pascal>DelayInSeconds := 8.5; // or any value
 
OldTime := ET.Elapse;
 
OldTime := ET.Elapse;
  
Line 129: Line 129:
 
end;
 
end;
  
// DelayInSeconds has elapsed and now you can continue executing the code</delphi>
+
// DelayInSeconds has elapsed and now you can continue executing the code</syntaxhighlight>
  
 
See etdemo.pas for additional examples of component usage
 
See etdemo.pas for additional examples of component usage
Line 137: Line 137:
 
EpikTimer can be used to profile the speed of procedures:
 
EpikTimer can be used to profile the speed of procedures:
  
<delphi>
+
<syntaxhighlight lang=pascal>
 
uses
 
uses
 
   {$ifdef PROFILING}epiktimer,{$endif}
 
   {$ifdef PROFILING}epiktimer,{$endif}
Line 175: Line 175:
 
   {$endif}
 
   {$endif}
 
end;
 
end;
</delphi>
+
</syntaxhighlight>
  
 
=== The ETDemo Application ===
 
=== The ETDemo Application ===
Line 190: Line 190:
 
This page has been converted from epikwiki. Original content by [[User:VlxAdmin|Tom Lisjac]].
 
This page has been converted from epikwiki. Original content by [[User:VlxAdmin|Tom Lisjac]].
  
[[Category:Components]]
+
[[Category:Components/fr]]

Latest revision as of 12:19, 14 February 2020

Deutsch (de) English (en) français (fr) русский (ru)

A propos

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).

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é.

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.

Auteur

Tom Lisjac

Contributeurs

Licence

LGPL (veuillez contacter l'auteur si la licence LGPL ne correspond pas avec la licence de votre projet)

Subversion

svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/epiktimer epiktimer

Téléchargement

La dernière version stable peut être trouvée sur la page des fichiers Lazarus CCR ou ici.

Statut: Production/Stable

Change Log

  • Initially written on 24-06-2003 TL
  • Pre-release 30-06-2003 TL - Needs testing on the BSD's and Win32
  • Version 0.1 1-7-2003 TL
  1. initial beta release
  • Version 0.2 3-7-2003 TL
  1. Revised logic around hardware detection to prevent executing extended instructions if the HasCapabilityData call returns false.
  2. Removed exposed low level diagnositic functions from unit interface.
  3. Revised demo.
  • Version 0.3 15-11-2005
  1. Updated 0.2 version to make it compile on the latest Lazarus (0.9.10).
  2. Added LCL to the required packages.
  3. Changed mode to Delphi in order to compile.
  4. Changed windows timebase to use QueryPerformanceCounter, because has a much greater precision then GetSystemTime.
  5. Added changes to ensure the component compiles on Delphi 7.0
  6. Made tests on Windows and Linux
  7. Small changes to the demo to make it compile
  • Version 1.0 06-10-2006
  1. Changes for 64 bits operation
  2. Added units BaseUnix, Unix and UnixUtil, removed oldlinux (obsolete)
  3. Gettimeofday -> fpGettimeofday
  4. Changed systemsleep for 64 bits systems
  5. Some changes in timeval
  6. Tested on AMD64 (linux)

Dépendances / Configuration requise

  • la résolution nanoseconde est prise en charge sur les versions Intel Pentium avec un compteur d'évènements dans le temps.
  • l'horloge système microseconde est la base de temps par défaut.

Testé sur:

  • Pentium IV 3,2Mhz sur Windows et Linux avec une grande précision (~ 3,220,000,000 impulsions par seconde)
  • Pentium 233Mhz avec Damn Small Linux. Fonctionne merveilleusement avec l'horloge matérielle.
  • Mobile AMD 64 Athlon 3200+ sur Windows XP Home (32 bit), Lazarus 9.13
  • AMD 64 CPU, exécution de la version 64 bit d'Ubuntu Linux, Lazarus 9.18.

Issues: Besoins de test sur FreeBSD et de plus vieilles machines qui manquent de matériel TSC.

Installation

  • In Components/Open Package File, open etpackage.lpk.
  • Compile the component to verify that everything is there.
  • Install and let Lazarus rebuild
  • Component will be in the System Palette (stopwatch-ruler icon)

Usage

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.

If the timer is named ET

uses epiktimer;

var
  ET: TEpikTimer;

procedure InitTimer;
begin
  ET := TEpikTimer.Create(Application);
end;

procedure InstrumentedCall;
Begin
  ET.Clear; // optional... timer is cleared at creation
  ET.Start;
  ExecuteFirstTimedSection;
  ET.Stop; // the timer is actually paused and can be restarted later
  TimedSection1:=ET.Elapsed; // store the elapsed in a global
  MakeAnUntimedOverheadCall; // not counted in the timer
  ET.Start; //resume the timer... continue accumulating ticks
  CallTimedSection2;
  TimedSection2:=ET.Elapsed; //timer keeps running... we've just sample it.
  CallTimedSection3;
  CallSomethingElse;
  TimedSection3:=ET.Elapsed; //keep counting... tap the elapsed
  CallTimedSection4;
  TimedSection4:=ET.Elapsed; //keep counting... tap the elapsed
  ET.clear // done... timer is stopped and zeroed
end;

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:

Function TimedExecution: Extended;
Var 
  DiskAccessTime:TimerData;
Begin
  ET.Clear(DiskAccessTimer); // Declared timers *must* be cleared before use. 
  ET.Start(DiskAccessTimer);
  ExecuteTheTimedSection;
  Result:=ET.Elapsed(DiskAccessTimer); // the timer keeps running...
  etc...

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.

DelayInSeconds := 8.5; // or any value
OldTime := ET.Elapse;

while ((ET.Elapsed - OldTime) < DelayInSeconds) do
begin
  ET.SystemSleep(10);
end;

// DelayInSeconds has elapsed and now you can continue executing the code

See etdemo.pas for additional examples of component usage

EpikTimer as a profiler

EpikTimer can be used to profile the speed of procedures:

uses
  {$ifdef PROFILING}epiktimer,{$endif}
  ...

type
  TMyClass = class
  private
    {$ifdef PROFILING}
    profiler: Tepiktimer;
    {$endif}
    ...
  end;

implementation

constructor TMyClass.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);

  ...

  {$ifdef CARDROOM_PROFILING}
  profiler := TEpikTimer.Create(Self)
  {$endif}
end;

procedure TMyClass.MethodToBeProfiled;
begin
  {$ifdef PROFILING}
  profiler.Clear;
  profiler.Start;
  {$endif}
  // do stuff
  {$ifdef PROFILING}
  OPDebugLn('TMyClass.MethodToBeProfiled ' + FloatToStr(profiler.Elapsed));
  {$endif}
end;

The ETDemo Application

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! :)

Installation

  • Open etdemo.lpi
  • compile
  • run

Original contributors

This page has been converted from epikwiki. Original content by Tom Lisjac.