Public Member Functions | Private Attributes | List of all members
icl_core::logging::ScopedTimer< TStreamName > Class Template Reference

#include <ScopedTimer.h>

Public Member Functions

void print () const
 Outputs the time passed since construction. More...
 
void print (const std::string &extra_description) const
 Outputs the time passed since construction. More...
 
 ScopedTimer (const std::string &description="ScopedTimer", const LogLevel level=eLL_DEBUG, const std::string &filename=__FILE__, const std::size_t line=__LINE__, const std::string &classname="", const std::string &objectname="")
 
void stop ()
 
 ~ScopedTimer ()
 

Private Attributes

bool m_active
 
const std::string m_classname
 
const std::string m_description
 
const std::string m_filename
 
const LogLevel m_level
 
const std::size_t m_line
 
const std::string m_objectname
 
const TimeStamp m_start_time
 

Detailed Description

template<typename TStreamName>
class icl_core::logging::ScopedTimer< TStreamName >

A helper class for measuring the time spent in a scope. While you can use this class directly, you should prefer the LOGGING_SCOPED_TIMER* macros instead.

Template Parameters
TStreamNameName of the LogStream class to write to.

Definition at line 44 of file ScopedTimer.h.

Constructor & Destructor Documentation

template<typename TStreamName >
icl_core::logging::ScopedTimer< TStreamName >::ScopedTimer ( const std::string &  description = "ScopedTimer< TStreamName >",
const LogLevel  level = eLL_DEBUG,
const std::string &  filename = __FILE__,
const std::size_t  line = __LINE__,
const std::string &  classname = "",
const std::string &  objectname = "" 
)
inline

Create a scoped timer. Upon destruction, it outputs the time in nanoseconds that has passed since construction to the TStreamName LogStream. The description is output alongside to help identify which timer is presented.

Parameters
descriptionDescription of the timer. If, for example, description is "Foo" and destruction occurs after 42 nanoseconds, the output is "Foo: 42 ns".
levelThe LogLevel.
filenameName of the source file in which the timer was created.
lineNumber of the source code line in which the timer was created.
classnameName of the class in which the timer was created.
objectnameName of the concrete object in which the timer was created.

Definition at line 64 of file ScopedTimer.h.

template<typename TStreamName >
icl_core::logging::ScopedTimer< TStreamName >::~ScopedTimer ( )
inline

Outputs the time passed since construction and destroys the timer. The time is not output if stop() was previously called.

Definition at line 113 of file ScopedTimer.h.

Member Function Documentation

template<typename TStreamName >
void icl_core::logging::ScopedTimer< TStreamName >::print ( ) const
inline

Outputs the time passed since construction.

Definition at line 81 of file ScopedTimer.h.

template<typename TStreamName >
void icl_core::logging::ScopedTimer< TStreamName >::print ( const std::string &  extra_description) const
inline

Outputs the time passed since construction.

Definition at line 90 of file ScopedTimer.h.

template<typename TStreamName >
void icl_core::logging::ScopedTimer< TStreamName >::stop ( )
inline

Outputs the time passed since construction and stops the timer. The time is not output if stop() was previously called.

Definition at line 101 of file ScopedTimer.h.

Member Data Documentation

template<typename TStreamName >
bool icl_core::logging::ScopedTimer< TStreamName >::m_active
private

Definition at line 129 of file ScopedTimer.h.

template<typename TStreamName >
const std::string icl_core::logging::ScopedTimer< TStreamName >::m_classname
private

Definition at line 126 of file ScopedTimer.h.

template<typename TStreamName >
const std::string icl_core::logging::ScopedTimer< TStreamName >::m_description
private

Definition at line 122 of file ScopedTimer.h.

template<typename TStreamName >
const std::string icl_core::logging::ScopedTimer< TStreamName >::m_filename
private

Definition at line 124 of file ScopedTimer.h.

template<typename TStreamName >
const LogLevel icl_core::logging::ScopedTimer< TStreamName >::m_level
private

Definition at line 123 of file ScopedTimer.h.

template<typename TStreamName >
const std::size_t icl_core::logging::ScopedTimer< TStreamName >::m_line
private

Definition at line 125 of file ScopedTimer.h.

template<typename TStreamName >
const std::string icl_core::logging::ScopedTimer< TStreamName >::m_objectname
private

Definition at line 127 of file ScopedTimer.h.

template<typename TStreamName >
const TimeStamp icl_core::logging::ScopedTimer< TStreamName >::m_start_time
private

Definition at line 128 of file ScopedTimer.h.


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


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:59