Commit 74d1f3f3 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

lib/nicbm: add priority field for timed events to break tieas

This can help break ties consistently when multiple events have the same
timestamp.
parent 793050f3
...@@ -50,8 +50,10 @@ class DMAOp { ...@@ -50,8 +50,10 @@ class DMAOp {
class TimedEvent { class TimedEvent {
public: public:
TimedEvent() : time_(0), priority_(0) {}
virtual ~TimedEvent() = default; virtual ~TimedEvent() = default;
uint64_t time_; uint64_t time_;
int priority_;
}; };
/** /**
...@@ -117,7 +119,8 @@ class Runner { ...@@ -117,7 +119,8 @@ class Runner {
protected: protected:
struct EventCmp { struct EventCmp {
bool operator()(TimedEvent *a, TimedEvent *b) const { bool operator()(TimedEvent *a, TimedEvent *b) const {
return a->time_ < b->time_; return a->time_ < b->time_ ||
(a->time_ == b->time_ && a->priority_ < b->priority_);
} }
}; };
......
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