libMesh
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
libMesh::PerfData Class Reference

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

#include <perf_log.h>

Public Member Functions

 PerfData ()
 Constructor. More...
 
void start ()
 
void restart ()
 
double pause ()
 
double pause_for (PerfData &other)
 
double stopit ()
 

Public Attributes

double tot_time
 Total time spent in this event. More...
 
double tot_time_incl_sub
 Total time spent in this event, including sub-events. More...
 
struct timeval tstart
 Structure defining when the event was last started. More...
 
struct timeval tstart_incl_sub
 Structure defining when the event was last started, including sub-events. More...
 
unsigned int count
 The number of times this event has been executed. More...
 
bool open
 Flag indicating if we are currently monitoring this event. More...
 
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.

Author
Benjamin Kirk
Date
2003 Data object managed by PerfLog

Definition at line 46 of file perf_log.h.

Constructor & Destructor Documentation

libMesh::PerfData::PerfData ( )

Constructor.

Initializes data to be empty.

Definition at line 53 of file perf_log.h.

53  :
54  tot_time(0.),
56  tstart(),
58  count(0),
59  open(false),
61  {}
double tot_time_incl_sub
Total time spent in this event, including sub-events.
Definition: perf_log.h:72
int called_recursively
Definition: perf_log.h:105
struct timeval tstart
Structure defining when the event was last started.
Definition: perf_log.h:78
struct timeval tstart_incl_sub
Structure defining when the event was last started, including sub-events.
Definition: perf_log.h:84
double tot_time
Total time spent in this event.
Definition: perf_log.h:67
unsigned int count
The number of times this event has been executed.
Definition: perf_log.h:90
bool open
Flag indicating if we are currently monitoring this event.
Definition: perf_log.h:97

Member Function Documentation

double libMesh::PerfData::pause ( )

Definition at line 398 of file perf_log.h.

References stop_or_pause().

399 {
400  return this->stop_or_pause(false);
401 }
double stop_or_pause(const bool do_stop)
Definition: perf_log.h:405
double libMesh::PerfData::pause_for ( PerfData other)

Definition at line 434 of file perf_log.h.

References called_recursively, count, libmesh_nullptr, tot_time, tstart, and tstart_incl_sub.

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

435 {
436  gettimeofday (&(other.tstart), libmesh_nullptr);
437 
438  const double elapsed_time = (static_cast<double>(other.tstart.tv_sec - this->tstart.tv_sec) +
439  static_cast<double>(other.tstart.tv_usec - this->tstart.tv_usec)*1.e-6);
440  this->tot_time += elapsed_time;
441 
442  other.count++;
443  other.called_recursively++;
444  other.tstart_incl_sub = other.tstart;
445 
446  return elapsed_time;
447 }
const class libmesh_nullptr_t libmesh_nullptr
struct timeval tstart
Structure defining when the event was last started.
Definition: perf_log.h:78
double tot_time
Total time spent in this event.
Definition: perf_log.h:67
void libMesh::PerfData::restart ( )

Definition at line 390 of file perf_log.h.

References libmesh_nullptr, and tstart.

391 {
392  gettimeofday (&(this->tstart), libmesh_nullptr);
393 }
const class libmesh_nullptr_t libmesh_nullptr
struct timeval tstart
Structure defining when the event was last started.
Definition: perf_log.h:78
void libMesh::PerfData::start ( )

Definition at line 379 of file perf_log.h.

References called_recursively, count, libmesh_nullptr, tstart, and tstart_incl_sub.

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

380 {
381  this->count++;
382  this->called_recursively++;
383  gettimeofday (&(this->tstart), libmesh_nullptr);
384  this->tstart_incl_sub = this->tstart;
385 }
int called_recursively
Definition: perf_log.h:105
const class libmesh_nullptr_t libmesh_nullptr
struct timeval tstart
Structure defining when the event was last started.
Definition: perf_log.h:78
struct timeval tstart_incl_sub
Structure defining when the event was last started, including sub-events.
Definition: perf_log.h:84
unsigned int count
The number of times this event has been executed.
Definition: perf_log.h:90
double libMesh::PerfData::stop_or_pause ( const bool  do_stop)
protected

Definition at line 405 of file perf_log.h.

References libmesh_nullptr, tot_time, tot_time_incl_sub, tstart, and tstart_incl_sub.

Referenced by pause(), and stopit().

406 {
407  // save the start times, reuse the structure we have rather than create
408  // a new one.
409  const time_t
410  tstart_tv_sec = this->tstart.tv_sec,
411  tstart_tv_usec = this->tstart.tv_usec;
412 
413  gettimeofday (&(this->tstart), libmesh_nullptr);
414 
415  const double elapsed_time = (static_cast<double>(this->tstart.tv_sec - tstart_tv_sec) +
416  static_cast<double>(this->tstart.tv_usec - tstart_tv_usec)*1.e-6);
417 
418  this->tot_time += elapsed_time;
419 
420  if (do_stop)
421  {
422  const double elapsed_time_incl_sub = (static_cast<double>(this->tstart.tv_sec - this->tstart_incl_sub.tv_sec) +
423  static_cast<double>(this->tstart.tv_usec - this->tstart_incl_sub.tv_usec)*1.e-6);
424 
425  this->tot_time_incl_sub += elapsed_time_incl_sub;
426  }
427 
428  return elapsed_time;
429 }
double tot_time_incl_sub
Total time spent in this event, including sub-events.
Definition: perf_log.h:72
const class libmesh_nullptr_t libmesh_nullptr
struct timeval tstart
Structure defining when the event was last started.
Definition: perf_log.h:78
struct timeval tstart_incl_sub
Structure defining when the event was last started, including sub-events.
Definition: perf_log.h:84
double tot_time
Total time spent in this event.
Definition: perf_log.h:67
double libMesh::PerfData::stopit ( )

Definition at line 452 of file perf_log.h.

References called_recursively, and stop_or_pause().

453 {
454  // stopit is just similar to pause except that it decrements the
455  // recursive call counter
456 
457  this->called_recursively--;
458  return this->stop_or_pause(true);
459 }
int called_recursively
Definition: perf_log.h:105
double stop_or_pause(const bool do_stop)
Definition: perf_log.h:405

Member Data Documentation

int libMesh::PerfData::called_recursively

Definition at line 105 of file perf_log.h.

Referenced by pause_for(), start(), and stopit().

unsigned int libMesh::PerfData::count

The number of times this event has been executed.

Definition at line 90 of file perf_log.h.

Referenced by libMesh::PerfLog::get_perf_info(), pause_for(), 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 97 of file perf_log.h.

double libMesh::PerfData::tot_time

Total time spent in this event.

Definition at line 67 of file perf_log.h.

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

double libMesh::PerfData::tot_time_incl_sub

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

Definition at line 72 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 78 of file perf_log.h.

Referenced by libMesh::PerfLog::get_elapsed_time(), pause_for(), 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 84 of file perf_log.h.

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


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