The Original CHomP Software
|
A class that stores the time at which it was initialized and then returns or displays the time used since the initialization. More...
#include <timeused.h>
Public Member Functions | |
timeused (const char *msg=NULL) | |
The default constructor. More... | |
timeused (std::ostream &out, const char *msg=NULL) | |
~timeused () | |
The destructor. More... | |
timeused & | operator= (std::ostream &out) |
Defines an output stream for displaying program's running time at program's termination. More... | |
timeused & | operator= (outputstream &out) |
Defines an output stream for displaying program's running time at program's termination to a pair of streams. More... | |
timeused & | operator= (int n) |
Turns off writing program's running time at program's termination by assigning 0 to an object of this class. More... | |
timeused & | operator= (const char *msg) |
Changes the message displayed at program's termination. More... | |
timeused & | reset () |
Reset the timer to the current moment. More... | |
operator double () | |
Returns the time from the initialization measured in seconds. More... | |
void | show (std::ostream &out, const char *message=NULL) const |
Shows the time used from the beginning up to the current point. More... | |
void | show (const char *message=NULL) const |
Shows the time used from the beginning up to the current point to the standard output stream. More... | |
Protected Attributes | |
double | cpu0 |
CPU usage start time (in seconds). More... | |
std::time_t | t0 |
Start time (in seconds). More... | |
std::ostream * | outstream1 |
Output stream 1 (0 for no output). More... | |
std::ostream * | outstream2 |
Output stream 2 (0 for no output). More... | |
const char * | message |
A message to display instead of "Used time" (if not 0). More... | |
int | display |
Should the destructor display the time? Note: -1 makes the destructor display times only > 1 sec. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const timeused &t) |
Shows the time elapsed up to this point. More... | |
A class that stores the time at which it was initialized and then returns or displays the time used since the initialization.
It displays this time when the destructor is invoked, e.g., at the end of program run. This class is used in most of the CHomP programs to measure the time used for the computations.
Definition at line 66 of file timeused.h.
|
inline |
The default constructor.
It may be given a message to be displayed when the destructor is called.
Definition at line 137 of file timeused.h.
References display, message, outstream1, outstream2, and reset().
|
inline |
Definition at line 147 of file timeused.h.
References display, message, outstream1, outstream2, and reset().
|
inline |
The destructor.
Definition at line 169 of file timeused.h.
References display, outstream1, outstream2, and show().
chomp::homology::timeused::operator double | ( | ) |
Returns the time from the initialization measured in seconds.
|
inline |
Changes the message displayed at program's termination.
Definition at line 211 of file timeused.h.
References message.
|
inline |
Turns off writing program's running time at program's termination by assigning 0 to an object of this class.
Definition at line 205 of file timeused.h.
References display.
|
inline |
Defines an output stream for displaying program's running time at program's termination to a pair of streams.
Definition at line 191 of file timeused.h.
References outstream1, outstream2, and show().
|
inline |
Defines an output stream for displaying program's running time at program's termination.
Definition at line 183 of file timeused.h.
References outstream1, and outstream2.
timeused & chomp::homology::timeused::reset | ( | ) |
Reset the timer to the current moment.
Referenced by timeused().
|
inline |
Shows the time used from the beginning up to the current point to the standard output stream.
The time is preceded with the message (default: "Time used").
Definition at line 217 of file timeused.h.
References outstream1, outstream2, and show().
|
inline |
Shows the time used from the beginning up to the current point.
The time is preceded with the message (default: "Time used").
Definition at line 157 of file timeused.h.
References message.
Referenced by operator=(), show(), and ~timeused().
|
friend |
Shows the time elapsed up to this point.
|
protected |
CPU usage start time (in seconds).
Definition at line 115 of file timeused.h.
|
protected |
Should the destructor display the time? Note: -1 makes the destructor display times only > 1 sec.
Definition at line 131 of file timeused.h.
Referenced by operator=(), timeused(), and ~timeused().
|
protected |
A message to display instead of "Used time" (if not 0).
Definition at line 127 of file timeused.h.
Referenced by operator=(), show(), and timeused().
|
protected |
Output stream 1 (0 for no output).
Definition at line 121 of file timeused.h.
Referenced by operator=(), show(), timeused(), and ~timeused().
|
protected |
Output stream 2 (0 for no output).
Definition at line 124 of file timeused.h.
Referenced by operator=(), show(), timeused(), and ~timeused().
|
protected |
Start time (in seconds).
Definition at line 118 of file timeused.h.