From 97e2ac689e5958d551ed1b4743490cec5f4b6a78 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Thu, 5 Sep 2013 12:20:17 +0200 Subject: [PATCH] Fixed timings to collect absolute numbers and not CPU seconds --- Util/TimingUtil.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Util/TimingUtil.h b/Util/TimingUtil.h index cd32f4093..e7f0d1fd7 100644 --- a/Util/TimingUtil.h +++ b/Util/TimingUtil.h @@ -21,13 +21,18 @@ or see http://www.gnu.org/licenses/agpl.txt. #ifndef TIMINGUTIL_H_ #define TIMINGUTIL_H_ -#include +#include +#include -static boost::timer my_timer; +static boost::timer::cpu_timer my_timer; /** Returns a timestamp (now) in seconds (incl. a fractional part). */ static inline double get_timestamp() { - return my_timer.elapsed(); + boost::chrono::duration duration = boost::chrono::nanoseconds( + my_timer.elapsed().user + my_timer.elapsed().system + + my_timer.elapsed().wall + ); + return duration.count(); } #endif /* TIMINGUTIL_H_ */