MySQL 9.1.0
Source Code Documentation
|
For measuring time elapsed. More...
#include <ut0ut.h>
Public Types | |
using | SC = std::chrono::steady_clock |
Public Member Functions | |
Timer () noexcept | |
Constructor. More... | |
void | reset () |
Reset the timer to the current time. More... | |
template<typename T = std::chrono::milliseconds> | |
int64_t | elapsed () const noexcept |
Private Attributes | |
SC::time_point | m_start |
High resolution timer instance used for timimg. More... | |
Friends | |
template<typename T , typename Traits > | |
std::basic_ostream< T, Traits > & | operator<< (std::basic_ostream< T, Traits > &out, const Timer &timer) noexcept |
Print time elapsed since last reset (in milliseconds) to the stream. More... | |
For measuring time elapsed.
Since std::chrono::high_resolution_clock may be influenced by a change in system time, it might not be steady. So we use std::chrono::steady_clock for elapsed time.
using ib::Timer::SC = std::chrono::steady_clock |
|
inlinenoexcept |
Constructor.
Starts/resets the timer to the current time.
|
inlinenoexcept |
|
inline |
Reset the timer to the current time.
|
friend |
Print time elapsed since last reset (in milliseconds) to the stream.
[in,out] | out | Stream to write to. |
[in] | timer | Timer to write to the stream. |
|
private |
High resolution timer instance used for timimg.