Throttle.cc (7453:1a5db3dd0f62) Throttle.cc (7454:3a3e8e8cce1b)
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;

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

80{
81 for (int counter = 0; counter < m_vnets; counter++) {
82 m_in[counter]->clear();
83 m_out[counter]->clear();
84 }
85}
86
87void
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;

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

80{
81 for (int counter = 0; counter < m_vnets; counter++) {
82 m_in[counter]->clear();
83 m_out[counter]->clear();
84 }
85}
86
87void
88Throttle::addLinks(const Vector<MessageBuffer*>& in_vec,
89 const Vector<MessageBuffer*>& out_vec)
88Throttle::addLinks(const std::vector<MessageBuffer*>& in_vec,
89 const std::vector<MessageBuffer*>& out_vec)
90{
91 assert(in_vec.size() == out_vec.size());
92 for (int i=0; i<in_vec.size(); i++) {
93 addVirtualNetwork(in_vec[i], out_vec[i]);
94 }
95
90{
91 assert(in_vec.size() == out_vec.size());
92 for (int i=0; i<in_vec.size(); i++) {
93 addVirtualNetwork(in_vec[i], out_vec[i]);
94 }
95
96 m_message_counters.setSize(MessageSizeType_NUM);
96 m_message_counters.resize(MessageSizeType_NUM);
97 for (int i = 0; i < MessageSizeType_NUM; i++) {
97 for (int i = 0; i < MessageSizeType_NUM; i++) {
98 m_message_counters[i].setSize(in_vec.size());
98 m_message_counters[i].resize(in_vec.size());
99 for (int j = 0; j<m_message_counters[i].size(); j++) {
100 m_message_counters[i][j] = 0;
101 }
102 }
103}
104
105void
106Throttle::addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr)
107{
99 for (int j = 0; j<m_message_counters[i].size(); j++) {
100 m_message_counters[i][j] = 0;
101 }
102 }
103}
104
105void
106Throttle::addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr)
107{
108 m_units_remaining.insertAtBottom(0);
109 m_in.insertAtBottom(in_ptr);
110 m_out.insertAtBottom(out_ptr);
108 m_units_remaining.push_back(0);
109 m_in.push_back(in_ptr);
110 m_out.push_back(out_ptr);
111
112 // Set consumer and description
113 m_in[m_vnets]->setConsumer(this);
114 string desc = "[Queue to Throttle " + NodeIDToString(m_sID) + " " +
115 NodeIDToString(m_node) + "]";
116 m_in[m_vnets]->setDescription(desc);
117 m_vnets++;
118}

--- 158 unchanged lines hidden ---
111
112 // Set consumer and description
113 m_in[m_vnets]->setConsumer(this);
114 string desc = "[Queue to Throttle " + NodeIDToString(m_sID) + " " +
115 NodeIDToString(m_node) + "]";
116 m_in[m_vnets]->setDescription(desc);
117 m_vnets++;
118}

--- 158 unchanged lines hidden ---