summaryrefslogtreecommitdiffstats
path: root/src/util/timeUtil.h
diff options
context:
space:
mode:
authorSebastian2010-05-12 19:42:27 +0200
committerSebastian2010-05-12 19:42:27 +0200
commitce3329047d378a14006ce74ec273ac59e3375303 (patch)
tree782430f270b4c7aca1b35d5b7813518e3797c555 /src/util/timeUtil.h
downloadpvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.gz
pvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.xz
pvs-ce3329047d378a14006ce74ec273ac59e3375303.zip
initial import of latest svn version
Diffstat (limited to 'src/util/timeUtil.h')
-rw-r--r--src/util/timeUtil.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/util/timeUtil.h b/src/util/timeUtil.h
new file mode 100644
index 0000000..90d647d
--- /dev/null
+++ b/src/util/timeUtil.h
@@ -0,0 +1,34 @@
+#ifndef TIME_UTIL
+#define TIME_UTIL
+
+#include <sys/time.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+#ifdef PROFILE
+#define startTime(aaa) TimeUtil aaa ## Time = TimeUtil(); aaa ## Time.start();
+#define endTime(aaa) aaa ## Time.stop(); printf("Time to execute " #aaa " : %ld\n", aaa ## Time.getMS());
+#endif
+
+#ifndef PROFILE
+#define startTime(aaa)
+#define endTime(aaa)
+#endif
+
+
+
+class TimeUtil
+{
+
+public:
+ TimeUtil();
+ void start();
+ void stop();
+ long getMS();
+private:
+ long mtime, seconds, useconds;
+ struct timeval Begin, End; //initialize Begin and End for the timer
+};
+
+#endif