OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
Classes | Public Member Functions | List of all members
InternalZGY::SummaryTimer Class Reference

Hold the timing results from zero or more Timer instances. More...

#include <timer.h>

Inheritance diagram for InternalZGY::SummaryTimer:
InternalZGY::SummaryPrintingTimer

Classes

class  Impl
 

Public Member Functions

 SummaryTimer (const char *name)
 
 SummaryTimer (const SummaryTimer &)=delete
 
SummaryTimeroperator= (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...
 

Detailed Description

Hold the timing results from zero or more Timer instances.

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.

void SomeFunction() {
static SummaryPrintingTimer pt("MyTimer");
SimpleTimer tt(pt);
// timing the following code...
}

Member Function Documentation

◆ add() [1/2]

void InternalZGY::SummaryTimer::add ( const Timer t)

Add the contents of the specified Timer to our summary.

The caller is responsible for stopping the timer first.

◆ add() [2/2]

void InternalZGY::SummaryTimer::add ( int  count,
double  total,
double  last 
)

Add the contents of the specified Timer to our summary.

The information to add is passed as discrete arguments, so it is possible to e.g. add an managed timer to an umanaged one.

◆ reset()

void InternalZGY::SummaryTimer::reset ( )

Clear all counters.

The timer name is unchanged.


The documentation for this class was generated from the following files: