Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
moab::CpuTimer Class Reference

#include <CpuTimer.hpp>

Public Member Functions

 CpuTimer ()
double time_since_birth ()
double time_elapsed ()

Private Member Functions

double runtime ()

Private Attributes

double tAtBirth
double tAtLast

Detailed Description

Definition at line 14 of file CpuTimer.hpp.


Constructor & Destructor Documentation

Definition at line 24 of file CpuTimer.hpp.

References runtime(), tAtBirth, and tAtLast.

        : mpi_initialized( 0 )
#endif
    {
#ifdef MOAB_HAVE_MPI
        int flag = 0;
        if( MPI_SUCCESS == MPI_Initialized( &flag ) && flag )
        {
            mpi_initialized = 1;
        }
#endif
        tAtBirth = runtime();
        tAtLast  = tAtBirth;
    }

Member Function Documentation

double moab::CpuTimer::runtime ( ) [inline, private]

Definition at line 50 of file CpuTimer.hpp.

Referenced by CpuTimer(), time_elapsed(), and time_since_birth().

{
#ifdef MOAB_HAVE_MPI
    if( mpi_initialized )
        return MPI_Wtime();
    else
        return (double)clock() / CLOCKS_PER_SEC;
#else
    return (double)clock() / CLOCKS_PER_SEC;
#endif
}
double moab::CpuTimer::time_since_birth ( ) [inline]

Definition at line 39 of file CpuTimer.hpp.

References runtime(), tAtBirth, and tAtLast.

Referenced by moab::ReadHDF5::load_file(), ToolContext::timer_pop(), ToolContext::timer_push(), moab::DebugOutput::tprint(), and moab::WriteHDF5::write_file_impl().

    {
        return ( tAtLast = runtime() ) - tAtBirth;
    };

Member Data Documentation

double moab::CpuTimer::tAtBirth [private]

Definition at line 20 of file CpuTimer.hpp.

Referenced by CpuTimer(), and time_since_birth().

double moab::CpuTimer::tAtLast [private]

Definition at line 20 of file CpuTimer.hpp.

Referenced by CpuTimer(), time_elapsed(), and time_since_birth().

List of all members.


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