arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

Timer.h

Go to the documentation of this file.
00001 
00002 #ifndef  TIMER_H
00003 #define  TIMER_H
00004 
00005 /// TODO: make this work on linux!!!!
00006 
00007 #ifdef WIN32
00008 #include <windows.h>
00009 
00010 class  Timer {
00011 public:
00012    Timer(char *name, int id = -1);
00013    ~Timer(void);
00014 
00015    void     start(void);
00016    double   lap(char *event);
00017    double   et(void);
00018 
00019    ///////////////////////////////////////////
00020    /// report times?
00021    void     silent()  { _verbose = false; }
00022    void     verbose() { _verbose = true; }
00023 
00024 private:
00025    LARGE_INTEGER     startTime;
00026    LARGE_INTEGER     lastTime;
00027    double            resolution;
00028    char             *name;
00029    int               lapCount;
00030    int               id;
00031 
00032    bool              _verbose;
00033 };
00034 
00035 #else //endif windows, else linux
00036 /// TODO: this is crap, need to make one class for both platforms
00037 
00038 class  Timer {
00039 public:
00040    Timer(char *name, int id = -1){}
00041    ~Timer(void){}
00042 
00043    void     start(void){}
00044    double   lap(char *event){}
00045    double   et(void){}
00046 
00047    ///////////////////////////////////////////
00048    /// report times?
00049    void     silent()  { _verbose = false; }
00050    void     verbose() { _verbose = true; }
00051 
00052 private:
00053    ///LARGE_INTEGER     startTime;
00054    ///LARGE_INTEGER     lastTime;
00055    double            resolution;
00056    char             *name;
00057    int               lapCount;
00058    int               id;
00059 
00060    bool              _verbose;
00061 };
00062 
00063 #endif /// else linux
00064 
00065 #endif

Send questions, comments, and bug reports to:
jmk