MultiAgentDecisionProcess
TimedAlgorithm Class Reference

TimedAlgorithm allows for easy timekeeping of parts of an algorithm. More...

#include <TimedAlgorithm.h>

Inheritance diagram for TimedAlgorithm:
[legend]

Public Member Functions

void AddTimedEvent (const std::string &id, clock_t duration)
 Adds event of certain duration, e.g., an external program call. More...
 
std::vector< double > GetTimedEventDurations (const std::string &id)
 Returns all stored durations (in s) for a particular event. More...
 
void LoadTimers (const std::string &filename)
 Load timing info from file filename. More...
 
void PrintTimers () const
 Print stored timing info. More...
 
void PrintTimersSummary () const
 Sums data and prints out a summary. More...
 
void SaveTimers (const std::string &filename) const
 Save collected timing info to file filename. More...
 
void SaveTimers (std::ofstream &of) const
 Save collected timing info to ofstream of. More...
 
void StartTimer (const std::string &id) const
 Start to time an event identified by id. More...
 
void StopTimer (const std::string &id) const
 Stop to time an event identified by id. More...
 
 TimedAlgorithm ()
 (default) Constructor More...
 
virtual ~TimedAlgorithm ()
 Destructor. More...
 

Private Attributes

Timing_m_timer
 Stores the timing info. More...
 

Detailed Description

TimedAlgorithm allows for easy timekeeping of parts of an algorithm.

Constructor & Destructor Documentation

TimedAlgorithm::TimedAlgorithm ( )

(default) Constructor

TimedAlgorithm::~TimedAlgorithm ( )
virtual

Destructor.

Member Function Documentation

void TimedAlgorithm::AddTimedEvent ( const std::string &  id,
clock_t  duration 
)

Adds event of certain duration, e.g., an external program call.

vector< double > TimedAlgorithm::GetTimedEventDurations ( const std::string &  id)

Returns all stored durations (in s) for a particular event.

void TimedAlgorithm::LoadTimers ( const std::string &  filename)

Load timing info from file filename.

void TimedAlgorithm::PrintTimers ( ) const

Print stored timing info.

void TimedAlgorithm::PrintTimersSummary ( ) const
void TimedAlgorithm::SaveTimers ( const std::string &  filename) const

Save collected timing info to file filename.

Referenced by GeneralizedMAAStarPlanner::Plan(), Perseus::PlanEndOfIteration(), and Perseus::PlanLeadOut().

void TimedAlgorithm::SaveTimers ( std::ofstream &  of) const

Save collected timing info to ofstream of.

Member Data Documentation

Timing* TimedAlgorithm::_m_timer
private

Stores the timing info.