OpenLB 1.7
|
How to use in Code: More...
#include <timer.h>
Public Member Functions | |
Timer (int maxTimeSteps, std::size_t numFluidCells=1, unsigned int printModeSummary=0) | |
initializes timer with the given values, abbreviation to Timer() + initialize(int,int) | |
T | timevalDiffTimeMs (timeval end, timeval start) |
returns the time difference between two timeval objects in ms | |
T | getMLUPs () |
returns Million DESCRIPTOR Site Updates per second (all processes together) | |
T | getMLUPps () |
returns Million DESCRIPTOR Site Updates per second and process | |
T | getTotalMLUPs () |
returns average Million DESCRIPTOR Site Updates per second between start() and stop() | |
T | getTotalMLUPps () |
returns average Million DESCRIPTOR Site Updates per second and process between start() and stop() | |
void | start () |
(Re-)sets start value for time measurement. | |
void | update (int currentTimeStep) |
Updates all time values of interest during computation. | |
void | stop () |
Terminates time measurement and sets end value. | |
double | getTotalCpuTime () |
Returns the total cpu time in seconds between start() and stop(). | |
T | getTotalRealTime () |
Returns the total measured time between start() and stop() in seconds. | |
T | getTotalRealTimeMs () |
Returns the total measured time between start() and stop() in ms. | |
void | printStep (int printMode=0) |
Prints a one-line-summary of the values calculated in update() for use during computation. | |
void | printStep (OstreamManager &fout, int printMode=0) |
void | print (std::size_t currentTimeStep, int printMode=0) |
Performs an update() followed by a printStep(). | |
void | printSummary () |
Prints a (short) summary containing the overall time consumption in real and in cpu time for use after computation. | |
void | printSummary (OstreamManager &fout) |
void | printShortSummary () |
Prints a short summary containing only time consumptions (real and cpu time) | |
void | printShortSummary (OstreamManager &fout) |
How to use in Code:
Timer timer; timer.inizialize(); timer.start(); loop(i=1..iMax) { do_some_calculation(); timer.print(i); } end_loop; timer.stop(); timer.printSummary();
class for measurement of computation time
olb::util::Timer< T >::Timer | ( | int | maxTimeSteps, |
std::size_t | numFluidCells = 1, | ||
unsigned int | printModeSummary = 0 ) |
initializes timer with the given values, abbreviation to Timer() + initialize(int,int)
Definition at line 36 of file timer.hh.
T olb::util::Timer< T >::getMLUPps | ( | ) |
returns Million DESCRIPTOR Site Updates per second and process
Definition at line 62 of file timer.hh.
References olb::singleton::MpiManager::getSize(), olb::ompManager::getSize(), olb::singleton::mpi(), and olb::singleton::omp().
T olb::util::Timer< T >::getMLUPs | ( | ) |
returns Million DESCRIPTOR Site Updates per second (all processes together)
Definition at line 55 of file timer.hh.
double olb::util::Timer< T >::getTotalCpuTime | ( | ) |
T olb::util::Timer< T >::getTotalMLUPps | ( | ) |
returns average Million DESCRIPTOR Site Updates per second and process between start() and stop()
Definition at line 79 of file timer.hh.
References olb::singleton::MpiManager::getSize(), olb::ompManager::getSize(), olb::singleton::mpi(), and olb::singleton::omp().
T olb::util::Timer< T >::getTotalMLUPs | ( | ) |
T olb::util::Timer< T >::getTotalRealTime | ( | ) |
T olb::util::Timer< T >::getTotalRealTimeMs | ( | ) |
void olb::util::Timer< T >::print | ( | std::size_t | currentTimeStep, |
int | printMode = 0 ) |
Performs an update() followed by a printStep().
Automatically calls the function update(currentTimeStep) (if not yet done with currentTimeStep) and displays the timer's during-iteration-information.
currentTimeStep | current iteration value, e.g. i or iT |
printMode | mode of display style passed to printStep() |
Definition at line 152 of file timer.hh.
void olb::util::Timer< T >::printShortSummary | ( | ) |
Prints a short summary containing only time consumptions (real and cpu time)
Definition at line 244 of file timer.hh.
void olb::util::Timer< T >::printShortSummary | ( | OstreamManager & | fout | ) |
Definition at line 250 of file timer.hh.
void olb::util::Timer< T >::printStep | ( | int | printMode = 0 | ) |
Prints a one-line-summary of the values calculated in update() for use during computation.
Displays timer informations about current calculation with two different output modes. Before calling printStep() one should first recalculate all values with update().
printMode | Value for selecting style of output. 0 = default semicolon-separated single row mode without cpu-time 1 = single row mode without cpu-time 2 = nicely formatted two-line layout including current and remaining cpu-time |
void olb::util::Timer< T >::printStep | ( | OstreamManager & | fout, |
int | printMode = 0 ) |
Definition at line 167 of file timer.hh.
void olb::util::Timer< T >::printSummary | ( | ) |
Prints a (short) summary containing the overall time consumption in real and in cpu time for use after computation.
Definition at line 224 of file timer.hh.
void olb::util::Timer< T >::printSummary | ( | OstreamManager & | fout | ) |
Definition at line 230 of file timer.hh.
void olb::util::Timer< T >::start | ( | ) |
(Re-)sets start value for time measurement.
Definition at line 90 of file timer.hh.
void olb::util::Timer< T >::stop | ( | ) |
Terminates time measurement and sets end value.
It is necessary to call this function immediately after the computation loop has terminated. Otherwise printSummary() would display incorrect values.
Definition at line 126 of file timer.hh.
T olb::util::Timer< T >::timevalDiffTimeMs | ( | timeval | end, |
timeval | start ) |
returns the time difference between two timeval objects in ms
The timeval data type is used in the variables for ms-time measurement.
Definition at line 47 of file timer.hh.
void olb::util::Timer< T >::update | ( | int | currentTimeStep | ) |
Updates all time values of interest during computation.
i.e. elapsed time, remaining time and total time. Recommended to be used directly before printStep to output up-to-date values.
Definition at line 99 of file timer.hh.