• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ibrcommon/ibrcommon/TimeMeasurement.h

Go to the documentation of this file.
00001 /*
00002  * TimeMeasurement.h
00003  *
00004  *  Created on: 20.01.2010
00005  *      Author: morgenro
00006  */
00007 
00008 #ifndef TIMEMEASUREMENT_H_
00009 #define TIMEMEASUREMENT_H_
00010 
00011 #include <time.h>
00012 #include <iostream>
00013 #include <sys/types.h>
00014 
00015 namespace ibrcommon
00016 {
00017         class TimeMeasurement
00018         {
00019         public:
00020                 TimeMeasurement();
00021                 virtual ~TimeMeasurement();
00022 
00023                 void start();
00024                 void stop();
00025 
00026                 float getMilliseconds();
00027                 float getSeconds();
00028 
00029                 friend std::ostream &operator<<(std::ostream &stream, TimeMeasurement &measurement);
00030 
00031                 static std::ostream& format(std::ostream &stream, const float value);
00032 
00033         private:
00034                 static int64_t timespecDiff(struct timespec *timeA_p, struct timespec *timeB_p);
00035 
00036                 struct timespec _start;
00037                 struct timespec _end;
00038         };
00039 }
00040 
00041 #endif /* TIMEMEASUREMENT_H_ */

Generated on Wed Mar 30 2011 11:11:49 for IBR-DTNSuite by  doxygen 1.7.1