Commit ac748567 authored by Juho Snellman's avatar Juho Snellman

Rename HierarchicalTimerWheel to just TimerWheel

- No intention of supporting non-hierarchical wheels, so that part
  of the name was just noise.
parent 667b2cf8
......@@ -39,7 +39,7 @@
bool test_single_timer_no_hierarchy() {
typedef std::function<void()> Callback;
HierarchicalTimerWheel timers;
TimerWheel timers;
int count = 0;
TimerEvent<Callback> timer([&count] () { ++count; });
......@@ -76,7 +76,7 @@ bool test_single_timer_no_hierarchy() {
bool test_single_timer_hierarchy() {
typedef std::function<void()> Callback;
HierarchicalTimerWheel timers;
TimerWheel timers;
int count = 0;
TimerEvent<Callback> timer([&count] () { ++count; });
......@@ -119,7 +119,7 @@ bool test_single_timer_hierarchy() {
bool test_single_timer_random() {
typedef std::function<void()> Callback;
HierarchicalTimerWheel timers;
TimerWheel timers;
int count = 0;
TimerEvent<Callback> timer([&count] () { ++count; });
......@@ -143,7 +143,7 @@ public:
: inc_timer_(this), reset_timer_(this) {
}
void start(HierarchicalTimerWheel* timers) {
void start(TimerWheel* timers) {
timers->schedule(&inc_timer_, 10);
timers->schedule(&reset_timer_, 15);
}
......@@ -165,7 +165,7 @@ private:
};
bool test_timeout_method() {
HierarchicalTimerWheel timers;
TimerWheel timers;
Test test;
test.start(&timers);
......
......@@ -15,7 +15,7 @@
typedef uint64_t Tick;
class TimerWheelSlot;
class HierarchicalTimerWheel;
class TimerWheel;
class TimerEventInterface {
public:
......@@ -114,11 +114,11 @@ private:
TimerEventInterface* events_ = NULL;
};
class HierarchicalTimerWheel {
class TimerWheel {
public:
HierarchicalTimerWheel()
TimerWheel()
: now_(0),
up_(new HierarchicalTimerWheel(WIDTH_BITS, this)),
up_(new TimerWheel(WIDTH_BITS, this)),
down_(NULL) {
}
......@@ -157,14 +157,14 @@ public:
}
private:
HierarchicalTimerWheel(const HierarchicalTimerWheel& other) = delete;
HierarchicalTimerWheel& operator=(const HierarchicalTimerWheel& other) = delete;
TimerWheel(const TimerWheel& other) = delete;
TimerWheel& operator=(const TimerWheel& other) = delete;
HierarchicalTimerWheel(int offset, HierarchicalTimerWheel* down)
TimerWheel(int offset, TimerWheel* down)
: now_(0),
down_(down) {
if (offset + WIDTH_BITS < 64) {
up_ = new HierarchicalTimerWheel(offset + WIDTH_BITS, this);
up_ = new TimerWheel(offset + WIDTH_BITS, this);
}
}
......@@ -191,8 +191,8 @@ private:
static const int NUM_SLOTS = 1 << WIDTH_BITS;
static const int MASK = (NUM_SLOTS - 1);
TimerWheelSlot slots_[NUM_SLOTS];
HierarchicalTimerWheel* up_;
HierarchicalTimerWheel* down_;
TimerWheel* up_;
TimerWheel* down_;
};
void TimerEventInterface::cancel() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment