MessageBuffer.cc (11796:315e133f45df) | MessageBuffer.cc (11797:f61fbb7ceb88) |
---|---|
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; --- 46 unchanged lines hidden (view full) --- 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; 62 m_stall_time = 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; --- 46 unchanged lines hidden (view full) --- 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; 62 m_stall_time = 0; |
63 64 m_dequeue_callback = nullptr; |
|
63} 64 65unsigned int 66MessageBuffer::getSize(Tick curTime) 67{ 68 if (m_time_last_time_size_checked != curTime) { 69 m_time_last_time_size_checked = curTime; 70 m_size_last_time_size_checked = m_prio_heap.size(); --- 165 unchanged lines hidden (view full) --- 236 pop_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MsgPtr>()); 237 m_prio_heap.pop_back(); 238 if (decrement_messages) { 239 // If the message will be removed from the queue, decrement the 240 // number of message in the queue. 241 m_buf_msgs--; 242 } 243 | 65} 66 67unsigned int 68MessageBuffer::getSize(Tick curTime) 69{ 70 if (m_time_last_time_size_checked != curTime) { 71 m_time_last_time_size_checked = curTime; 72 m_size_last_time_size_checked = m_prio_heap.size(); --- 165 unchanged lines hidden (view full) --- 238 pop_heap(m_prio_heap.begin(), m_prio_heap.end(), greater<MsgPtr>()); 239 m_prio_heap.pop_back(); 240 if (decrement_messages) { 241 // If the message will be removed from the queue, decrement the 242 // number of message in the queue. 243 m_buf_msgs--; 244 } 245 |
246 // if a dequeue callback was requested, call it now 247 if (m_dequeue_callback) { 248 m_dequeue_callback(); 249 } 250 |
|
244 return delay; 245} 246 247void | 251 return delay; 252} 253 254void |
255MessageBuffer::registerDequeueCallback(std::function<void()> callback) 256{ 257 m_dequeue_callback = callback; 258} 259 260void 261MessageBuffer::unregisterDequeueCallback() 262{ 263 m_dequeue_callback = nullptr; 264} 265 266void |
|
248MessageBuffer::clear() 249{ 250 m_prio_heap.clear(); 251 252 m_msg_counter = 0; 253 m_time_last_time_enqueue = 0; 254 m_time_last_time_pop = 0; 255 m_size_at_cycle_start = 0; --- 190 unchanged lines hidden --- | 267MessageBuffer::clear() 268{ 269 m_prio_heap.clear(); 270 271 m_msg_counter = 0; 272 m_time_last_time_enqueue = 0; 273 m_time_last_time_pop = 0; 274 m_size_at_cycle_start = 0; --- 190 unchanged lines hidden --- |