Using TBB timers for wall time
parent
66eb9c9964
commit
ebe1635016
|
|
@ -51,7 +51,8 @@ void TimingOutline::add(size_t usecs, size_t usecsWall) {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TimingOutline::TimingOutline(const std::string& label, size_t myId) :
|
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
|
#ifdef GTSAM_USING_NEW_BOOST_TIMERS
|
||||||
timer_.stop();
|
timer_.stop();
|
||||||
|
|
@ -157,6 +158,7 @@ void TimingOutline::ticInternal() {
|
||||||
timer_.restart();
|
timer_.restart();
|
||||||
*timerActive_ = true;
|
*timerActive_ = true;
|
||||||
#endif
|
#endif
|
||||||
|
tbbTimer_ = tbb::tick_count::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
@ -164,7 +166,10 @@ void TimingOutline::tocInternal() {
|
||||||
#ifdef GTSAM_USING_NEW_BOOST_TIMERS
|
#ifdef GTSAM_USING_NEW_BOOST_TIMERS
|
||||||
assert(!timer_.is_stopped());
|
assert(!timer_.is_stopped());
|
||||||
timer_.stop();
|
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
|
#else
|
||||||
assert(timerActive_);
|
assert(timerActive_);
|
||||||
double elapsed = timer_.elapsed();
|
double elapsed = timer_.elapsed();
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@
|
||||||
#include <boost/timer.hpp>
|
#include <boost/timer.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <tbb/tick_count.h>
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
#undef ERROR
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
@ -66,6 +71,7 @@ namespace gtsam {
|
||||||
boost::timer timer_;
|
boost::timer timer_;
|
||||||
gtsam::ValueWithDefault<bool,false> timerActive_;
|
gtsam::ValueWithDefault<bool,false> timerActive_;
|
||||||
#endif
|
#endif
|
||||||
|
tbb::tick_count tbbTimer_;
|
||||||
void add(size_t usecs, size_t usecsWall);
|
void add(size_t usecs, size_t usecsWall);
|
||||||
public:
|
public:
|
||||||
TimingOutline(const std::string& label, size_t myId);
|
TimingOutline(const std::string& label, size_t myId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue