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 326 of file perf_log.h.

References stop_or_pause().

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

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

Definition at line 318 of file perf_log.h.

References libmesh_nullptr, and tstart.

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

Definition at line 307 of file perf_log.h.

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

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

308 {
309  this->count++;
310  this->called_recursively++;
311  gettimeofday (&(this->tstart), libmesh_nullptr);
312  this->tstart_incl_sub = this->tstart;
313 }
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 333 of file perf_log.h.

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

Referenced by pause(), and stopit().

334 {
335  // save the start times, reuse the structure we have rather than create
336  // a new one.
337  const time_t
338  tstart_tv_sec = this->tstart.tv_sec,
339  tstart_tv_usec = this->tstart.tv_usec;
340 
341  gettimeofday (&(this->tstart), libmesh_nullptr);
342 
343  const double elapsed_time = (static_cast<double>(this->tstart.tv_sec - tstart_tv_sec) +
344  static_cast<double>(this->tstart.tv_usec - tstart_tv_usec)*1.e-6);
345 
346  this->tot_time += elapsed_time;
347 
348  if(do_stop)
349  {
350  const double elapsed_time_incl_sub = (static_cast<double>(this->tstart.tv_sec - this->tstart_incl_sub.tv_sec) +
351  static_cast<double>(this->tstart.tv_usec - this->tstart_incl_sub.tv_usec)*1.e-6);
352 
353  this->tot_time_incl_sub += elapsed_time_incl_sub;
354  }
355 
356  return elapsed_time;
357 }
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 362 of file perf_log.h.

References called_recursively, and stop_or_pause().

363 {
364  // stopit is just similar to pause except that it decrements the
365  // recursive call counter
366 
367  this->called_recursively--;
368  return this->stop_or_pause(true);
369 }
int called_recursively
Definition: perf_log.h:104
double stop_or_pause(const bool do_stop)
Definition: perf_log.h:333

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: