libMesh::PerfData Class Reference

#include <perf_log.h>

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.

52  :
53  tot_time(0.),
55  tstart(),
57  count(0),
58  open(false),
60  {}

Member Function Documentation

double libMesh::PerfData::pause ( )
inline

Definition at line 314 of file perf_log.h.

References stop_or_pause().

315 {
316  return this->stop_or_pause(false);
317 }
void libMesh::PerfData::restart ( )
inline

Definition at line 306 of file perf_log.h.

References tstart.

307 {
308  gettimeofday (&(this->tstart), NULL);
309 }
void libMesh::PerfData::start ( )
inline

Definition at line 295 of file perf_log.h.

References called_recursively, count, tstart, and tstart_incl_sub.

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

296 {
297  this->count++;
298  this->called_recursively++;
299  gettimeofday (&(this->tstart), NULL);
300  this->tstart_incl_sub = this->tstart;
301 }
double libMesh::PerfData::stop_or_pause ( const bool  do_stop)
inlineprotected

Definition at line 321 of file perf_log.h.

References tot_time, tot_time_incl_sub, tstart, and tstart_incl_sub.

Referenced by pause(), and stopit().

322 {
323  // save the start times, reuse the structure we have rather than create
324  // a new one.
325  const time_t
326  tstart_tv_sec = this->tstart.tv_sec,
327  tstart_tv_usec = this->tstart.tv_usec;
328 
329  gettimeofday (&(this->tstart), NULL);
330 
331  const double elapsed_time = (static_cast<double>(this->tstart.tv_sec - tstart_tv_sec) +
332  static_cast<double>(this->tstart.tv_usec - tstart_tv_usec)*1.e-6);
333 
334  this->tot_time += elapsed_time;
335 
336  if(do_stop)
337  {
338  const double elapsed_time_incl_sub = (static_cast<double>(this->tstart.tv_sec - this->tstart_incl_sub.tv_sec) +
339  static_cast<double>(this->tstart.tv_usec - this->tstart_incl_sub.tv_usec)*1.e-6);
340 
341  this->tot_time_incl_sub += elapsed_time_incl_sub;
342  }
343 
344  return elapsed_time;
345 }
double libMesh::PerfData::stopit ( )
inline

Definition at line 350 of file perf_log.h.

References called_recursively, and stop_or_pause().

351 {
352  // stopit is just similar to pause except that it decrements the
353  // recursive call counter
354 
355  this->called_recursively--;
356  return this->stop_or_pause(true);
357 }

Member Data Documentation

int libMesh::PerfData::called_recursively

Definition at line 103 of file perf_log.h.

Referenced by start(), and stopit().

unsigned int libMesh::PerfData::count

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().

bool libMesh::PerfData::open

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.

double libMesh::PerfData::tot_time

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().

double libMesh::PerfData::tot_time_incl_sub

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

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

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 07 2014 16:57:29 UTC

Hosted By:
SourceForge.net Logo