Code Monkey home page Code Monkey logo

epiktimer's Introduction


  Description: Precision timer/stopwatch component for Lazarus/FPC
  Author: Tom Lisjac <[email protected]>
  Contributors: Please see the Git repository commit history
  License: Modifyed LGPL (The same as Free Pascal RTL and LCL)
  Copyright (C) 2003-2006 by Tom Lisjac
  Latest version can be obtained at: http://wiki.lazarus.freepascal.org/EpikTimer

 Contents:

   1. The EpikTimer.pas component and palette icon
   2. ETPackage.lpk package for installation
   3. ETDemo demonstration app and host system clock evaluator
 
 -----------------------------------------------------------------

 The EpikTimer Component
  
  Documentation:
    See epiktimer.pas for detailed discussion of timebase sources, timing
    accuracy and clock correlation techniques that can provide traceable
    precision during long term measurements.
  
  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:
    
    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...
      
    See etdemo.pas for additional examples of component usage
     
 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 and compile it.
     
   Operation
   
     As the program comes up, it will create and initialize 10 invisible timer
     forms that can be spawned from the main program's Stopwatch group box. A
     progress bar is supposed to reduce the boredom.
     
     Host Hardware Information
     
       This group evaluates the host system and reports if it finds hardware
       support for the Pentium Time Stamp Counter. If so, you'll be able to get
       a snapshot of it's value along with the microsecond ticks from your
       OS clock. The sizes of the hardware and system ticks isn't as important
       as the rates that they change. On a Linux system, the system ticks value
       represent microseconds of Epoch time.
     
     Timebase Calibration
     
       If your system lacks the TSC or a microsecond resolution system clock,
       EpikTimer falls back to using gated measurements for setting the
       internal tick frequencies. Timing is non-deterministic when calling
       the Linux kernel so some averaging and smoothing of the resulting jitter
       is helpful. If EpikTimer is in this mode, long term accuracy isn't
       guaranteed... but short term comparitive measurements can still be made.
       
       Pressing "Calibrate" performs overhead extraction and gates the selected
       timebase against the best timebase gate available on a given host. The 
       results are displayed in the memo boxes.
       
    Timebase Correlation
    
       This is the default mode for measuring the TSC frequency and provides a
       reliable mechanism for synchronizing the TSC ticks to the system clock.
       If the system clock is maintained via NTP and the CorrelateTimebases
       method is called at regular intervals, the TSC stream can display the
       same long term accuracy (at very high resolutions) as the quality of
       the system's synchronizing time source.
       
    Timer/Stopwatch Functions
    
       This section implements a single stopwatch using the component's internal
       timer data record. The Spawn Timers group box will bring up the 10 timers
       that were created and initialized during program startup.
       

      ----------------- End of EpikTimer Release Documentation ------------------
   

epiktimer's People

Contributors

graemeg avatar long-arith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epiktimer's Issues

Compiler messages

Hi!

Thank you for this component!

Not a big problem, but I got these messages when I install this (latest svn:28) package on Lazarus 1.8.5 x86 on Windows7 x64:

compile:

Compile package etpackage 1.0.1: Success, Hints: 5
epiktimer.pas(396,33) Hint: Function result variable does not seem to be initialized
epiktimer.pas(317,3) Hint: Local const "NanoPerSec" is not used
epiktimer.pas(318,3) Hint: Local const "NanoPerMilli" is not used
epiktimer.pas(320,3) Hint: Local const "USecPerSec" is not used
epiktimer.pas(70,12) Hint: Unit "mmsystem" not used in EpikTimer

install:

Messages, Warnings: 2, Hints: 4
Note: Duplicate unit "splash" in "etpackage 1.0.1", source="C:\lazarus\components\epiktimer_svn\splash.pas"
Note: Duplicate unit "splash" in "#IDE", ppu="C:\lazarus\lazarus\units\i386-win32\win32\splash.ppu", source="C:\lazarus\lazarus\ide\splash.pp"
Note: Duplicate unit "main" in "etpackage 1.0.1", source="C:\lazarus\components\epiktimer_svn\main.pas"
Note: Duplicate unit "main" in "#IDE", ppu="C:\lazarus\lazarus\units\i386-win32\win32\main.ppu", source="C:\lazarus\lazarus\ide\main.pp"
Warning: Duplicate file "splash.lfm" in "#IDE", path="C:\lazarus\lazarus\units\i386-win32\win32\splash.lfm"
Warning: Duplicate file "splash.lfm" in "etpackage 1.0.1", path="C:\lazarus\components\epiktimer_svn\splash.lfm"
Build IDE

I think need "mmsystem" remove from the units, and simple demo-files rename (and put the demo to the separate directory?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.