Deleted Added
sdiff udiff text old ( 11793:ef606668d247 ) new ( 11796:315e133f45df )
full compact
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 43 unchanged lines hidden (view full) ---

52 m_size_last_time_size_checked = 0;
53 m_size_at_cycle_start = 0;
54 m_msgs_this_cycle = 0;
55 m_priority_rank = 0;
56
57 m_stall_msg_map.clear();
58 m_input_link_id = 0;
59 m_vnet_id = 0;
60}
61
62unsigned int
63MessageBuffer::getSize(Tick curTime)
64{
65 if (m_time_last_time_size_checked != curTime) {
66 m_time_last_time_size_checked = curTime;
67 m_size_last_time_size_checked = m_prio_heap.size();

--- 123 unchanged lines hidden (view full) ---

191
192 msg_ptr->updateDelayedTicks(current_time);
193 msg_ptr->setLastEnqueueTime(arrival_time);
194 msg_ptr->setMsgCounter(m_msg_counter);
195
196 // Insert the message into the priority heap
197 m_prio_heap.push_back(message);
198 push_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MsgPtr>());
199
200 DPRINTF(RubyQueue, "Enqueue arrival_time: %lld, Message: %s\n",
201 arrival_time, *(message.get()));
202
203 // Schedule the wakeup
204 assert(m_consumer != NULL);
205 m_consumer->scheduleEventAbsolute(arrival_time);
206 m_consumer->storeEventInfo(m_vnet_id);
207}
208
209Tick
210MessageBuffer::dequeue(Tick current_time)
211{
212 DPRINTF(RubyQueue, "Popping\n");
213 assert(isReady(current_time));
214
215 // get MsgPtr of the message about to be dequeued
216 MsgPtr message = m_prio_heap.front();
217
218 // get the delay cycles
219 message->updateDelayedTicks(current_time);
220 Tick delay = message->getDelayedTicks();
221
222 // record previous size and time so the current buffer size isn't
223 // adjusted until schd cycle
224 if (m_time_last_time_pop < current_time) {
225 m_size_at_cycle_start = m_prio_heap.size();
226 m_time_last_time_pop = current_time;
227 }
228
229 pop_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MsgPtr>());
230 m_prio_heap.pop_back();
231
232 return delay;
233}
234
235void
236MessageBuffer::clear()
237{
238 m_prio_heap.clear();

--- 80 unchanged lines hidden (view full) ---

319void
320MessageBuffer::stallMessage(Addr addr, Tick current_time)
321{
322 DPRINTF(RubyQueue, "Stalling due to %#x\n", addr);
323 assert(isReady(current_time));
324 assert(getOffset(addr) == 0);
325 MsgPtr message = m_prio_heap.front();
326
327 dequeue(current_time);
328
329 //
330 // Note: no event is scheduled to analyze the map at a later time.
331 // Instead the controller is responsible to call reanalyzeMessages when
332 // these addresses change state.
333 //
334 (m_stall_msg_map[addr]).push_back(message);
335 m_stall_map_size++;
336}
337
338void
339MessageBuffer::print(ostream& out) const
340{
341 ccprintf(out, "[MessageBuffer: ");
342 if (m_consumer != NULL) {
343 ccprintf(out, " consumer-yes ");

--- 13 unchanged lines hidden (view full) ---

357
358void
359MessageBuffer::regStats()
360{
361 m_not_avail_count
362 .name(name() + ".not_avail_count")
363 .desc("Number of times this buffer did not have N slots available")
364 .flags(Stats::nozero);
365}
366
367uint32_t
368MessageBuffer::functionalWrite(Packet *pkt)
369{
370 uint32_t num_functional_writes = 0;
371
372 // Check the priority heap and write any messages that may

--- 32 unchanged lines hidden ---