#include <Stopwatch.h>
Public Member Functions | |
Stopwatch () | |
Creates an instance of the stopwatch that is zeroed and not running. | |
void | reset () |
Resets and stops the stopwatch. | |
void | start () |
Starts the stopwatch. | |
void | stop () |
Stops the stopwatch. | |
void | lap () |
void | print (string title) |
longType | timeMS () |
Gets the time in milliseconds. | |
longType | timeUS () |
Gets the time in microseconds. | |
bool | isRunning () |
Returns true if the stopwatch is running and false otherwise. | |
string | toString () |
Gets the time formatted as a string. | |
void | operator= (const Stopwatch &rhs) |
Sets two objects equal. | |
Stopwatch | operator+ (Stopwatch &rhs) |
Returns a stopwatch which contains the total time from two stopwatch objects. | |
Static Public Attributes | |
static MPI_Datatype | MPI_TYPE |
The MPI data type for a Stopwatch. | |
static MPI_Op | MPI_REDUCE |
The MPI operation for performing MPI_Reduce on Stopwatch objects. | |
Static Private Member Functions | |
static void | buildMpiType () |
Build MPI_TYPE. | |
static void | buildMpiReduce () |
Build MPI_REDUCE. | |
static void | Reduce_Function (Stopwatch *in, Stopwatch *inout, int *len, MPI_Datatype *dptr) |
An MPI function which allows MPI_Reduce to be used in adding Stopwatches. | |
Private Attributes | |
longType | stime1 |
longType | stime2 |
longType | result_us |
longType | total_us |
microType | micro1 |
microType | micro2 |
bool | running |
longType | average_us |
int | numSamples |
struct timeval | tp |
struct timezone | tz |
Static Private Attributes | |
static bool | mpiTypeCreated = false |
A flag which tells if MPI_TYPE has been generated. | |
Friends | |
ostream & | operator<< (ostream &strm, Stopwatch &watch) |
Formats and prints the time to a stream. |
Definition at line 106 of file Stopwatch.h.
Stopwatch::Stopwatch | ( | ) |
Creates an instance of the stopwatch that is zeroed and not running.
Definition at line 34 of file Stopwatch.cpp.
References buildMpiReduce(), buildMpiType(), mpiTypeCreated, reset(), and tz.
void Stopwatch::reset | ( | ) |
Resets and stops the stopwatch.
Definition at line 51 of file Stopwatch.cpp.
References average_us, micro1, numSamples, running, stime1, and total_us.
Referenced by QMCSlater::evaluate(), QMCSCFJastrow::evaluate(), QMCJastrow::evaluate(), CKGeneticAlgorithm1::generateNewPopulation(), CKGeneticAlgorithm1::initializePopulation(), QMCStopwatches::reset(), Stopwatch(), and QMCExtendedProperties::zeroOut().
void Stopwatch::start | ( | ) |
Starts the stopwatch.
Definition at line 62 of file Stopwatch.cpp.
References micro1, running, stime1, tp, and tz.
Referenced by QMCSlater::evaluate(), QMCSCFJastrow::evaluate(), QMCJastrow::evaluate(), QMCManager::gatherDensities(), QMCManager::gatherExtraProperties(), QMCManager::gatherForces(), QMCManager::gatherHistograms(), QMCManager::gatherProperties(), CKGeneticAlgorithm1::generateNewPopulation(), QMCManager::initializeCalculationState(), CKGeneticAlgorithm1::initializePopulation(), QMCManager::optimize(), QMCManager::pollForACommand(), qmcbeaver(), QMCManager::QMCManager(), QMCManager::run(), QMCManager::sendAllProcessorsACommand(), QMCEquilibrationArray::startTimers(), QMCManager::synchronizationBarrier(), and QMCManager::synchronizeDMCEnsemble().
void Stopwatch::stop | ( | ) |
Stops the stopwatch.
Definition at line 80 of file Stopwatch.cpp.
References micro1, micro2, result_us, running, stime1, stime2, total_us, tp, and tz.
Referenced by QMCSlater::evaluate(), QMCSCFJastrow::evaluate(), QMCJastrow::evaluate(), QMCManager::gatherDensities(), QMCManager::gatherExtraProperties(), QMCManager::gatherForces(), QMCManager::gatherHistograms(), QMCManager::gatherProperties(), CKGeneticAlgorithm1::generateNewPopulation(), QMCManager::initializeCalculationState(), CKGeneticAlgorithm1::initializePopulation(), QMCManager::optimize(), QMCManager::pollForACommand(), qmcbeaver(), QMCManager::run(), QMCManager::sendAllProcessorsACommand(), QMCStopwatches::stop(), QMCEquilibrationArray::stopTimers(), QMCManager::synchronizationBarrier(), and QMCManager::synchronizeDMCEnsemble().
void Stopwatch::lap | ( | ) |
Definition at line 102 of file Stopwatch.cpp.
References average_us, micro1, micro2, numSamples, result_us, running, stime1, stime2, total_us, tp, and tz.
void Stopwatch::print | ( | string | title | ) |
longType Stopwatch::timeMS | ( | ) |
Gets the time in milliseconds.
Definition at line 138 of file Stopwatch.cpp.
References total_us.
Referenced by toString().
longType Stopwatch::timeUS | ( | ) |
Gets the time in microseconds.
Definition at line 143 of file Stopwatch.cpp.
References total_us.
Referenced by QMCSlater::evaluate(), QMCSCFJastrow::evaluate(), QMCJastrow::evaluate(), operator<<(), and QMCManager::writeTimingData().
bool Stopwatch::isRunning | ( | ) |
Returns true if the stopwatch is running and false otherwise.
Definition at line 148 of file Stopwatch.cpp.
References running.
Referenced by QMCStopwatches::stop(), QMCEquilibrationArray::stopTimers(), and toString().
string Stopwatch::toString | ( | ) |
Gets the time formatted as a string.
Definition at line 153 of file Stopwatch.cpp.
References isRunning(), micro1, micro2, stime1, stime2, timeMS(), tp, and tz.
Referenced by operator<<().
void Stopwatch::operator= | ( | const Stopwatch & | rhs | ) |
Returns a stopwatch which contains the total time from two stopwatch objects.
Definition at line 189 of file Stopwatch.cpp.
void Stopwatch::buildMpiType | ( | ) | [static, private] |
Build MPI_TYPE.
Definition at line 217 of file Stopwatch.cpp.
References MPI_TYPE, and total_us.
Referenced by Stopwatch().
void Stopwatch::buildMpiReduce | ( | ) | [static, private] |
Build MPI_REDUCE.
Definition at line 211 of file Stopwatch.cpp.
References MPI_REDUCE, and Reduce_Function().
Referenced by Stopwatch().
void Stopwatch::Reduce_Function | ( | Stopwatch * | in, | |
Stopwatch * | inout, | |||
int * | len, | |||
MPI_Datatype * | dptr | |||
) | [static, private] |
An MPI function which allows MPI_Reduce to be used in adding Stopwatches.
Definition at line 246 of file Stopwatch.cpp.
Referenced by buildMpiReduce().
ostream& operator<< | ( | ostream & | strm, | |
Stopwatch & | watch | |||
) | [friend] |
longType Stopwatch::stime1 [private] |
Definition at line 109 of file Stopwatch.h.
Referenced by lap(), reset(), start(), stop(), and toString().
longType Stopwatch::stime2 [private] |
longType Stopwatch::result_us [private] |
longType Stopwatch::total_us [private] |
Definition at line 109 of file Stopwatch.h.
Referenced by buildMpiType(), lap(), operator+(), operator=(), print(), reset(), stop(), timeMS(), and timeUS().
microType Stopwatch::micro1 [private] |
Definition at line 110 of file Stopwatch.h.
Referenced by lap(), reset(), start(), stop(), and toString().
microType Stopwatch::micro2 [private] |
bool Stopwatch::running [private] |
Definition at line 111 of file Stopwatch.h.
Referenced by isRunning(), lap(), operator+(), reset(), start(), and stop().
longType Stopwatch::average_us [private] |
int Stopwatch::numSamples [private] |
struct timeval Stopwatch::tp [read, private] |
struct timezone Stopwatch::tz [read, private] |
Definition at line 117 of file Stopwatch.h.
Referenced by lap(), start(), stop(), Stopwatch(), and toString().
bool Stopwatch::mpiTypeCreated = false [static, private] |
A flag which tells if MPI_TYPE has been generated.
Definition at line 200 of file Stopwatch.h.
Referenced by Stopwatch().
MPI_Datatype Stopwatch::MPI_TYPE [static] |
The MPI data type for a Stopwatch.
Definition at line 228 of file Stopwatch.h.
Referenced by buildMpiType(), and QMCStopwatches::buildMpiType().
MPI_Op Stopwatch::MPI_REDUCE [static] |
The MPI operation for performing MPI_Reduce on Stopwatch objects.
Definition at line 235 of file Stopwatch.h.
Referenced by buildMpiReduce().