Bitcoin Core  0.20.99
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)
 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 outputting the timing log when a particular debug= category is specified. More...
 

Detailed Description

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

RAII-style object that outputs timing information to logs.

Definition at line 21 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 
)
inline

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

Definition at line 26 of file timer.h.

Here is the call graph for this function:

◆ ~Timer()

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

Definition at line 38 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 43 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 54 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 outputting the timing log when a particular debug= category is specified.

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 82 of file timer.h.

◆ m_start_t

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

Definition at line 79 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 85 of file timer.h.


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