Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Timer.h

Go to the documentation of this file.
00001 /*
00002     File:           Timer.h
00003 
00004     Function:       Provides routines for timing under several different 
00005                     architectures. You must define one of the following:
00006                 
00007                         UNIX_TIME       Use the time() and times() calls
00008                         ANSI_TIME       Use the ansi clock() routine
00009                         SGI_TIME        Use the SGI multimedia timing 
00010                                         routines (nano-second accuracy.)
00011                         RUSAGE_TIME     Use getrusage() system call 
00012         
00013     Author(s):      Andrew Willmott
00014 
00015     Copyright:      (c) 1995-2000, Andrew Willmott
00016  */
00017 
00018 #ifndef __Timer__
00019 #define __Timer__
00020 
00021 #include "cl/Basics.h"
00022 
00023 // Account for the morons who coded X11
00024 #ifdef CurrentTime
00025 #undef CurrentTime
00026 #endif
00027 
00028 class Timer
00029 // all times in seconds. 
00030 {
00031 public:
00032     Timer() : startTime(0.0), stopTime(0.0), lapTime(0.0)
00033     {};
00034 
00035     Void    StartTimer();   // Starts timer
00036     Void    StopTimer();    // Stops timer
00037     Void    ContTimer();    // Continue timer
00038     Float   GetTimer();     // Returns time since timer was started
00039 
00040     Float   DeltaTime();    // returns time delta since DeltaTime
00041                             // or StartTimer was last called
00042 
00043     virtual Float   CurrentTime() = 0;
00044 
00045 protected:
00046     Float   startTime;
00047     Float   stopTime;
00048     Float   lapTime;
00049 };
00050 
00051 class ProgramTimer : public Timer
00052 // measures elapsed program time.
00053 {
00054 public:
00055     ProgramTimer() : Timer(), addSystem(false)
00056     {};
00057     
00058     Float   CurrentTime();
00059 
00060     Bool    addSystem;
00061 };
00062 
00063 class WallClockTimer : public Timer
00064 // measures wall clock time.
00065 {
00066 public:
00067     Float   CurrentTime();
00068 };
00069 
00070 #endif

Generated at Sat Aug 5 00:16:33 2000 for Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000