Difference between revisions of "EpikTimer/de"

From Lazarus wiki
Jump to navigationJump to search
(Hälfte übersetzt.)
 
m
Line 4: Line 4:
 
=== Beschreibung ===
 
=== Beschreibung ===
  
EpikTimer ermöglicht dem Programmierer eine extrem genaue Zeitmessung - etwa für sehr kurz aufeinanderfolgende Ereignisse oder ähnliches. Epiktimer lässt sich einfach verwenden, verbraucht keine CPU-Resourcen und benötigt nur 25 bytes zusätzlichen RAM bei der Ausführung des Programms. Intern unterstützt diese Komponente einen einzigen Timer - extern kann jedoch eine beliebige Anzahl an Zeitmessungen deklariert und ausgeführt werden.
+
EpikTimer ermöglicht dem Programmierer eine extrem genaue Zeitmessung - etwa für sehr kurz aufeinanderfolgende Ereignisse oder ähnliches. Epiktimer lässt sich einfach verwenden, verbraucht keine CPU-Resourcen und benötigt nur 25 Bytes zusätzlichen RAM bei der Ausführung des Programms. Intern unterstützt diese Komponente einen einzigen Timer - extern kann jedoch eine beliebige Anzahl an Zeitmessungen deklariert und ausgeführt werden.
  
 
Die Komponente EpikTimer ist Plattformunabhängig und wurde spezielle für die Lazarus-IDE sowie den FreePascal-Compiler geschrieben.  
 
Die Komponente EpikTimer ist Plattformunabhängig und wurde spezielle für die Lazarus-IDE sowie den FreePascal-Compiler geschrieben.  
Line 19: Line 19:
 
   
 
   
 
=== Download ===
 
=== Download ===
Die Downloaddatei beeinhaltet die EpikTimer Kompinente, zugehörige Installationsroutinen sowie ein Beispielprogramm zur Illustration der Fähigkeiten der Komponente.
+
Die Downloaddatei beeinhaltet die EpikTimer Komponente, zugehörige Installationsroutinen sowie ein Beispielprogramm zur Illustration der Fähigkeiten der Komponente.
  
Die neuste stabilie Version kann auf der [http://sourceforge.net/project/showfiles.php?group_id=92177 Lazarus CCR-Dateien Website] oder [http://sourceforge.net/project/showfiles.php?group_id=92177&package_id=98235 hier] gefunden werden.
+
Die neuste stabile Version kann auf der [http://sourceforge.net/project/showfiles.php?group_id=92177 Lazarus CCR-Dateien Website] oder [http://sourceforge.net/project/showfiles.php?group_id=92177&package_id=98235 hier] gefunden werden.
  
 
Status: Production/Stable
 
Status: Production/Stable
Line 69: Line 69:
 
* Component will be in the System Palette (stopwatch-ruler icon)
 
* Component will be in the System Palette (stopwatch-ruler icon)
  
=== Usage ===
+
=== Verwendung ===
 
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.
 
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.
  
Line 120: Line 120:
 
See etdemo.pas for additional examples of component usage
 
See etdemo.pas for additional examples of component usage
  
=== The ETDemo Application ===
+
=== Die ETDemo Anwendung ===
 
The ETDemo application does not require EpikTimer to be installed in order
 
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
 
to compile and operate. I never liked having to install a palette full of

Revision as of 00:13, 16 February 2007

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

(Befindet sich in Übersetzung...)

Beschreibung

EpikTimer ermöglicht dem Programmierer eine extrem genaue Zeitmessung - etwa für sehr kurz aufeinanderfolgende Ereignisse oder ähnliches. Epiktimer lässt sich einfach verwenden, verbraucht keine CPU-Resourcen und benötigt nur 25 Bytes zusätzlichen RAM bei der Ausführung des Programms. Intern unterstützt diese Komponente einen einzigen Timer - extern kann jedoch eine beliebige Anzahl an Zeitmessungen deklariert und ausgeführt werden.

Die Komponente EpikTimer ist Plattformunabhängig und wurde spezielle für die Lazarus-IDE sowie den FreePascal-Compiler geschrieben.

Autor

Tom Lisjac

Unterstützer

Lizenz

LGPL (Kontaktieren Sie den Autor, wenn die LGPL unvereinbar mit Ihrem Projekt ist)

Download

Die Downloaddatei beeinhaltet die EpikTimer Komponente, zugehörige Installationsroutinen sowie ein Beispielprogramm zur Illustration der Fähigkeiten der Komponente.

Die neuste stabile Version kann auf der Lazarus CCR-Dateien Website oder hier gefunden werden.

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

Abhängigkeiten / Systemvoraussetzungen

  • Für eine nanosekundengenaue Zeitmessung wird eine Intel-Pentium-kompatible CPU mit einem "Timestamp Counter" benötigt.
  • Eine mikrosekundengenaue Zeitmessung wird auf allen Systemen unterstützt.

Getestet auf den folgenden Systemen:

  • Pentium IV 3,2Mhz (Unter Linux wie Windows mit großer Präzession (~ 3,220,000,000 ticks per second))
  • Pentium 233Mhz unter Damm Small Linux. Arbeitet mit hardware clock.
  • Mobile AMD 64 Athlon 3200+ unter Windows XP Home (32 bit), Lazarus 9.13
  • AMD 64 CPU, unter Ubuntu Linux 64 bit, Lazarus 9.18.

Issues: Muss noch unter FreeBSD sowie älteren Rechnern ohne TSC-Hardware getestet werden.

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)

Verwendung

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

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 is a given amount of time has elapsed before continuing with a task or to another iteration of the same task.

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

 while ((1000000.0 * (ET.Elapsed - OldTime)
  < DelayInSeconds)) do
 begin
   ET.SystemSleep(0);
 end;

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

See etdemo.pas for additional examples of component usage

Die ETDemo Anwendung

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

Orginal contributors

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