2#ifndef CLICK_TIMERSET_HH
3#define CLICK_TIMERSET_HH 1
12class TimerSet {
public:
16 Timestamp timer_expiry_steady()
const {
return _timer_expiry; }
17 inline Timestamp timer_expiry_steady_adjusted()
const;
19 inline int next_timer_delay(
bool more_tasks,
Timestamp &t)
const;
24 unsigned max_timer_stride()
const {
return _max_timer_stride; }
25 unsigned timer_stride()
const {
return _timer_stride; }
26 void set_max_timer_stride(
unsigned timer_stride);
28 void kill_router(
Router *router);
42 heap_element(
Timer *t_)
43 : expiry_s(t_->expiry_steady()), t(t_) {
47 inline bool operator()(
const heap_element &a,
const heap_element &b) {
48 return a.expiry_s < b.expiry_s;
52 inline void operator()(heap_element *begin, heap_element *t) {
53 t->t->_schedpos1 = (t - begin) + 1;
60 unsigned _max_timer_stride;
61 unsigned _timer_stride;
62 unsigned _timer_count;
67 struct task_struct *_timer_task;
69 click_processor_t _timer_processor;
72 uint32_t _timer_check_reports;
74 inline void run_one_timer(
Timer *);
76 void set_timer_expiry() {
77 if (_timer_heap.
size())
82 void check_timer_expiry(
Timer *t);
84 inline void lock_timers();
85 inline bool attempt_lock_timers();
86 inline void unlock_timers();
93TimerSet::timer_expiry_steady_adjusted()
const
97 if (likely(!Timestamp::warp_jumping())) {
99 if (_timer_stride >= 8 || !e)
101 else if (_timer_stride >= 4)
105#if TIMESTAMP_WARPABLE
112TimerSet::lock_timers()
115 if (current != _timer_task)
117#elif HAVE_MULTITHREAD
118 if (click_current_processor() != _timer_processor)
124TimerSet::attempt_lock_timers()
126#if CLICK_LINUXMODULE || HAVE_MULTITHREAD
134TimerSet::unlock_timers()
137 if (current != _timer_task)
139#elif HAVE_MULTITHREAD
140 if (click_current_processor() != _timer_processor)
153TimerSet::next_timer()
A router configuration.
Definition router.hh:28
A set of Tasks scheduled on the same CPU.
Definition routerthread.hh:32
A non-recursive spinlock for SMP Click threads.
Definition sync.hh:587
bool attempt()
Attempts to acquire the SimpleSpinlock.
Definition sync.hh:648
void release()
Releases the SimpleSpinlock.
Definition sync.hh:665
void acquire()
Acquires the SimpleSpinlock.
Definition sync.hh:628
Triggers execution at a given time.
Definition timer.hh:14
static Timestamp adjustment()
Return an adjustment interval useful for precise timers.
Definition timer.hh:307
Represents a moment or interval in time.
Definition timestamp.hh:125
Vector template.
Definition vector.hh:111
bool empty() const
Test if the vector is empty (size() == 0).
Definition vector.hh:237
T & unchecked_at(size_type i)
Return a reference to the ith element.
Definition vector.hh:350
size_type size() const
Return the number of elements.
Definition vector.hh:231
Classes for synchronizing among multiple CPUs, particularly in the Linux kernel.
Support for Timer, which triggers execution at a given time.
Click's vector container template.