Go to the documentation of this file.00001
00002
00003
00004
00005
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