Poster of Linux kernelThe best gift for a Linux geek
PerfData

PerfData

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

PerfData -  

SYNOPSIS


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

Constructor & Destructor Documentation

 

PerfData::PerfData () [inline]Constructor. Initializes data to be empty.

Definition at line 58 of file perf_log.h.

              :
    tot_time(0.),
    tot_time_incl_sub(0.),
    count(0),
    open(false),
    called_recursively(0)
    {}
 

Member Function Documentation

 

double PerfData::pause () [inline]

Definition at line 306 of file perf_log.h.

References stop_or_pause().

{
  return this->stop_or_pause(false);
}
 

void PerfData::restart () [inline]

Definition at line 298 of file perf_log.h.

References tstart.

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

void PerfData::start () [inline]

Definition at line 287 of file perf_log.h.

References called_recursively, count, tstart, and tstart_incl_sub.

Referenced by PerfLog::push().

{
  this->count++;
  this->called_recursively++;
  gettimeofday (&(this->tstart), NULL);
  this->tstart_incl_sub = this->tstart;
}
 

double PerfData::stop_or_pause (const booldo_stop) [inline, protected]

Definition at line 313 of file perf_log.h.

References tot_time, tot_time_incl_sub, tstart, and tstart_incl_sub.

Referenced by pause(), and stopit().

{
  // save the start times, reuse the structure we have rather than create
  // a new one.
  const time_t
    tstart_tv_sec  = this->tstart.tv_sec,
    tstart_tv_usec = this->tstart.tv_usec;
  
  gettimeofday (&(this->tstart), NULL);
  
  const double elapsed_time = (static_cast<double>(this->tstart.tv_sec  - tstart_tv_sec) +
                               static_cast<double>(this->tstart.tv_usec - tstart_tv_usec)*1.e-6);      
  
  this->tot_time += elapsed_time;

  if(do_stop)
    {
      const double elapsed_time_incl_sub = (static_cast<double>(this->tstart.tv_sec  - this->tstart_incl_sub.tv_sec) +
                                            static_cast<double>(this->tstart.tv_usec - this->tstart_incl_sub.tv_usec)*1.e-6);      

      this->tot_time_incl_sub += elapsed_time_incl_sub;
    }

  return elapsed_time;
}
 

double PerfData::stopit () [inline]

Definition at line 342 of file perf_log.h.

References called_recursively, and stop_or_pause().

{
  // stopit is just similar to pause except that it decrements the 
  // recursive call counter
  
  this->called_recursively--;
  return this->stop_or_pause(true);
}
 

Member Data Documentation

 

int PerfData::called_recursively

Definition at line 107 of file perf_log.h.

Referenced by start(), and stopit().  

unsigned int PerfData::countThe number of times this event has been executed

Definition at line 93 of file perf_log.h.

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

bool PerfData::openFlag indicating if we are currently monitoring this event. Should only be true while the event is executing.

Definition at line 100 of file perf_log.h.  

double PerfData::tot_timeTotal time spent in this event.

Definition at line 70 of file perf_log.h.

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

double PerfData::tot_time_incl_subTotal time spent in this event, including sub-events.

Definition at line 75 of file perf_log.h.

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

struct timeval PerfData::tstartStructure defining when the event was last started.

Definition at line 81 of file perf_log.h.

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

struct timeval PerfData::tstart_incl_subStructure defining when the event was last started, including sub-events.

Definition at line 87 of file perf_log.h.

Referenced by start(), and stop_or_pause().

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Public Attributes
Protected Member Functions
Detailed Description
Constructor & Destructor Documentation
PerfData::PerfData () [inline]Constructor. Initializes data to be empty.
Member Function Documentation
double PerfData::pause () [inline]
void PerfData::restart () [inline]
void PerfData::start () [inline]
double PerfData::stop_or_pause (const booldo_stop) [inline, protected]
double PerfData::stopit () [inline]
Member Data Documentation
int PerfData::called_recursively
unsigned int PerfData::countThe number of times this event has been executed
bool PerfData::openFlag indicating if we are currently monitoring this event. Should only be true while the event is executing.
double PerfData::tot_timeTotal time spent in this event.
double PerfData::tot_time_incl_subTotal time spent in this event, including sub-events.
struct timeval PerfData::tstartStructure defining when the event was last started.
struct timeval PerfData::tstart_incl_subStructure defining when the event was last started, including sub-events.
Author

This document was created by man2html, using the manual pages.
Time: 21:52:19 GMT, April 16, 2011