m_time_last_time_pop(0), m_last_arrival_time(0)
{
m_msg_counter = 0;
- m_consumer_ptr = NULL;
- m_sender_ptr = NULL;
- m_receiver_ptr = NULL;
+ m_consumer = NULL;
+ m_sender = NULL;
+ m_receiver = NULL;
m_ordering_set = false;
m_strict_fifo = true;
int
MessageBuffer::getSize()
{
- if (m_time_last_time_size_checked == m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_size_checked == m_receiver->curCycle()) {
return m_size_last_time_size_checked;
} else {
- m_time_last_time_size_checked = m_receiver_ptr->curCycle();
+ m_time_last_time_size_checked = m_receiver->curCycle();
m_size_last_time_size_checked = m_size;
return m_size;
}
// until next cycle, but enqueue operations effect the visible
// size immediately
int current_size = max(m_size_at_cycle_start, m_size);
- if (m_time_last_time_pop < m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_pop < m_receiver->curCycle()) {
// no pops this cycle - m_size is correct
current_size = m_size;
} else {
- if (m_time_last_time_enqueue < m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_enqueue < m_receiver->curCycle()) {
// no enqueues this cycle - m_size_at_cycle_start is correct
current_size = m_size_at_cycle_start;
} else {
m_size++;
// record current time incase we have a pop that also adjusts my size
- if (m_time_last_time_enqueue < m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_enqueue < m_receiver->curCycle()) {
m_msgs_this_cycle = 0; // first msg this cycle
- m_time_last_time_enqueue = m_receiver_ptr->curCycle();
+ m_time_last_time_enqueue = m_receiver->curCycle();
}
m_msgs_this_cycle++;
// Calculate the arrival time of the message, that is, the first
// cycle the message can be dequeued.
assert(delay > 0);
- Cycles delta = m_receiver_ptr->ticksToCycles(delay *
- m_sender_ptr->clockPeriod());
+ Cycles delta = m_receiver->ticksToCycles(delay * m_sender->clockPeriod());
- Cycles current_time(m_receiver_ptr->curCycle());
+ Cycles current_time(m_receiver->curCycle());
Cycles arrival_time(0);
if (!RubySystem::getRandomization() || (m_randomization == false)) {
if (arrival_time < m_last_arrival_time) {
panic("FIFO ordering violated: %s name: %s current time: %d "
"delta: %d arrival_time: %d last arrival_time: %d\n",
- *this, m_name, current_time * m_receiver_ptr->clockPeriod(),
- delta * m_receiver_ptr->clockPeriod(),
- arrival_time * m_receiver_ptr->clockPeriod(),
- m_last_arrival_time * m_receiver_ptr->clockPeriod());
+ *this, m_name, current_time * m_receiver->clockPeriod(),
+ delta * m_receiver->clockPeriod(),
+ arrival_time * m_receiver->clockPeriod(),
+ m_last_arrival_time * m_receiver->clockPeriod());
}
}
Message* msg_ptr = message.get();
assert(msg_ptr != NULL);
- assert(m_receiver_ptr->clockEdge() >= msg_ptr->getLastEnqueueTime() &&
+ assert(m_receiver->clockEdge() >= msg_ptr->getLastEnqueueTime() &&
"ensure we aren't dequeued early");
- msg_ptr->setDelayedTicks(m_receiver_ptr->clockEdge() -
+ msg_ptr->setDelayedTicks(m_receiver->clockEdge() -
msg_ptr->getLastEnqueueTime() +
msg_ptr->getDelayedTicks());
- msg_ptr->setLastEnqueueTime(arrival_time * m_receiver_ptr->clockPeriod());
+ msg_ptr->setLastEnqueueTime(arrival_time * m_receiver->clockPeriod());
// Insert the message into the priority heap
- MessageBufferNode thisNode(arrival_time * m_receiver_ptr->clockPeriod(),
+ MessageBufferNode thisNode(arrival_time * m_receiver->clockPeriod(),
m_msg_counter, message);
m_prio_heap.push_back(thisNode);
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
DPRINTF(RubyQueue, "Enqueue arrival_time: %lld, Message: %s\n",
- arrival_time * m_receiver_ptr->clockPeriod(), *(message.get()));
+ arrival_time * m_receiver->clockPeriod(), *(message.get()));
// Schedule the wakeup
- if (m_consumer_ptr != NULL) {
- m_consumer_ptr->scheduleEventAbsolute(
- arrival_time * m_receiver_ptr->clockPeriod());
- m_consumer_ptr->storeEventInfo(m_vnet_id);
+ if (m_consumer != NULL) {
+ m_consumer->scheduleEventAbsolute(
+ arrival_time * m_receiver->clockPeriod());
+ m_consumer->storeEventInfo(m_vnet_id);
} else {
panic("No consumer: %s name: %s\n", *this, m_name);
}
// record previous size and time so the current buffer size isn't
// adjusted until next cycle
- if (m_time_last_time_pop < m_receiver_ptr->curCycle()) {
+ if (m_time_last_time_pop < m_receiver->curCycle()) {
m_size_at_cycle_start = m_size;
- m_time_last_time_pop = m_receiver_ptr->curCycle();
+ m_time_last_time_pop = m_receiver->curCycle();
}
m_size--;
}
pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- node.m_time = (m_receiver_ptr->curCycle() + m_recycle_latency) *
- m_receiver_ptr->clockPeriod();
+ node.m_time = (m_receiver->curCycle() + m_recycle_latency) *
+ m_receiver->clockPeriod();
m_prio_heap.back() = node;
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->
- scheduleEventAbsolute(m_receiver_ptr->clockEdge(m_recycle_latency));
+ m_consumer->
+ scheduleEventAbsolute(m_receiver->clockEdge(m_recycle_latency));
}
void
{
DPRINTF(RubyQueue, "ReanalyzeMessages\n");
assert(m_stall_msg_map.count(addr) > 0);
- Tick nextTick = m_receiver_ptr->clockEdge(Cycles(1));
+ Tick nextTick = m_receiver->clockEdge(Cycles(1));
//
// Put all stalled messages associated with this address back on the
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->scheduleEventAbsolute(nextTick);
+ m_consumer->scheduleEventAbsolute(nextTick);
m_stall_msg_map[addr].pop_front();
}
m_stall_msg_map.erase(addr);
MessageBuffer::reanalyzeAllMessages()
{
DPRINTF(RubyQueue, "ReanalyzeAllMessages %s\n");
- Tick nextTick = m_receiver_ptr->clockEdge(Cycles(1));
+ Tick nextTick = m_receiver->clockEdge(Cycles(1));
//
// Put all stalled messages associated with this address back on the
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- m_consumer_ptr->scheduleEventAbsolute(nextTick);
+ m_consumer->scheduleEventAbsolute(nextTick);
(map_iter->second).pop_front();
}
}
// this function should only be called on dequeue
// ensure the msg hasn't been enqueued
- assert(msg_ptr->getLastEnqueueTime() <= m_receiver_ptr->clockEdge());
+ assert(msg_ptr->getLastEnqueueTime() <= m_receiver->clockEdge());
- msg_ptr->setDelayedTicks(m_receiver_ptr->clockEdge() -
- msg_ptr->getLastEnqueueTime() +
- msg_ptr->getDelayedTicks());
+ msg_ptr->setDelayedTicks(m_receiver->clockEdge() -
+ msg_ptr->getLastEnqueueTime() +
+ msg_ptr->getDelayedTicks());
- return m_receiver_ptr->ticksToCycles(msg_ptr->getDelayedTicks());
+ return m_receiver->ticksToCycles(msg_ptr->getDelayedTicks());
}
void
MessageBuffer::print(ostream& out) const
{
ccprintf(out, "[MessageBuffer: ");
- if (m_consumer_ptr != NULL) {
+ if (m_consumer != NULL) {
ccprintf(out, " consumer-yes ");
}
MessageBuffer::isReady() const
{
return ((m_prio_heap.size() > 0) &&
- (m_prio_heap.front().m_time <= m_receiver_ptr->clockEdge()));
+ (m_prio_heap.front().m_time <= m_receiver->clockEdge()));
}
bool
bool areNSlotsAvailable(int n);
int getPriority() { return m_priority_rank; }
void setPriority(int rank) { m_priority_rank = rank; }
- void setConsumer(Consumer* consumer_ptr)
+ void setConsumer(Consumer* consumer)
{
- assert(m_consumer_ptr == NULL);
- m_consumer_ptr = consumer_ptr;
+ assert(m_consumer == NULL);
+ m_consumer = consumer;
}
void setSender(ClockedObject* obj)
{
- assert(m_sender_ptr == NULL || m_sender_ptr == obj);
- m_sender_ptr = obj;
+ assert(m_sender == NULL || m_sender == obj);
+ m_sender = obj;
}
void setReceiver(ClockedObject* obj)
{
- assert(m_receiver_ptr == NULL || m_receiver_ptr == obj);
- m_receiver_ptr = obj;
+ assert(m_receiver == NULL || m_receiver == obj);
+ m_receiver = obj;
}
void setDescription(const std::string& name) { m_name = name; }
std::string getDescription() { return m_name;}
- Consumer* getConsumer() { return m_consumer_ptr; }
+ Consumer* getConsumer() { return m_consumer; }
const Message* peekAtHeadOfQueue() const;
const Message* peek() const { return peekAtHeadOfQueue(); }
// Data Members (m_ prefix)
//! The two ends of the buffer.
- ClockedObject* m_sender_ptr;
- ClockedObject* m_receiver_ptr;
+ ClockedObject* m_sender;
+ ClockedObject* m_receiver;
//! Consumer to signal a wakeup(), can be NULL
- Consumer* m_consumer_ptr;
+ Consumer* m_consumer;
std::vector<MessageBufferNode> m_prio_heap;
// use a std::map for the stalled messages as this container is