Version: 8.3.0
salome_chrono Class Reference

#include <chrono.hxx>

Collaboration diagram for salome_chrono:

Public Member Functions

 salome_chrono (int i)
 
 ~salome_chrono ()
 
void stop ()
 

Protected Attributes

bool _run
 
int _ctr
 
clock_t _start
 
clock_t _end
 

Detailed Description

Definition at line 53 of file chrono.hxx.

Constructor & Destructor Documentation

salome_chrono::salome_chrono ( int  i)

Definition at line 65 of file chrono.cxx.

References _start.

65  : _ctr(i), _run(true)
66 {
67  //DEBTRACE("salome_chrono::salome_chrono " << _ctr << " " << _run);
68  _start = clock();
69 }
salome_chrono::~salome_chrono ( )

Definition at line 71 of file chrono.cxx.

References _run, and stop().

72 {
73  if (_run) stop();
74 }

Member Function Documentation

void salome_chrono::stop ( )

Definition at line 76 of file chrono.cxx.

References _ctr, acnt::_ctrCumul, acnt::_ctrOccur, counters::_ctrs, _end, _run, and _start.

Referenced by ~salome_chrono().

77 {
78  //DEBTRACE("salome_chrono::stop " << _ctr << " " << _run);
79  if (_run)
80  {
81  _run = false;
82  _end = clock();
83  double elapse = double(_end - _start)/double(CLOCKS_PER_SEC);
85  counters::_ctrs[_ctr]._ctrCumul += elapse;
86  }
87 }

Member Data Documentation

int salome_chrono::_ctr
protected

Definition at line 61 of file chrono.hxx.

Referenced by stop().

clock_t salome_chrono::_end
protected

Definition at line 62 of file chrono.hxx.

Referenced by stop().

bool salome_chrono::_run
protected

Definition at line 60 of file chrono.hxx.

Referenced by stop(), and ~salome_chrono().

clock_t salome_chrono::_start
protected

Definition at line 62 of file chrono.hxx.

Referenced by salome_chrono(), and stop().


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