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;
--- 269 unchanged lines hidden (view full) ---
278void 279Topology::clearStats() 280{ 281 for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++) { 282 m_controller_vector[cntrl]->clearStats(); 283 } 284} 285
|
286void
287Topology::printConfig(std::ostream& out) const
288{
289 if (m_print_config == false)
290 return;
291
292 assert(m_component_latencies.size() > 0);
293
294 out << "--- Begin Topology Print ---" << endl
295 << endl
296 << "Topology print ONLY indicates the _NETWORK_ latency between two "
297 << "machines" << endl
298 << "It does NOT include the latency within the machines" << endl
299 << endl;
300
301 for (int m = 0; m < MachineType_NUM; m++) {
302 int i_end = MachineType_base_count((MachineType)m);
303 for (int i = 0; i < i_end; i++) {
304 MachineID cur_mach = {(MachineType)m, i};
305 out << cur_mach << " Network Latencies" << endl;
306 for (int n = 0; n < MachineType_NUM; n++) {
307 int j_end = MachineType_base_count((MachineType)n);
308 for (int j = 0; j < j_end; j++) {
309 MachineID dest_mach = {(MachineType)n, j};
310 if (cur_mach == dest_mach)
311 continue;
312
313 int src = MachineType_base_number((MachineType)m) + i;
314 int dst = MachineType_base_number(MachineType_NUM) +
315 MachineType_base_number((MachineType)n) + j;
316 int link_latency = m_component_latencies[src][dst];
317 int intermediate_switches =
318 m_component_inter_switches[src][dst];
319
320 // NOTE switches are assumed to have single
321 // cycle latency
322 out << " " << cur_mach << " -> " << dest_mach
323 << " net_lat: "
324 << link_latency + intermediate_switches << endl;
325 }
326 }
327 out << endl;
328 }
329 }
330
331 out << "--- End Topology Print ---" << endl;
332}
333
|
286// The following all-pairs shortest path algorithm is based on the 287// discussion from Cormen et al., Chapter 26.1. 288void 289extend_shortest_path(Matrix& current_dist, Matrix& latencies, 290 Matrix& inter_switches) 291{ 292 bool change = true; 293 int nodes = current_dist.size();
--- 90 unchanged lines hidden --- |