libMesh::PerfData Class Reference

#include <perf_log.h>

List of all members.

Public Member Functions

 PerfData ()
void start ()
void restart ()
double pause ()
double stopit ()

Public Attributes

double tot_time
double tot_time_incl_sub
struct timeval tstart
struct timeval tstart_incl_sub
unsigned int count
bool open
int called_recursively

Protected Member Functions

double stop_or_pause (const bool do_stop)

Detailed Description

The PerfData class simply contains the performance data that is recorded for individual events.

Definition at line 45 of file perf_log.h.


Constructor & Destructor Documentation

libMesh::PerfData::PerfData (  )  [inline]

Constructor. Initializes data to be empty.

Definition at line 52 of file perf_log.h.

00052               :
00053     tot_time(0.),
00054     tot_time_incl_sub(0.),
00055     tstart(),
00056     tstart_incl_sub(),
00057     count(0),
00058     open(false),
00059     called_recursively(0)
00060     {}


Member Function Documentation

double libMesh::PerfData::pause (  )  [inline]

Definition at line 305 of file perf_log.h.

References stop_or_pause().

00306 {
00307   return this->stop_or_pause(false);
00308 }

void libMesh::PerfData::restart (  )  [inline]

Definition at line 297 of file perf_log.h.

References tstart.

00298 {
00299   gettimeofday (&(this->tstart), NULL);
00300 }

void libMesh::PerfData::start (  )  [inline]

Definition at line 286 of file perf_log.h.

References called_recursively, count, tstart, and tstart_incl_sub.

Referenced by libMesh::PerfLog::push().

00287 {
00288   this->count++;
00289   this->called_recursively++;
00290   gettimeofday (&(this->tstart), NULL);
00291   this->tstart_incl_sub = this->tstart;
00292 }

double libMesh::PerfData::stop_or_pause ( const bool  do_stop  )  [inline, protected]

Definition at line 312 of file perf_log.h.

References tot_time, tot_time_incl_sub, tstart, and tstart_incl_sub.

Referenced by pause(), and stopit().

00313 {
00314   // save the start times, reuse the structure we have rather than create
00315   // a new one.
00316   const time_t
00317     tstart_tv_sec  = this->tstart.tv_sec,
00318     tstart_tv_usec = this->tstart.tv_usec;
00319 
00320   gettimeofday (&(this->tstart), NULL);
00321 
00322   const double elapsed_time = (static_cast<double>(this->tstart.tv_sec  - tstart_tv_sec) +
00323                                static_cast<double>(this->tstart.tv_usec - tstart_tv_usec)*1.e-6);
00324 
00325   this->tot_time += elapsed_time;
00326 
00327   if(do_stop)
00328     {
00329       const double elapsed_time_incl_sub = (static_cast<double>(this->tstart.tv_sec  - this->tstart_incl_sub.tv_sec) +
00330                                             static_cast<double>(this->tstart.tv_usec - this->tstart_incl_sub.tv_usec)*1.e-6);
00331 
00332       this->tot_time_incl_sub += elapsed_time_incl_sub;
00333     }
00334 
00335   return elapsed_time;
00336 }

double libMesh::PerfData::stopit (  )  [inline]

Definition at line 341 of file perf_log.h.

References called_recursively, and stop_or_pause().

00342 {
00343   // stopit is just similar to pause except that it decrements the
00344   // recursive call counter
00345 
00346   this->called_recursively--;
00347   return this->stop_or_pause(true);
00348 }


Member Data Documentation

Definition at line 103 of file perf_log.h.

Referenced by start(), and stopit().

The number of times this event has been executed

Definition at line 89 of file perf_log.h.

Referenced by libMesh::PerfLog::get_perf_info(), and start().

Flag indicating if we are currently monitoring this event. Should only be true while the event is executing.

Definition at line 96 of file perf_log.h.

Total time spent in this event.

Definition at line 66 of file perf_log.h.

Referenced by libMesh::PerfLog::get_perf_info(), and stop_or_pause().

Total time spent in this event, including sub-events.

Definition at line 71 of file perf_log.h.

Referenced by libMesh::PerfLog::get_perf_info(), and stop_or_pause().

struct timeval libMesh::PerfData::tstart [read]

Structure defining when the event was last started.

Definition at line 77 of file perf_log.h.

Referenced by restart(), start(), and stop_or_pause().

struct timeval libMesh::PerfData::tstart_incl_sub [read]

Structure defining when the event was last started, including sub-events.

Definition at line 83 of file perf_log.h.

Referenced by start(), and stop_or_pause().


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

Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:33 UTC

Hosted By:
SourceForge.net Logo