crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Timer::SimpleHR Class Reference

A simple timer with high resolution. More...

#include <SimpleHR.hpp>

Construction

 SimpleHR ()
 Constructor starting the timer. More...
 

Tick control

std::uint64_t tick ()
 Timer tick returning the number of microseconds passed. More...
 
std::string tickStr ()
 Timer tick returning the number of microseconds passed as string. More...
 

Reset

void clear ()
 Resets the internal state of the timer. More...
 

Internal state

std::chrono::high_resolution_clock::time_point timePoint
 (Time) point of creation or last tick. More...
 

Detailed Description

A simple timer with high resolution.

Starting from its creation, this timer counts the number of microseconds until tick() or tickStr() is called.

The timer is restarted after each tick.

Constructor & Destructor Documentation

◆ SimpleHR()

crawlservpp::Timer::SimpleHR::SimpleHR ( )
inline

Constructor starting the timer.

Member Function Documentation

◆ clear()

void crawlservpp::Timer::SimpleHR::clear ( )
inline

Resets the internal state of the timer.

References timePoint.

◆ tick()

std::uint64_t crawlservpp::Timer::SimpleHR::tick ( )
inline

Timer tick returning the number of microseconds passed.

Restarts the timer.

Returns
the time since creation or last tick in microseconds.

References crawlservpp::Helper::DateTime::now(), and timePoint.

◆ tickStr()

std::string crawlservpp::Timer::SimpleHR::tickStr ( )
inline

Timer tick returning the number of microseconds passed as string.

Restarts the timer.

Returns
the time since creation or last tick as formatted string. The resolution of the result remains in microseconds.
See also
Helper::DateTime::microsecondsToString

References crawlservpp::Helper::DateTime::microsecondsToString(), crawlservpp::Helper::DateTime::now(), and timePoint.

Referenced by crawlservpp::Main::Server::tick().

Member Data Documentation

◆ timePoint

std::chrono::high_resolution_clock::time_point crawlservpp::Timer::SimpleHR::timePoint
protected

(Time) point of creation or last tick.

Referenced by clear(), tick(), and tickStr().


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