Topology.cc (9356:b279bad40aa3) Topology.cc (9496:28d88a0fda74)
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;

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

84 // topology and networks utilize uni-directional links. Thus each
85 // BasicLink is converted to two calls to add link, on for each direction
86 for (vector<BasicExtLink*>::const_iterator i = params()->ext_links.begin();
87 i != params()->ext_links.end(); ++i) {
88 BasicExtLink *ext_link = (*i);
89 AbstractController *abs_cntrl = ext_link->params()->ext_node;
90 BasicRouter *router = ext_link->params()->int_node;
91
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;

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

84 // topology and networks utilize uni-directional links. Thus each
85 // BasicLink is converted to two calls to add link, on for each direction
86 for (vector<BasicExtLink*>::const_iterator i = params()->ext_links.begin();
87 i != params()->ext_links.end(); ++i) {
88 BasicExtLink *ext_link = (*i);
89 AbstractController *abs_cntrl = ext_link->params()->ext_node;
90 BasicRouter *router = ext_link->params()->int_node;
91
92 // Store the controller and ExtLink pointers for later
93 m_controller_vector.push_back(abs_cntrl);
92 // Store the ExtLink pointers for later
94 m_ext_link_vector.push_back(ext_link);
95
96 int ext_idx1 = abs_cntrl->params()->cntrl_id;
97 int ext_idx2 = ext_idx1 + m_nodes;
98 int int_idx = router->params()->router_id + 2*m_nodes;
99
100 // create the internal uni-directional links in both directions
101 // the first direction is marked: In

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

260 src_dest.second = dest;
261 link_entry = m_link_map[src_dest];
262 net->makeInternalLink(src - (2 * m_nodes), dest - (2 * m_nodes),
263 link_entry.link, link_entry.direction,
264 routing_table_entry, isReconfiguration);
265 }
266}
267
93 m_ext_link_vector.push_back(ext_link);
94
95 int ext_idx1 = abs_cntrl->params()->cntrl_id;
96 int ext_idx2 = ext_idx1 + m_nodes;
97 int int_idx = router->params()->router_id + 2*m_nodes;
98
99 // create the internal uni-directional links in both directions
100 // the first direction is marked: In

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

259 src_dest.second = dest;
260 link_entry = m_link_map[src_dest];
261 net->makeInternalLink(src - (2 * m_nodes), dest - (2 * m_nodes),
262 link_entry.link, link_entry.direction,
263 routing_table_entry, isReconfiguration);
264 }
265}
266
268void
269Topology::printStats(std::ostream& out) const
270{
271 for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++) {
272 m_controller_vector[cntrl]->printStats(out);
273 }
274}
275
276void
277Topology::clearStats()
278{
279 for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++) {
280 m_controller_vector[cntrl]->clearStats();
281 }
282}
283
284// The following all-pairs shortest path algorithm is based on the
285// discussion from Cormen et al., Chapter 26.1.
286void
287extend_shortest_path(Matrix& current_dist, Matrix& latencies,
288 Matrix& inter_switches)
289{
290 bool change = true;
291 int nodes = current_dist.size();

--- 90 unchanged lines hidden ---
267// The following all-pairs shortest path algorithm is based on the
268// discussion from Cormen et al., Chapter 26.1.
269void
270extend_shortest_path(Matrix& current_dist, Matrix& latencies,
271 Matrix& inter_switches)
272{
273 bool change = true;
274 int nodes = current_dist.size();

--- 90 unchanged lines hidden ---