moab
moab::CpuTimer Class Reference

#include <CpuTimer.hpp>

List of all members.

Public Member Functions

 CpuTimer ()
double time_since_birth ()
double time_elapsed ()
long mem_since_birth ()
long mem_elapsed ()
 CpuTimer ()
double since_birth ()
double elapsed ()

Private Member Functions

double runtime ()
long runmem ()

Private Attributes

double tAtBirth
double tAtLast
double mAtBirth
double mAtLast
long rssAtBirth
long rssAtLast
double atBirth
double atLast

Detailed Description

Definition at line 13 of file CpuTimer.hpp.


Constructor & Destructor Documentation

Definition at line 23 of file CpuTimer.hpp.

Definition at line 159 of file WriteHDF5Parallel.cpp.

: atBirth(MPI_Wtime()), atLast(MPI_Wtime()) {}

Member Function Documentation

double moab::CpuTimer::elapsed ( ) [inline]

Definition at line 161 of file WriteHDF5Parallel.cpp.

{ double tmp = atLast; return (atLast = MPI_Wtime()) - tmp; }
long moab::CpuTimer::mem_elapsed ( ) [inline]

Definition at line 27 of file CpuTimer.hpp.

{long tmp = mAtLast; return (mAtLast=runmem()) - tmp;}

Definition at line 26 of file CpuTimer.hpp.

{return (mAtLast=runmem()) - mAtBirth;}
long moab::CpuTimer::runmem ( ) [inline, private]

Definition at line 47 of file CpuTimer.hpp.

    {
#if defined(_MSC_VER) || defined(__MINGW32__)
      return 0;
#elif defined(USE_MPI)
      return 0;
#else
      struct rusage r_usage;
      getrusage(RUSAGE_SELF, &r_usage);
      mAtLast = r_usage.ru_maxrss;
      return mAtLast;
#endif
    }
double moab::CpuTimer::runtime ( ) [inline, private]

Definition at line 30 of file CpuTimer.hpp.

    {
#if defined(_MSC_VER) || defined(__MINGW32__)
      return (double)clock() / CLOCKS_PER_SEC;
#elif defined(USE_MPI)
      return MPI_Wtime();
#else      
      struct rusage r_usage;
      getrusage(RUSAGE_SELF, &r_usage);
      double utime = (double)r_usage.ru_utime.tv_sec +
          ((double)r_usage.ru_utime.tv_usec/1.e6);
      double stime = (double)r_usage.ru_stime.tv_sec +
          ((double)r_usage.ru_stime.tv_usec/1.e6);
      return utime + stime;
#endif
    }
double moab::CpuTimer::since_birth ( ) [inline]

Definition at line 160 of file WriteHDF5Parallel.cpp.

{ return (atLast = MPI_Wtime()) - atBirth; };
double moab::CpuTimer::time_elapsed ( ) [inline]

Definition at line 25 of file CpuTimer.hpp.

{ double tmp = tAtLast; return (tAtLast = runtime()) - tmp; }
double moab::CpuTimer::time_since_birth ( ) [inline]

Definition at line 24 of file CpuTimer.hpp.

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

Member Data Documentation

double moab::CpuTimer::atBirth [private]

Definition at line 157 of file WriteHDF5Parallel.cpp.

double moab::CpuTimer::atLast [private]

Definition at line 157 of file WriteHDF5Parallel.cpp.

double moab::CpuTimer::mAtBirth [private]

Definition at line 16 of file CpuTimer.hpp.

double moab::CpuTimer::mAtLast [private]

Definition at line 16 of file CpuTimer.hpp.

Definition at line 17 of file CpuTimer.hpp.

long moab::CpuTimer::rssAtLast [private]

Definition at line 17 of file CpuTimer.hpp.

double moab::CpuTimer::tAtBirth [private]

Definition at line 15 of file CpuTimer.hpp.

double moab::CpuTimer::tAtLast [private]

Definition at line 15 of file CpuTimer.hpp.


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