Mesh Oriented datABase  (version 5.5.0)
An array-based unstructured mesh library
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

◆ CpuTimer()

moab::CpuTimer::CpuTimer ( )
inline

Definition at line 24 of file CpuTimer.hpp.

26  : mpi_initialized( 0 )
27 #endif
28  {
29 #ifdef MOAB_HAVE_MPI
30  int flag = 0;
31  if( MPI_SUCCESS == MPI_Initialized( &flag ) && flag )
32  {
33  mpi_initialized = 1;
34  }
35 #endif
36  tAtBirth = runtime();
37  tAtLast = tAtBirth;
38  }

References runtime(), tAtBirth, and tAtLast.

Member Function Documentation

◆ runtime()

double moab::CpuTimer::runtime ( )
inlineprivate

Definition at line 50 of file CpuTimer.hpp.

51 {
52 #ifdef MOAB_HAVE_MPI
53  if( mpi_initialized )
54  return MPI_Wtime();
55  else
56  return (double)clock() / CLOCKS_PER_SEC;
57 #else
58  return (double)clock() / CLOCKS_PER_SEC;
59 #endif
60 }

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

◆ time_elapsed()

◆ time_since_birth()

double moab::CpuTimer::time_since_birth ( )
inline

Member Data Documentation

◆ tAtBirth

double moab::CpuTimer::tAtBirth
private

Definition at line 20 of file CpuTimer.hpp.

Referenced by CpuTimer(), and time_since_birth().

◆ tAtLast

double moab::CpuTimer::tAtLast
private

Definition at line 20 of file CpuTimer.hpp.

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


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