MultiAgentDecisionProcess
Release 0.2.1
|
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. | |
std::vector< double > | GetEventDurations (const std::string &id) |
Returns all stored durations (in s) for a particular event. | |
void | Load (const std::string &filename) |
Load timing info from file filename. | |
void | Print () const |
Print stored timing info. | |
void | PrintSummary () const |
Sums data and prints out a summary. | |
void | Save (const std::string &filename) const |
Save collected timing info to file filename. | |
void | Save (std::ofstream &of) const |
Save collected timing info to ofstream of. | |
void | Start (const std::string &id) |
Start to time an event identified by id. | |
void | Stop (const std::string &id) |
Stop to time an event identified by id. | |
Timing () | |
(default) Constructor | |
~Timing () | |
Destructor. |
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. | |
std::map< std::string, std::vector< Times > > | _m_timesMap |
Keeps track of timing info. |
Timing::Timing | ( | ) |
(default) Constructor
Definition at line 36 of file Timing.cpp.
Timing::~Timing | ( | ) |
Destructor.
Definition at line 42 of file Timing.cpp.
void Timing::AddEvent | ( | const std::string & | id, |
clock_t | duration | ||
) |
Adds event of certain duration, e.g., an external program call.
Definition at line 232 of file Timing.cpp.
|
private |
Definition at line 227 of file Timing.cpp.
|
private |
Definition at line 217 of file Timing.cpp.
vector< double > Timing::GetEventDurations | ( | const std::string & | id | ) |
Returns all stored durations (in s) for a particular event.
Definition at line 238 of file Timing.cpp.
void Timing::Load | ( | const std::string & | filename | ) |
Load timing info from file filename.
Definition at line 178 of file Timing.cpp.
References Timing::Times::end, and Timing::Times::start.
void Timing::Print | ( | ) | const |
Print stored timing info.
Definition at line 78 of file Timing.cpp.
void Timing::PrintSummary | ( | ) | const |
Sums data and prints out a summary.
Definition at line 103 of file Timing.cpp.
void Timing::Save | ( | const std::string & | filename | ) | const |
Save collected timing info to file filename.
Definition at line 146 of file Timing.cpp.
void Timing::Save | ( | std::ofstream & | of | ) | const |
Save collected timing info to ofstream of.
Definition at line 159 of file Timing.cpp.
void Timing::Start | ( | const std::string & | id | ) |
Start to time an event identified by id.
Definition at line 46 of file Timing.cpp.
References Timing::Times::end, Timing::Times::hasEnded, and Timing::Times::start.
|
private |
Definition at line 55 of file Timing.cpp.
void Timing::Stop | ( | const std::string & | id | ) |
Stop to time an event identified by id.
Definition at line 73 of file Timing.cpp.
|
private |
|
private |