Poster of Linux kernelThe best gift for a Linux geek
PerfMon

PerfMon

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

NAME

PerfMon -  

SYNOPSIS


#include <perfmon.h>  

Public Member Functions


PerfMon (std::string id, const unsigned int v=1, const unsigned int pid=0)

~PerfMon ()

void reset ()

double print (std::string msg='NULL')
 

Private Attributes


const std::string id_string

struct timeval the_time_start

struct timeval the_time_stop

const unsigned int verbose

const unsigned int proc_id

float rtime

float ptime

float mflops

long long int flpins
 

Detailed Description

Definition at line 42 of file perfmon.h.  

Constructor & Destructor Documentation

 

PerfMon::PerfMon (std::stringid, const unsigned intv = 1, const unsigned intpid = 0) [inline]

Definition at line 135 of file perfmon.h.

References reset().

                                          :
  id_string(id),
  verbose(v),
  proc_id(pid)
{
  reset ();
}
 

PerfMon::~PerfMon () [inline]

Definition at line 148 of file perfmon.h.

References print().

{
  print ();
}
 

Member Function Documentation

 

double PerfMon::print (std::stringmsg = 'NULL') [inline]

Definition at line 86 of file perfmon.h.

References flpins, id_string, mflops, proc_id, ptime, rtime, the_time_start, the_time_stop, and verbose.

Referenced by ~PerfMon().

{  
  gettimeofday (&the_time_stop, NULL);
  
#ifdef HAVE_PAPI_H
  Papi::PAPI_flops (&rtime, &ptime, &flpins, &mflops);
#endif

  const double elapsed_time = ((double) (the_time_stop.tv_sec - the_time_start.tv_sec)) +
                              ((double) (the_time_stop.tv_usec - the_time_start.tv_usec))/1000000.;

  if (verbose)
    {
      
      if (proc_id == 0)
        {
          if (msg == 'NULL')
            std::cout << ' ' << id_string
                      << ': elapsed time: '
                      << elapsed_time << ' (sec)'
                      << std::endl;
          else
            std::cout << ' ' << msg
                      << ': elapsed time: '
                      << elapsed_time << ' (sec)'
                      << std::endl;
          
#ifdef HAVE_PAPI_H
          if (msg == 'NULL')
            std::cout << ' ' << id_string
                      << ': mflops: '
                      << mflops
                      << std::endl;
          else
            std::cout << ' ' << msg
                      << ': mflops: '
                      << mflops
                      << std::endl;
      
#endif

        }
    }
  
  return elapsed_time;
}
 

void PerfMon::reset () [inline]

Definition at line 73 of file perfmon.h.

References flpins, mflops, ptime, rtime, and the_time_start.

Referenced by PerfMon().

{
  gettimeofday (&the_time_start, NULL);

#ifdef HAVE_PAPI_H
  Papi::PAPI_flops (&rtime, &ptime, &flpins, &mflops);
#endif  
}
 

Member Data Documentation

 

long long int PerfMon::flpins [private]

Definition at line 65 of file perfmon.h.

Referenced by print(), and reset().  

const std::string PerfMon::id_string [private]

Definition at line 55 of file perfmon.h.

Referenced by print().  

float PerfMon::mflops [private]

Definition at line 64 of file perfmon.h.

Referenced by print(), and reset().  

const unsigned int PerfMon::proc_id [private]

Definition at line 61 of file perfmon.h.

Referenced by print().  

float PerfMon::ptime [private]

Definition at line 64 of file perfmon.h.

Referenced by print(), and reset().  

float PerfMon::rtime [private]

Definition at line 64 of file perfmon.h.

Referenced by print(), and reset().  

struct timeval PerfMon::the_time_start [private]

Definition at line 57 of file perfmon.h.

Referenced by print(), and reset().  

struct timeval PerfMon::the_time_stop [private]

Definition at line 58 of file perfmon.h.

Referenced by print().  

const unsigned int PerfMon::verbose [private]

Definition at line 60 of file perfmon.h.

Referenced by print().

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Private Attributes
Detailed Description
Constructor & Destructor Documentation
PerfMon::PerfMon (std::stringid, const unsigned intv = 1, const unsigned intpid = 0) [inline]
PerfMon::~PerfMon () [inline]
Member Function Documentation
double PerfMon::print (std::stringmsg = 'NULL') [inline]
void PerfMon::reset () [inline]
Member Data Documentation
long long int PerfMon::flpins [private]
const std::string PerfMon::id_string [private]
float PerfMon::mflops [private]
const unsigned int PerfMon::proc_id [private]
float PerfMon::ptime [private]
float PerfMon::rtime [private]
struct timeval PerfMon::the_time_start [private]
struct timeval PerfMon::the_time_stop [private]
const unsigned int PerfMon::verbose [private]
Author

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