dxd - dynax driver framework 3.0.2
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::timer< event_t, clock_t > Class Template Reference

high resolution timer source: an OS timer wait toward the objective, optionally handing over to yield/spin polling covering the last lead; self pacing by duration like free_run, or paced by an override's sync() More...

#include <dx_clock.h>

Inheritance diagram for dx::timer< event_t, clock_t >:
Collaboration diagram for dx::timer< event_t, clock_t >:

Public Types

typedef _clock_t clock_t
typedef _event_t event_t

Public Member Functions

virtual void sync(const typename clock_t::time_point& now)
super& wait(bool reset= false) override

Public Attributes

std::atomic<dx::stream::clock::strategy> strategy{dx::stream::clock::plain}
 switchable at runtime: the poll modes run only what the timer left

Protected Member Functions

bool sleep(int64_t remaining)
void wait(int64_t remaining)
 waits the remaining ns by the strategy

Static Protected Member Functions

static int64_t now()
static void relax(dx::stream::clock::strategy strategy)

Protected Attributes

std::condition_variable condition_variable
clock_t::duration duration{clock_t::duration::zero()}
_event_t event
std::mutex mutex
_clock_t::time_point objective
std::atomic<bool> running{false}
os_result status{not_initialized}

Friends

struct dx::stream::clock
 its wait() takes now(), sleep() and relax()

Detailed Description

template<typename event_t = event<kernel>, typename clock_t = std::chrono::high_resolution_clock>
class dx::timer< event_t, clock_t >

high resolution timer source: an OS timer wait toward the objective, optionally handing over to yield/spin polling covering the last lead; self pacing by duration like free_run, or paced by an override's sync()

Member Typedef Documentation

◆ clock_t

template<typename _event_t= event<user>, typename _clock_t= std::chrono::high_resolution_clock>
typedef _clock_t dx::source<_event_t, _clock_t>::clock_t
inherited

◆ event_t

template<typename _event_t= event<user>, typename _clock_t= std::chrono::high_resolution_clock>
typedef _event_t dx::source<_event_t, _clock_t>::event_t
inherited

Member Function Documentation

◆ now()

template<typename event_t= event<kernel>, typename clock_t= std::chrono::high_resolution_clock>
int64_t dx::timer<event_t, clock_t>::now()
inlinestaticprotected

◆ relax()

template<typename event_t= event<kernel>, typename clock_t= std::chrono::high_resolution_clock>
void dx::timer<event_t, clock_t>::relax(dx::stream::clock::strategy strategy)
inlinestaticprotected

◆ sleep()

template<typename event_t= event<kernel>, typename clock_t= std::chrono::high_resolution_clock>
bool dx::timer<event_t, clock_t>::sleep(int64_t remaining)
inlineprotected

◆ sync()

template<typename _event_t= event<user>, typename _clock_t= std::chrono::high_resolution_clock>
virtual void dx::source<_event_t, _clock_t>::sync(const typename clock_t::time_point& now)
inlinevirtualinherited
Here is the caller graph for this function:

◆ wait() [1/2]

template<typename event_t= event<kernel>, typename clock_t= std::chrono::high_resolution_clock>
super& dx::timer<event_t, clock_t>::wait(bool reset= false)
inlineoverridevirtual

◆ wait() [2/2]

template<typename event_t= event<kernel>, typename clock_t= std::chrono::high_resolution_clock>
void dx::timer<event_t, clock_t>::wait(int64_t remaining)
inlineprotected

waits the remaining ns by the strategy

◆ dx::stream::clock

template<typename event_t= event<kernel>, typename clock_t= std::chrono::high_resolution_clock>
friend struct dx::stream::clock
friend

its wait() takes now(), sleep() and relax()

Member Data Documentation

◆ condition_variable

template<typename _event_t= event<user>, typename _clock_t= std::chrono::high_resolution_clock>
std::condition_variable dx::source<_event_t, _clock_t>::condition_variable
protectedinherited

◆ duration

template<typename event_t= event<kernel>, typename clock_t= std::chrono::high_resolution_clock>
clock_t::duration dx::timer<event_t, clock_t>::duration{clock_t::duration::zero()}
protected

◆ event

template<typename _event_t= event<user>, typename _clock_t= std::chrono::high_resolution_clock>
_event_t dx::source<_event_t, _clock_t>::event
protectedinherited
Todo
evaluate clock::status replacement (exception?)

◆ mutex

template<typename _event_t= event<user>, typename _clock_t= std::chrono::high_resolution_clock>
std::mutex dx::source<_event_t, _clock_t>::mutex
protectedinherited

◆ objective

template<typename _event_t= event<user>, typename _clock_t= std::chrono::high_resolution_clock>
_clock_t::time_point dx::source<_event_t, _clock_t>::objective
protectedinherited

◆ running

template<typename _event_t= event<user>, typename _clock_t= std::chrono::high_resolution_clock>
std::atomic<bool> dx::source<_event_t, _clock_t>::running{false}
protectedinherited

◆ status

template<typename _event_t= event<user>, typename _clock_t= std::chrono::high_resolution_clock>
os_result dx::source<_event_t, _clock_t>::status{not_initialized}
protectedinherited

◆ strategy

template<typename event_t= event<kernel>, typename clock_t= std::chrono::high_resolution_clock>
std::atomic<dx::stream::clock::strategy> dx::timer<event_t, clock_t>::strategy{dx::stream::clock::plain}

switchable at runtime: the poll modes run only what the timer left


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