join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::Rdtsc Class Reference

rdtsc clock policy (invariant TSC, CPU pinning, no NTP slewing). More...

#include <clock.hpp>

Public Types

using Duration = std::chrono::nanoseconds
 
using TimePoint = std::chrono::time_point<NanoClock>
 
using Stats = BasicStats<Rdtsc>
 
template<size_t Capacity, uint64_t TickNs = 100>
using Wheel = BasicWheel<Rdtsc, SpinPolicy<Rdtsc>, Capacity, TickNs>
 

Public Member Functions

 Rdtsc ()
 default constructor.
 

Static Public Member Functions

static bool invariant () noexcept
 check if the cycle counter is invariant.
 
static void calibrate () noexcept
 calibrate against CLOCK_MONOTONIC, or CNTFRQ on ARM.
 
static TimePoint now () noexcept
 read the current time, requires calibrate ().
 

Detailed Description

rdtsc clock policy (invariant TSC, CPU pinning, no NTP slewing).

Member Typedef Documentation

◆ Duration

using join::Rdtsc::Duration = std::chrono::nanoseconds

◆ Stats

◆ TimePoint

using join::Rdtsc::TimePoint = std::chrono::time_point<NanoClock>

◆ Wheel

template<size_t Capacity, uint64_t TickNs = 100>
using join::Rdtsc::Wheel = BasicWheel<Rdtsc, SpinPolicy<Rdtsc>, Capacity, TickNs>

Constructor & Destructor Documentation

◆ Rdtsc()

join::Rdtsc::Rdtsc ( )
inline

default constructor.

Exceptions
std::runtime_errorif the cycle counter is not invariant.

Member Function Documentation

◆ calibrate()

static void join::Rdtsc::calibrate ( )
inlinestaticnoexcept

calibrate against CLOCK_MONOTONIC, or CNTFRQ on ARM.

◆ invariant()

static bool join::Rdtsc::invariant ( )
inlinestaticnoexcept

check if the cycle counter is invariant.

Returns
true if invariant.

◆ now()

static TimePoint join::Rdtsc::now ( )
inlinestaticnoexcept

read the current time, requires calibrate ().

Returns
current time, zero if uncalibrated.

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