From ebe1635016e6cc6f493ad1d0dcb75d94434bbecf Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Fri, 16 Aug 2013 00:46:54 +0000 Subject: [PATCH] Using TBB timers for wall time --- gtsam/base/timing.cpp | 9 +++++++-- gtsam/base/timing.h | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gtsam/base/timing.cpp b/gtsam/base/timing.cpp index bd9a719b5..8f6f9f346 100644 --- a/gtsam/base/timing.cpp +++ b/gtsam/base/timing.cpp @@ -51,7 +51,8 @@ void TimingOutline::add(size_t usecs, size_t usecsWall) { /* ************************************************************************* */ TimingOutline::TimingOutline(const std::string& label, size_t myId) : - myId_(myId), t_(0), tWall_(0), t2_(0.0), tIt_(0), tMax_(0), tMin_(0), n_(0), myOrder_(0), lastChildOrder_(0), label_(label) + myId_(myId), t_(0), tWall_(0), t2_(0.0), tIt_(0), tMax_(0), tMin_(0), n_(0), + myOrder_(0), lastChildOrder_(0), label_(label) { #ifdef GTSAM_USING_NEW_BOOST_TIMERS timer_.stop(); @@ -157,6 +158,7 @@ void TimingOutline::ticInternal() { timer_.restart(); *timerActive_ = true; #endif + tbbTimer_ = tbb::tick_count::now(); } /* ************************************************************************* */ @@ -164,7 +166,10 @@ void TimingOutline::tocInternal() { #ifdef GTSAM_USING_NEW_BOOST_TIMERS assert(!timer_.is_stopped()); timer_.stop(); - add((timer_.elapsed().user + timer_.elapsed().system) / 1000, timer_.elapsed().wall / 1000); + add((timer_.elapsed().user + timer_.elapsed().system) / 1000, + //timer_.elapsed().wall / 1000 + size_t((tbb::tick_count::now() - tbbTimer_).seconds() * 1e6) + ); #else assert(timerActive_); double elapsed = timer_.elapsed(); diff --git a/gtsam/base/timing.h b/gtsam/base/timing.h index 22392ce00..68dba5f28 100644 --- a/gtsam/base/timing.h +++ b/gtsam/base/timing.h @@ -37,6 +37,11 @@ #include #endif +#include +#undef min +#undef max +#undef ERROR + namespace gtsam { namespace internal { @@ -66,6 +71,7 @@ namespace gtsam { boost::timer timer_; gtsam::ValueWithDefault timerActive_; #endif + tbb::tick_count tbbTimer_; void add(size_t usecs, size_t usecsWall); public: TimingOutline(const std::string& label, size_t myId);