![]() |
Knight's Tour Generator
Tourneys and the Fast Generation and Obfuscation of Closed Knight's Tours
|
Timer for elapsed time and CPU time. More...
#include <Timer.h>
Public Member Functions | |
const char * | GetStartDateAndTime () |
Get start time and date. More... | |
const char * | GetCurrentDateAndTime () |
Get current time and date. More... | |
void | Start () |
Start timing. More... | |
float | GetElapsedTime () |
Get elapsed time in seconds. More... | |
float | GetCPUTime () |
Get CPU time in seconds. More... | |
void | Finish () |
Print CPU and elapsed time. More... | |
Private Member Functions | |
const char * | GetDateAndTime (const systime_point p) |
Get time and date. More... | |
UINT | CPUTime () |
Platform independent CPU time. More... | |
Private Attributes | |
systime_point | m_tpElapsedTimeStart |
Clock time. | |
float | m_fCPUTimeStart |
CPU time in seconds. | |
std::string | m_strTimeAndDate |
Container for time and date string. | |
The timer is charged with everything that is time-related, in particular, elapsed time, CPU time, and clock time. The member functions return time intervals measured from the time Start() is called to the current time. The CPU time reported is the total summed over all threads. Uses std::chrono to do the heavy lifting.
|
private |
void CTimer::Finish | ( | ) |
float CTimer::GetCPUTime | ( | ) |
const char * CTimer::GetCurrentDateAndTime | ( | ) |
Get the current date and time as a null-terminated string. Uses GetDateAndTime() to do the heavy lifting.
|
private |
Get time and date string into m_strTimeAndDate from a systime_point and return it as a null-terminated string. We're using a member variable to store an std::string so that its c_str() pointer is persistent.
p | An instance of systime_point. |
float CTimer::GetElapsedTime | ( | ) |
const char * CTimer::GetStartDateAndTime | ( | ) |
Get the start date and time as a null-terminated string. Uses GetDateAndTime() to do the heavy lifting.