Bitcoin ABC 0.30.7
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
BCLog::Timer< TimeType > Class Template Reference

RAII-style object that outputs timing information to logs. More...

#include <timer.h>

Public Member Functions

 Timer (std::string prefix, std::string end_msg, BCLog::LogFlags log_category=BCLog::LogFlags::ALL, bool msg_on_completion=true)
 If log_category is left as the default, end_msg will log unconditionally (instead of being filtered by category). More...
 
 ~Timer ()
 
void Log (const std::string &msg)
 
std::string LogMsg (const std::string &msg)
 

Private Attributes

std::chrono::microseconds m_start_t {}
 
const std::string m_prefix
 Log prefix; usually the name of the function this was created in. More...
 
const std::string m_title
 A descriptive message of what is being timed. More...
 
const BCLog::LogFlags m_log_category
 Forwarded on to LogPrint if specified - has the effect of only outputing the timing log when a particular debug= category is specified. More...
 
const bool m_message_on_completion
 Whether to output the message again on completion. More...
 

Detailed Description

template<typename TimeType>
class BCLog::Timer< TimeType >

RAII-style object that outputs timing information to logs.

Definition at line 20 of file timer.h.

Constructor & Destructor Documentation

◆ Timer()

template<typename TimeType >
BCLog::Timer< TimeType >::Timer ( std::string  prefix,
std::string  end_msg,
BCLog::LogFlags  log_category = BCLog::LogFlags::ALL,
bool  msg_on_completion = true 
)
inline

If log_category is left as the default, end_msg will log unconditionally (instead of being filtered by category).

Definition at line 24 of file timer.h.

Here is the call graph for this function:

◆ ~Timer()

template<typename TimeType >
BCLog::Timer< TimeType >::~Timer ( )
inline

Definition at line 34 of file timer.h.

Here is the call graph for this function:

Member Function Documentation

◆ Log()

template<typename TimeType >
void BCLog::Timer< TimeType >::Log ( const std::string &  msg)
inline

Definition at line 42 of file timer.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LogMsg()

template<typename TimeType >
std::string BCLog::Timer< TimeType >::LogMsg ( const std::string &  msg)
inline

Definition at line 52 of file timer.h.

Here is the caller graph for this function:

Member Data Documentation

◆ m_log_category

template<typename TimeType >
const BCLog::LogFlags BCLog::Timer< TimeType >::m_log_category
private

Forwarded on to LogPrint if specified - has the effect of only outputing the timing log when a particular debug= category is specified.

Definition at line 86 of file timer.h.

◆ m_message_on_completion

template<typename TimeType >
const bool BCLog::Timer< TimeType >::m_message_on_completion
private

Whether to output the message again on completion.

Definition at line 89 of file timer.h.

◆ m_prefix

template<typename TimeType >
const std::string BCLog::Timer< TimeType >::m_prefix
private

Log prefix; usually the name of the function this was created in.

Definition at line 79 of file timer.h.

◆ m_start_t

template<typename TimeType >
std::chrono::microseconds BCLog::Timer< TimeType >::m_start_t {}
private

Definition at line 76 of file timer.h.

◆ m_title

template<typename TimeType >
const std::string BCLog::Timer< TimeType >::m_title
private

A descriptive message of what is being timed.

Definition at line 82 of file timer.h.


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