An open source method of characteristics neutron transport code.
|
The Timer class is for timing and profiling regions of code. More...
#include "src/Timer.cpp"
Public Member Functions | |
Timer () | |
Constructor sets the current split elapsed time to zero. | |
virtual | ~Timer () |
Destructor. | |
void | startTimer () |
Starts the Timer. More... | |
void | stopTimer () |
Stops the Timer. More... | |
void | recordSplit (const char *msg) |
Records a message corresponding to a time for the current split. More... | |
double | getTime () |
Returns the time elapsed from startTimer() to stopTimer(). More... | |
double | getSplit (const char *msg) |
Returns the time associated with a particular split. More... | |
void | printSplits () |
Prints the times and messages for each split to the console. More... | |
void | clearSplit (const char *msg) |
Clears the time split for this message and deletes the message's entry in the Timer's splits log. More... | |
void | clearSplits () |
Clears all times split messages from the Timer. | |
void | processMemUsage (double &vm_usage, double &resident_set) |
Read memory usage file (on a HPC installation), and process it to make it more readable. Used for profiling. More... | |
Static Public Member Functions | |
static Timer * | Get () |
Returns a static instance of the Timer class. More... | |
The Timer class is for timing and profiling regions of code.
void Timer::clearSplit | ( | const char * | msg | ) |
Clears the time split for this message and deletes the message's entry in the Timer's splits log.
msg | the message tag for the split |
|
inlinestatic |
double Timer::getSplit | ( | const char * | msg | ) |
Returns the time associated with a particular split.
If the split does not exist, returns 0.
msg | the message tag for the split |
double Timer::getTime | ( | ) |
Returns the time elapsed from startTimer() to stopTimer().
void Timer::printSplits | ( | ) |
Prints the times and messages for each split to the console.
This method will loop through all of the Timer's splits and print a formatted message string (80 characters in length) to the console with the message and the time corresponding to that message.
void Timer::processMemUsage | ( | double & | vm_usage, |
double & | resident_set | ||
) |
Read memory usage file (on a HPC installation), and process it to make it more readable. Used for profiling.
vm_usage | total use of virtual memory |
resident_set | total use of resident memory |
void Timer::recordSplit | ( | const char * | msg | ) |
Records a message corresponding to a time for the current split.
When this method is called it assumes that the Timer has been stopped and has the current time for the process corresponding to the message.
msg | a msg corresponding to this time split |
void Timer::startTimer | ( | ) |
Starts the Timer.
This method is similar to starting a stopwatch.
void Timer::stopTimer | ( | ) |
Stops the Timer.
This method is similar to stopping a stopwatch.