From 9fc66c42a83d33d9b0a10c120228c84406755845 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Tue, 19 Jan 2016 12:00:37 +0100 Subject: [PATCH] Replace manual latency computation by call to proper function. Revalidate tesh --- examples/simdag/test_simdag.tesh | 2 +- src/simdag/sd_workstation.cpp | 26 +++++++++----------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/examples/simdag/test_simdag.tesh b/examples/simdag/test_simdag.tesh index d81c7868bd..5da3a1bc8a 100644 --- a/examples/simdag/test_simdag.tesh +++ b/examples/simdag/test_simdag.tesh @@ -15,6 +15,6 @@ $ $SG_TEST_EXENV ./sd_test ${srcdir:=.}/../platforms/platform.xml > [0.000000] [sd_test/INFO] Route latency = 0.070615, route bandwidth = 472125.000000 > [0.000000] [sd_test/INFO] Communication time for 2000000.000000 bytes between Jacquelin and Intel: 4.306781 > [0.000000] [sd_test/INFO] Communication time for 3000000.000000 bytes between Intel and Jacquelin: 6.424864 -> [0.000000] [sd_test/INFO] Estimated time for 'Task D': 6.432146 +> [0.000000] [sd_test/INFO] Estimated time for 'Task D': 6.502761 > [21.322061] [sd_test/INFO] Task 'Task D' start time: 0.000000, finish time: 10.661030 > [21.322061] [sd_test/INFO] Task 'Task B' start time: 10.661030, finish time: 21.322061 diff --git a/src/simdag/sd_workstation.cpp b/src/simdag/sd_workstation.cpp index 45ab1928df..d40c185eb6 100644 --- a/src/simdag/sd_workstation.cpp +++ b/src/simdag/sd_workstation.cpp @@ -296,30 +296,20 @@ double SD_workstation_get_computation_time(SD_workstation_t workstation, } /** - * \brief Returns the latency of the route between two workstations, i.e. the sum of all link latencies - * between the workstations. + * \brief Returns the latency of the route between two workstations. * * \param src the first workstation * \param dst the second workstation * \return the latency of the route between the two workstations (in seconds) * \see SD_route_get_current_bandwidth() */ -double SD_route_get_current_latency(SD_workstation_t src, - SD_workstation_t dst) +double SD_route_get_current_latency(SD_workstation_t src, SD_workstation_t dst) { - - const SD_link_t *links; - int nb_links; + xbt_dynar_t route = NULL; double latency; - int i; - links = SD_route_get_list(src, dst); - nb_links = SD_route_get_size(src, dst); - latency = 0.0; - - for (i = 0; i < nb_links; i++) { - latency += SD_link_get_current_latency(links[i]); - } + routing_platf->getRouteAndLatency(src->pimpl_netcard, dst->pimpl_netcard, + &route, &latency); return latency; } @@ -376,6 +366,7 @@ double SD_route_get_communication_time(SD_workstation_t src, transmission time of a link = communication amount / link bandwidth */ const SD_link_t *links; + xbt_dynar_t route = NULL; int nb_links; double bandwidth, min_bandwidth; double latency; @@ -387,13 +378,14 @@ double SD_route_get_communication_time(SD_workstation_t src, if (bytes_amount == 0.0) return 0.0; + routing_platf->getRouteAndLatency(src->pimpl_netcard, dst->pimpl_netcard, + &route, &latency); + links = SD_route_get_list(src, dst); nb_links = SD_route_get_size(src, dst); min_bandwidth = -1.0; - latency = 0; for (i = 0; i < nb_links; i++) { - latency += SD_link_get_current_latency(links[i]); bandwidth = SD_link_get_current_bandwidth(links[i]); if (bandwidth < min_bandwidth || min_bandwidth == -1.0) min_bandwidth = bandwidth; -- 2.20.1