/**
 ** \file misc/timer.hxx
 ** \brief Inline methods for misc/timer.hh.
 */

#ifndef MISC_TIMER_HXX
# define MISC_TIMER_HXX

# include "misc/timer.hxx"
# include "misc/contract.hh"

inline
void
Timer::push (int i)
{
  precondition (this->intmap.find (i) != this->intmap.end ());
  this->push (this->intmap[i]);
}

inline
void
Timer::pop (const std::string task_name)
{
  precondition (this->tasksmap[task_name] == this->tasks.top ());
  this->pop ();
}

inline
void
Timer::pop (const int i)
{
  this->pop (this->intmap[i]);
}


inline
void
Timer::dump_on_destruction (std::ostream &out)
{
  this->dump_stream = &out;
}

inline
void
Timer::start ()
{
  this->total.start ();
}

inline
void
Timer::stop ()
{
  this->total.stop ();
}

inline
Timer::Time::Time () :
  user (0), sys (0), wall (0)
{ }

inline
Timer::Time&
Timer::Time::operator += (const Time &rhs)
{
  this->wall += rhs.wall;
  this->user += rhs.user;
  this->sys += rhs.sys;
  return *this;
}

#endif // !MISC_TIMER_HXX
