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_stalled_at_cycle_start = 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;
94
95 if (m_time_last_time_pop < current_time) {
96 // no pops this cycle - heap and stall queue size is correct
97 current_size = m_prio_heap.size();
98 current_stall_size = m_stall_map_size;
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;
111 }
112
113 // now compare the new size with our max size
114 if (current_size + current_stall_size + n <= m_max_size) {
115 return true;
116 } else {
117 DPRINTF(RubyQueue, "n: %d, current_size: %d, heap size: %d, "
118 "m_max_size: %d\n",
119 n, current_size + current_stall_size,
120 m_prio_heap.size(), m_max_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;
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;
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 ---