libMesh::PerfData Class Reference

Data object managed by PerfLog. More...

#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

Data object managed by PerfLog.

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

Author
Benjamin Kirk
Date
2003

Definition at line 46 of file perf_log.h.

Constructor & Destructor Documentation

libMesh::PerfData::PerfData ( )
inline

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
Definition: perf_log.h:72
int called_recursively
Definition: perf_log.h:104
struct timeval tstart
Definition: perf_log.h:78
struct timeval tstart_incl_sub
Definition: perf_log.h:84
double tot_time
Definition: perf_log.h:67
unsigned int count
Definition: perf_log.h:90

Member Function Documentation

double libMesh::PerfData::pause ( )
inline

Definition at line 331 of file perf_log.h.

References stop_or_pause().

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

332 {
333  return this->stop_or_pause(false);
334 }
double stop_or_pause(const bool do_stop)
Definition: perf_log.h:338
void libMesh::PerfData::restart ( )
inline

Definition at line 323 of file perf_log.h.

References libmesh_nullptr, and tstart.

324 {
325  gettimeofday (&(this->tstart), libmesh_nullptr);
326 }
const class libmesh_nullptr_t libmesh_nullptr
struct timeval tstart
Definition: perf_log.h:78
void libMesh::PerfData::start ( )
inline

Definition at line 312 of file perf_log.h.

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

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

313 {
314  this->count++;
315  this->called_recursively++;
316  gettimeofday (&(this->tstart), libmesh_nullptr);
317  this->tstart_incl_sub = this->tstart;
318 }
int called_recursively
Definition: perf_log.h:104
const class libmesh_nullptr_t libmesh_nullptr
struct timeval tstart
Definition: perf_log.h:78
struct timeval tstart_incl_sub
Definition: perf_log.h:84
unsigned int count
Definition: perf_log.h:90
double libMesh::PerfData::stop_or_pause ( const bool  do_stop)
inlineprotected

Definition at line 338 of file perf_log.h.

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

Referenced by pause(), and stopit().

339 {
340  // save the start times, reuse the structure we have rather than create
341  // a new one.
342  const time_t
343  tstart_tv_sec = this->tstart.tv_sec,
344  tstart_tv_usec = this->tstart.tv_usec;
345 
346  gettimeofday (&(this->tstart), libmesh_nullptr);
347 
348  const double elapsed_time = (static_cast<double>(this->tstart.tv_sec - tstart_tv_sec) +
349  static_cast<double>(this->tstart.tv_usec - tstart_tv_usec)*1.e-6);
350 
351  this->tot_time += elapsed_time;
352 
353  if (do_stop)
354  {
355  const double elapsed_time_incl_sub = (static_cast<double>(this->tstart.tv_sec - this->tstart_incl_sub.tv_sec) +
356  static_cast<double>(this->tstart.tv_usec - this->tstart_incl_sub.tv_usec)*1.e-6);
357 
358  this->tot_time_incl_sub += elapsed_time_incl_sub;
359  }
360 
361  return elapsed_time;
362 }
double tot_time_incl_sub
Definition: perf_log.h:72
const class libmesh_nullptr_t libmesh_nullptr
struct timeval tstart
Definition: perf_log.h:78
struct timeval tstart_incl_sub
Definition: perf_log.h:84
double tot_time
Definition: perf_log.h:67
double libMesh::PerfData::stopit ( )
inline

Definition at line 367 of file perf_log.h.

References called_recursively, and stop_or_pause().

368 {
369  // stopit is just similar to pause except that it decrements the
370  // recursive call counter
371 
372  this->called_recursively--;
373  return this->stop_or_pause(true);
374 }
int called_recursively
Definition: perf_log.h:104
double stop_or_pause(const bool do_stop)
Definition: perf_log.h:338

Member Data Documentation

int libMesh::PerfData::called_recursively

Definition at line 104 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 90 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 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(), 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(), 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 start(), and stop_or_pause().


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