|
OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
|
SummaryTimer that prints its result when going out of scope. More...
#include <timer.h>
Public Member Functions | |
| SummaryPrintingTimer (const char *name) | |
| virtual void | print () |
Public Member Functions inherited from InternalZGY::SummaryTimer | |
| SummaryTimer (const char *name) | |
| SummaryTimer (const SummaryTimer &)=delete | |
| SummaryTimer & | operator= (const SummaryTimer &)=delete |
| double | getFrequency () const |
| int | getCount () const |
| double | getTotal () const |
| double | getLast () const |
| const char * | getName () const |
| const char * | getValue (bool details, bool msonly) const |
| void | reset () |
| Clear all counters. More... | |
| void | add (int count, double total, double last) |
| Add the contents of the specified Timer to our summary. More... | |
| void | add (const Timer &t) |
| Add the contents of the specified Timer to our summary. More... | |
SummaryTimer that prints its result when going out of scope.
SimpleTimer is normally short lived. The SimpleTimer constructor takes a SummaryTimer as an argument. When the SimpleTimer goes out of scope the result is added to the accumulate timer. The caller is responsible for not allowing the SummaryTimer to go out of scope before the SimpleTimer does.
There is also a SummaryPrintingTimer class that extends SummaryTimer to print a single line report when it goes out of scope.
Note that Timer and SimpleTimer are not designed to be threadsafe. This makes no sense when measuring a single piece of code execution. SummaryTimer::add() is threadsafe. This means the following example with the SummaryTimer being shared among threads will work. The example measures every execution of the function and prints a report on application exit.
1.8.17