Timer.h

Go to the documentation of this file.
00001 /* ex: set tabstop=4 expandtab: */
00002 /*                                                                                                                      */
00003 /*  (c) 2004-2006 Iowa State University                                         */
00004 /*      see the LICENSE file in the top level directory         */
00005 /*                                                                                                                      */
00010 
00011 #ifndef TIMER_H__
00012 #define TIMER_H__
00013 
00014 #include "define.h"
00015 #include <string>
00016 #include <ostream>
00017 #include <sys/time.h> //for timeval struct
00018 
00019 
00022 class Timer {
00023         public:
00027                 Timer();
00028                 
00030                 Timer(const Timer& rhs);
00031                 
00033                 Timer& operator=(const Timer& rhs);
00034                 
00036                 void start();
00037                 
00039                 void stop();
00040                 
00042                 void reset();
00043                 
00046                 double getDiffMicroseconds();
00047                 
00050                 double getDiffMilliseconds();
00051                 
00054                 double getDiffSeconds();
00055 
00057         void swap() {
00058             timeval temp = endTime_;
00059             endTime_ = startTime_;
00060             startTime_ = temp;
00061             return;
00062         }
00063 
00066         time_t getLastStopped() { return endTime_.tv_sec; }
00067         private:
00069                 timeval startTime_;
00070                 
00072                 timeval endTime_;
00073 };
00074 
00075 #endif

Generated on Wed Mar 8 14:43:31 2006 for Fountain by  doxygen 1.4.6