Base Framework
Classes | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Timer Class Reference

Timer. More...

#include <base/Timer.h>

Inherits Object.

Classes

class  ElapsedTime
 Elapsed time conversion. More...
 
struct  Time
 
struct  XTime
 

Public Member Functions

 Timer () noexcept
 
void start () noexcept
 
void stop () noexcept
 
uint64 getStartTime () const noexcept
 
uint64 getStopTime () const noexcept
 
uint64 getMicroseconds () const noexcept
 
uint64 getLiveMicroseconds () const noexcept
 

Static Public Member Functions

static uint64 toTimeNS (XTime time) noexcept
 
static uint64 toTimeUS (XTime time) noexcept
 
static XTime toXTimeNS (uint64 nanoseconds) noexcept
 
static XTime toXTimeUS (uint64 microseconds) noexcept
 
static uint64 getMeasureFrequency () noexcept
 
static uint64 getRealNow () noexcept
 
static uint64 getNowNS () noexcept
 
static uint64 getNow () noexcept
 

Related Functions

(Note that these are not member functions.)

FormatOutputStreamoperator<< (FormatOutputStream &stream, const Timer &value)
 

Detailed Description

Timer.

Timer.

Examples
testsuite/ftp.cpp, testsuite/http.cpp, and testsuite/ping.cpp.

Constructor & Destructor Documentation

◆ Timer()

Timer::Timer ( )
inlinenoexcept

Initializes the timer. The timer is started.

Member Function Documentation

◆ getLiveMicroseconds()

uint64 Timer::getLiveMicroseconds ( ) const
inlinenoexcept

Returns the number of elapsed microseconds since start.

Examples
testsuite/ftp.cpp, and testsuite/http.cpp.

◆ getMeasureFrequency()

static uint64 Timer::getMeasureFrequency ( )
staticnoexcept

Measure frequency (ticks per second).

◆ getMicroseconds()

uint64 Timer::getMicroseconds ( ) const
inlinenoexcept

Returns the number of elapsed microseconds between start and stop times.

Examples
testsuite/ping.cpp.

◆ getNow()

static uint64 Timer::getNow ( )
staticnoexcept

Returns the current time in microseconds.

◆ getNowNS()

static uint64 Timer::getNowNS ( )
staticnoexcept

Returns the current time in nanoseconds.

◆ getRealNow()

static uint64 Timer::getRealNow ( )
staticnoexcept

Returns the current clock time in microseconds. Time can go backwards.

◆ getStartTime()

uint64 Timer::getStartTime ( ) const
inlinenoexcept

Returns the start time in microseconds.

◆ getStopTime()

uint64 Timer::getStopTime ( ) const
inlinenoexcept

Returns the stop time in microseconds.

◆ start()

void Timer::start ( )
inlinenoexcept

Starts the timer.

Examples
testsuite/http.cpp, and testsuite/ping.cpp.

◆ stop()

void Timer::stop ( )
inlinenoexcept

Stops the timer.

Examples
testsuite/ping.cpp.

◆ toTimeNS()

static uint64 Timer::toTimeNS ( XTime  time)
staticnoexcept

Converts XTime to normal 64-bit time (nanoseconds).

◆ toTimeUS()

static uint64 Timer::toTimeUS ( XTime  time)
staticnoexcept

Converts XTime to normal 64-bit time (microseconds).

◆ toXTimeNS()

static XTime Timer::toXTimeNS ( uint64  nanoseconds)
staticnoexcept

Returns XTime from nanoseconds.

◆ toXTimeUS()

static XTime Timer::toXTimeUS ( uint64  microseconds)
staticnoexcept

Returns XTime from microseconds.

Friends And Related Function Documentation

◆ operator<<()

FormatOutputStream & operator<< ( FormatOutputStream stream,
const Timer value 
)
related

Writes a string representation of the elapsed time of the specified timer.