MySQL 8.0.40
Source Code Documentation
ut_chrono_t Class Reference

A "chronometer" used to clock snippets of code. More...

#include <ut0dbg.h>

Public Member Functions

 ut_chrono_t (const char *name)
 Constructor. More...
 
void reset ()
 Resets the chrono (records the current time in it). More...
 
void show ()
 Shows the time elapsed and usage statistics since the last reset. More...
 
void end ()
 Cause the timings not to be printed from the destructor. More...
 
 ~ut_chrono_t ()
 Destructor. More...
 

Private Attributes

const char * m_name
 Name of this chronometer. More...
 
bool m_show_from_destructor
 True if the current timings should be printed by the destructor. More...
 
struct rusage m_ru
 getrusage() result as of the last reset(). More...
 
struct timeval m_tv
 gettimeofday() result as of the last reset(). More...
 

Detailed Description

A "chronometer" used to clock snippets of code.

Example usage: ut_chrono_t ch("this loop"); for (;;) { ... } ch.show(); would print the timings of the for() loop, prefixed with "this loop:"

Constructor & Destructor Documentation

◆ ut_chrono_t()

ut_chrono_t::ut_chrono_t ( const char *  name)
inline

Constructor.

Parameters
[in]namechrono's name, used when showing the values

◆ ~ut_chrono_t()

ut_chrono_t::~ut_chrono_t ( )
inline

Destructor.

Member Function Documentation

◆ end()

void ut_chrono_t::end ( void  )
inline

Cause the timings not to be printed from the destructor.

◆ reset()

void ut_chrono_t::reset ( void  )
inline

Resets the chrono (records the current time in it).

◆ show()

void ut_chrono_t::show ( )
inline

Shows the time elapsed and usage statistics since the last reset.

Member Data Documentation

◆ m_name

const char* ut_chrono_t::m_name
private

Name of this chronometer.

◆ m_ru

struct rusage ut_chrono_t::m_ru
private

getrusage() result as of the last reset().

◆ m_show_from_destructor

bool ut_chrono_t::m_show_from_destructor
private

True if the current timings should be printed by the destructor.

◆ m_tv

struct timeval ut_chrono_t::m_tv
private

gettimeofday() result as of the last reset().


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