Deleted Added
sdiff udiff text old ( 13973:2f953d25716b ) new ( 14217:68c3d00f780a )
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;

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

46 m_time_last_time_enqueue(0), m_time_last_time_pop(0),
47 m_last_arrival_time(0), m_strict_fifo(p->ordered),
48 m_randomization(p->randomization)
49{
50 m_msg_counter = 0;
51 m_consumer = NULL;
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 m_buf_msgs = 0;

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

84 return true;
85 }
86
87 // determine the correct size for the current cycle
88 // pop operations shouldn't effect the network's visible size
89 // until schd cycle, but enqueue operations effect the visible
90 // size immediately
91 unsigned int current_size = 0;
92
93 if (m_time_last_time_pop < current_time) {
94 // no pops this cycle - heap size is correct
95 current_size = m_prio_heap.size();
96 } else {
97 if (m_time_last_time_enqueue < current_time) {
98 // no enqueues this cycle - m_size_at_cycle_start is correct
99 current_size = m_size_at_cycle_start;
100 } else {
101 // both pops and enqueues occured this cycle - add new
102 // enqueued msgs to m_size_at_cycle_start
103 current_size = m_size_at_cycle_start + m_msgs_this_cycle;
104 }
105 }
106
107 // now compare the new size with our max size
108 if (current_size + m_stall_map_size + n <= m_max_size) {
109 return true;
110 } else {
111 DPRINTF(RubyQueue, "n: %d, current_size: %d, heap size: %d, "
112 "m_max_size: %d\n",
113 n, current_size, m_prio_heap.size(), m_max_size);
114 m_not_avail_count++;
115 return false;
116 }
117}
118
119const Message*
120MessageBuffer::peek() const
121{

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

229 Tick delay = message->getDelayedTicks();
230
231 m_stall_time = curTick() - message->getTime();
232
233 // record previous size and time so the current buffer size isn't
234 // adjusted until schd cycle
235 if (m_time_last_time_pop < current_time) {
236 m_size_at_cycle_start = m_prio_heap.size();
237 m_time_last_time_pop = current_time;
238 }
239
240 pop_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MsgPtr>());
241 m_prio_heap.pop_back();
242 if (decrement_messages) {
243 // If the message will be removed from the queue, decrement the
244 // number of message in the queue.

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

269MessageBuffer::clear()
270{
271 m_prio_heap.clear();
272
273 m_msg_counter = 0;
274 m_time_last_time_enqueue = 0;
275 m_time_last_time_pop = 0;
276 m_size_at_cycle_start = 0;
277 m_msgs_this_cycle = 0;
278}
279
280void
281MessageBuffer::recycle(Tick current_time, Tick recycle_latency)
282{
283 DPRINTF(RubyQueue, "Recycling.\n");
284 assert(isReady(current_time));

--- 184 unchanged lines hidden ---