#include <ScopedTimer.h>
Public Member Functions | |
void | print () const |
Outputs the time passed since construction. | |
void | print (const std::string &extra_description) const |
Outputs the time passed since construction. | |
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 |
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.
TStreamName | Name of the LogStream class to write to. |
Definition at line 44 of file ScopedTimer.h.
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.
description | Description of the timer. If, for example, description is "Foo" and destruction occurs after 42 nanoseconds, the output is "Foo: 42 ns". |
level | The LogLevel. |
filename | Name of the source file in which the timer was created. |
line | Number of the source code line in which the timer was created. |
classname | Name of the class in which the timer was created. |
objectname | Name of the concrete object in which the timer was created. |
Definition at line 64 of file ScopedTimer.h.
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.
void icl_core::logging::ScopedTimer< TStreamName >::print | ( | ) | const [inline] |
Outputs the time passed since construction.
Definition at line 81 of file ScopedTimer.h.
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.
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.
bool icl_core::logging::ScopedTimer< TStreamName >::m_active [private] |
Definition at line 129 of file ScopedTimer.h.
const std::string icl_core::logging::ScopedTimer< TStreamName >::m_classname [private] |
Definition at line 126 of file ScopedTimer.h.
const std::string icl_core::logging::ScopedTimer< TStreamName >::m_description [private] |
Definition at line 122 of file ScopedTimer.h.
const std::string icl_core::logging::ScopedTimer< TStreamName >::m_filename [private] |
Definition at line 124 of file ScopedTimer.h.
const LogLevel icl_core::logging::ScopedTimer< TStreamName >::m_level [private] |
Definition at line 123 of file ScopedTimer.h.
const std::size_t icl_core::logging::ScopedTimer< TStreamName >::m_line [private] |
Definition at line 125 of file ScopedTimer.h.
const std::string icl_core::logging::ScopedTimer< TStreamName >::m_objectname [private] |
Definition at line 127 of file ScopedTimer.h.
const TimeStamp icl_core::logging::ScopedTimer< TStreamName >::m_start_time [private] |
Definition at line 128 of file ScopedTimer.h.