MultiAgentDecisionProcess
|
Timing provides a simple way of timing code. More...
#include <Timing.h>
Classes | |
struct | Times |
Stores the start and end of a timespan, in clock cycles. More... | |
Public Member Functions | |
void | AddEvent (const std::string &id, clock_t duration) |
Adds event of certain duration, e.g., an external program call. More... | |
std::vector< double > | GetEventDurations (const std::string &id) const |
Returns all stored durations (in s) for a particular event. More... | |
std::vector< double > | GetRunningEventDurations (const std::string &id) const |
Returns how long ago (in s) a particular event has been started. More... | |
void | Load (const std::string &filename) |
Load timing info from file filename. More... | |
void | Print () const |
Print stored timing info. More... | |
void | PrintSummary () const |
Sums data and prints out a summary. More... | |
void | Save (const std::string &filename) const |
Save collected timing info to file filename. More... | |
void | Save (std::ofstream &of) const |
Save collected timing info to ofstream of. More... | |
void | Start (const std::string &id) |
Start to time an event identified by id. More... | |
void | Stop (const std::string &id) |
Stop to time an event identified by id. More... | |
Timing () | |
(default) Constructor More... | |
~Timing () | |
Destructor. More... | |
Private Member Functions | |
double | ClockToSeconds (clock_t clockTicks) const |
clock_t | GetCpuTime () const |
void | Stop (const std::string &id, clock_t duration) |
Private Attributes | |
clock_t | _m_timeAtInitialization |
The clock cycle at which the class is initialized. More... | |
std::map< std::string, std::vector< Times > > | _m_timesMap |
Keeps track of timing info. More... | |
Timing provides a simple way of timing code.
struct Timing::Times |
Timing::Timing | ( | ) |
(default) Constructor
Timing::~Timing | ( | ) |
Destructor.
void Timing::AddEvent | ( | const std::string & | id, |
clock_t | duration | ||
) |
Adds event of certain duration, e.g., an external program call.
|
private |
|
private |
vector< double > Timing::GetEventDurations | ( | const std::string & | id | ) | const |
Returns all stored durations (in s) for a particular event.
Referenced by AlphaVectorPlanning::Prune().
vector< double > Timing::GetRunningEventDurations | ( | const std::string & | id | ) | const |
Returns how long ago (in s) a particular event has been started.
void Timing::Load | ( | const std::string & | filename | ) |
Load timing info from file filename.
References Timing::Times::end, Timing::Times::hasEnded, and Timing::Times::start.
void Timing::Print | ( | ) | const |
Print stored timing info.
void Timing::PrintSummary | ( | ) | const |
Sums data and prints out a summary.
Referenced by TreeIncPruneBGPlanner::BackupStage(), and QBGPlanner_TreeIncPruneBnB::BackupStage().
void Timing::Save | ( | const std::string & | filename | ) | const |
Save collected timing info to file filename.
void Timing::Save | ( | std::ofstream & | of | ) | const |
Save collected timing info to ofstream of.
void Timing::Start | ( | const std::string & | id | ) |
Start to time an event identified by id.
References Timing::Times::end, Timing::Times::hasEnded, and Timing::Times::start.
Referenced by TreeIncPruneBGPlanner::BackupStage(), QBGPlanner_TreeIncPruneBnB::BackupStage(), and AlphaVectorPlanning::Prune().
|
private |
void Timing::Stop | ( | const std::string & | id | ) |
Stop to time an event identified by id.
|
private |
The clock cycle at which the class is initialized.
|
private |
Keeps track of timing info.