diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2014-09-15 16:19:38 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2014-09-15 16:19:38 -0500 |
commit | 2ccdfc547d5b58bdc859e4497658e972d7af5c45 (patch) | |
tree | 4f1d75beb873b84f66612e250b774a149fe2e91e /src/mem/ruby/network/simple/SimpleNetwork.cc | |
parent | 8d18713d28854cef9beef20f22065a769d7a0396 (diff) | |
download | gem5-2ccdfc547d5b58bdc859e4497658e972d7af5c45.tar.xz |
ruby: network: revert some of the changes from ad9c042dce54
The changeset ad9c042dce54 made changes to the structures under the network
directory to use a map of buffers instead of vector of buffers.
The reasoning was that not all vnets that are created are used and we
needlessly allocate more buffers than required and then iterate over them
while processing network messages. But the move to map resulted in a slow
down which was pointed out by Andreas Hansson. This patch moves things
back to using vector of message buffers.
Diffstat (limited to 'src/mem/ruby/network/simple/SimpleNetwork.cc')
-rw-r--r-- | src/mem/ruby/network/simple/SimpleNetwork.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc index f51a0c891..074052cb9 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.cc +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc @@ -117,7 +117,8 @@ SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, const NetDest& routing_table_entry) { // Create a set of new MessageBuffers - std::map<int, MessageBuffer*> queues; + std::vector<MessageBuffer*> queues(m_virtual_networks); + for (int i = 0; i < m_virtual_networks; i++) { // allocate a buffer MessageBuffer* buffer_ptr = new MessageBuffer; @@ -158,6 +159,9 @@ SimpleNetwork::setToNetQueue(NodeID id, bool ordered, int network_num, std::string vnet_type, MessageBuffer *b) { checkNetworkAllocation(id, ordered, network_num); + while (m_toNetQueues[id].size() <= network_num) { + m_toNetQueues[id].push_back(nullptr); + } m_toNetQueues[id][network_num] = b; } @@ -166,6 +170,9 @@ SimpleNetwork::setFromNetQueue(NodeID id, bool ordered, int network_num, std::string vnet_type, MessageBuffer *b) { checkNetworkAllocation(id, ordered, network_num); + while (m_fromNetQueues[id].size() <= network_num) { + m_fromNetQueues[id].push_back(nullptr); + } m_fromNetQueues[id][network_num] = b; } |