MOAB: Mesh Oriented datABase  (version 5.4.1)
MBMesquite::StopWatch Class Reference

#include <MsqTimer.hpp>

Public Member Functions

 StopWatch ()
void start ()
void stop ()
void reset ()
double total_time () const
int number_of_starts () const
 Returns the number of times this StopWatch has been started.

Private Attributes

bool isRunning
double timeAtLastStart
double totalTime
int numStarts

Detailed Description

Definition at line 65 of file MsqTimer.hpp.


Constructor & Destructor Documentation

Definition at line 70 of file MsqTimer.hpp.

: isRunning( false ), totalTime( 0.0 ), numStarts( 0 ) {}

Member Function Documentation

Returns the number of times this StopWatch has been started.

Definition at line 90 of file MsqTimer.hpp.

    {
        return numStarts;
    }

Definition at line 113 of file MsqTimer.cpp.

{
    isRunning = false;
    totalTime = 0;
    numStarts = 0;
}

Definition at line 94 of file MsqTimer.cpp.

{
    if( !isRunning )
    {
        isRunning       = true;
        timeAtLastStart = now();
        ++numStarts;
    }
}

Definition at line 104 of file MsqTimer.cpp.

{
    if( isRunning )
    {
        isRunning = false;
        totalTime += now() - timeAtLastStart;
    }
}

Definition at line 120 of file MsqTimer.cpp.

{
    double rv = totalTime;
    if( isRunning ) rv += now() - timeAtLastStart;
    return rv;
}

Member Data Documentation

Definition at line 96 of file MsqTimer.hpp.

Definition at line 99 of file MsqTimer.hpp.

Definition at line 97 of file MsqTimer.hpp.

Definition at line 98 of file MsqTimer.hpp.

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines