MessageBuffer.cc (13973:2f953d25716b) MessageBuffer.cc (14217:68c3d00f780a)
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;
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_stalled_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;
55 m_msgs_this_cycle = 0;
56 m_priority_rank = 0;
57
58 m_stall_msg_map.clear();
59 m_input_link_id = 0;
60 m_vnet_id = 0;
61
62 m_buf_msgs = 0;

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

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

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

236 Tick delay = message->getDelayedTicks();
237
238 m_stall_time = curTick() - message->getTime();
239
240 // record previous size and time so the current buffer size isn't
241 // adjusted until schd cycle
242 if (m_time_last_time_pop < current_time) {
243 m_size_at_cycle_start = m_prio_heap.size();
244 m_stalled_at_cycle_start = m_stall_map_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;
245 m_time_last_time_pop = current_time;
246 }
247
248 pop_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MsgPtr>());
249 m_prio_heap.pop_back();
250 if (decrement_messages) {
251 // If the message will be removed from the queue, decrement the
252 // number of message in the queue.

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

277MessageBuffer::clear()
278{
279 m_prio_heap.clear();
280
281 m_msg_counter = 0;
282 m_time_last_time_enqueue = 0;
283 m_time_last_time_pop = 0;
284 m_size_at_cycle_start = 0;
285 m_stalled_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 ---
286 m_msgs_this_cycle = 0;
287}
288
289void
290MessageBuffer::recycle(Tick current_time, Tick recycle_latency)
291{
292 DPRINTF(RubyQueue, "Recycling.\n");
293 assert(isReady(current_time));

--- 184 unchanged lines hidden ---