g2o
Public Member Functions | Private Attributes | List of all members
g2o::ScopeTime Class Reference

Class to measure the time spent in a scope. More...

#include <timeutil.h>

Public Member Functions

 ScopeTime (const char *title)
 
 ~ScopeTime ()
 

Private Attributes

std::string _title
 
double _startTime
 

Detailed Description

Class to measure the time spent in a scope.

To use this class, e.g. to measure the time spent in a function, just create and instance at the beginning of the function.

Definition at line 115 of file timeutil.h.

Constructor & Destructor Documentation

g2o::ScopeTime::ScopeTime ( const char *  title)

Definition at line 107 of file timeutil.cpp.

107 : _title(title), _startTime(get_monotonic_time()) {}
double get_monotonic_time()
Definition: timeutil.cpp:113
double _startTime
Definition: timeutil.h:121
std::string _title
Definition: timeutil.h:120
g2o::ScopeTime::~ScopeTime ( )

Definition at line 109 of file timeutil.cpp.

References _startTime, _title, and g2o::get_monotonic_time().

109  {
110  std::cerr << _title<<" took "<<1000*(get_monotonic_time()-_startTime)<<"ms.\n";
111 }
double get_monotonic_time()
Definition: timeutil.cpp:113
double _startTime
Definition: timeutil.h:121
std::string _title
Definition: timeutil.h:120

Member Data Documentation

double g2o::ScopeTime::_startTime
private

Definition at line 121 of file timeutil.h.

Referenced by ~ScopeTime().

std::string g2o::ScopeTime::_title
private

Definition at line 120 of file timeutil.h.

Referenced by ~ScopeTime().


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