ruby: Fix overflow reported by ASAN in MessageBuffer.
In MessageBuffer the m_not_avail_count member is incremented but not used. This causes an overflow reported by ASAN. This patch changes from an int to Stats::Scalar, since the count is useful in debugging finite MessageBuffers.
This commit is contained in:
parent
7520331402
commit
80607a2a1d
2 changed files with 13 additions and 3 deletions
|
@ -51,7 +51,6 @@ MessageBuffer::MessageBuffer(const Params *p)
|
|||
m_size_last_time_size_checked = 0;
|
||||
m_size_at_cycle_start = 0;
|
||||
m_msgs_this_cycle = 0;
|
||||
m_not_avail_count = 0;
|
||||
m_priority_rank = 0;
|
||||
|
||||
m_stall_msg_map.clear();
|
||||
|
@ -350,6 +349,15 @@ MessageBuffer::isReady(Tick current_time) const
|
|||
(m_prio_heap.front()->getLastEnqueueTime() <= current_time));
|
||||
}
|
||||
|
||||
void
|
||||
MessageBuffer::regStats()
|
||||
{
|
||||
m_not_avail_count
|
||||
.name(name() + ".not_avail_count")
|
||||
.desc("Number of times this buffer did not have N slots available")
|
||||
.flags(Stats::nozero);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
MessageBuffer::functionalWrite(Packet *pkt)
|
||||
{
|
||||
|
|
|
@ -116,6 +116,8 @@ class MessageBuffer : public SimObject
|
|||
void setIncomingLink(int link_id) { m_input_link_id = link_id; }
|
||||
void setVnet(int net) { m_vnet_id = net; }
|
||||
|
||||
void regStats();
|
||||
|
||||
// Function for figuring out if any of the messages in the buffer need
|
||||
// to be updated with the data from the packet.
|
||||
// Return value indicates the number of messages that were updated.
|
||||
|
@ -150,8 +152,8 @@ class MessageBuffer : public SimObject
|
|||
unsigned int m_size_at_cycle_start;
|
||||
unsigned int m_msgs_this_cycle;
|
||||
|
||||
int m_not_avail_count; // count the # of times I didn't have N
|
||||
// slots available
|
||||
Stats::Scalar m_not_avail_count; // count the # of times I didn't have N
|
||||
// slots available
|
||||
uint64_t m_msg_counter;
|
||||
int m_priority_rank;
|
||||
const bool m_strict_fifo;
|
||||
|
|
Loading…
Reference in a new issue