Reverted using boost chrono because chrono is not available on boost <1.47
parent
bef45d5b7b
commit
fd592dd689
|
@ -100,7 +100,7 @@ endif()
|
|||
if(CYGWIN OR MSVC OR WIN32)
|
||||
set(Boost_USE_STATIC_LIBS 1)
|
||||
endif()
|
||||
find_package(Boost 1.40 COMPONENTS serialization system chrono filesystem thread REQUIRED)
|
||||
find_package(Boost 1.40 COMPONENTS serialization system filesystem thread REQUIRED)
|
||||
|
||||
# General build settings
|
||||
include_directories(
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sys/time.h>
|
||||
#include <stdlib.h>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
@ -152,13 +153,15 @@ const boost::shared_ptr<TimingOutline>& TimingOutline::child(size_t child, const
|
|||
void TimingOutline::tic() {
|
||||
assert(!timerActive_);
|
||||
timerActive_ = true;
|
||||
t0_ = clock_t::now();
|
||||
gettimeofday(&t0_, NULL);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
void TimingOutline::toc() {
|
||||
struct timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
assert(timerActive_);
|
||||
add(boost::chrono::duration_cast<duration_t>(clock_t::now() - t0_).count());
|
||||
add(t.tv_sec*1000000 + t.tv_usec - (t0_.tv_sec*1000000 + t0_.tv_usec));
|
||||
timerActive_ = false;
|
||||
}
|
||||
|
||||
|
@ -241,11 +244,9 @@ void Timing::print() {
|
|||
|
||||
/* ************************************************************************* */
|
||||
double _tic_() {
|
||||
typedef boost::chrono::high_resolution_clock clock_t;
|
||||
typedef boost::chrono::duration<double> duration_t;
|
||||
|
||||
clock_t::time_point t = clock_t::now();
|
||||
return boost::chrono::duration_cast< duration_t >(t.time_since_epoch()).count();
|
||||
struct timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
return ((double)t.tv_sec + ((double)t.tv_usec)/1000000.);
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <vector>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/chrono.hpp>
|
||||
|
||||
class TimingOutline;
|
||||
extern boost::shared_ptr<TimingOutline> timingRoot;
|
||||
|
@ -30,9 +29,6 @@ extern boost::weak_ptr<TimingOutline> timingCurrent;
|
|||
|
||||
class TimingOutline {
|
||||
protected:
|
||||
typedef boost::chrono::high_resolution_clock clock_t;
|
||||
typedef boost::chrono::microseconds duration_t;
|
||||
|
||||
size_t t_;
|
||||
double t2_ ; /* cache the \sum t_i^2 */
|
||||
size_t tIt_;
|
||||
|
@ -43,7 +39,7 @@ protected:
|
|||
|
||||
boost::weak_ptr<TimingOutline> parent_;
|
||||
std::vector<boost::shared_ptr<TimingOutline> > children_;
|
||||
clock_t::time_point t0_;
|
||||
struct timeval t0_;
|
||||
bool timerActive_;
|
||||
|
||||
void add(size_t usecs);
|
||||
|
|
Loading…
Reference in New Issue