+ void *surf_link;
+ unsigned int cpt;
+
+ SD_CHECK_INIT_DONE();
+
+ if (sd_global->recyclable_route == NULL) {
+ /* first run */
+ sd_global->recyclable_route = xbt_new(SD_link_t, SD_link_get_number());
+ }
+
+ surf_src = src->surf_workstation;
+ surf_dst = dst->surf_workstation;
+ surf_route =
+ surf_workstation_model->extension.workstation.get_route(surf_src,
+ surf_dst);
+
+ xbt_dynar_foreach(surf_route, cpt, surf_link) {
+ link_name = surf_resource_name(surf_link);
+ sd_global->recyclable_route[cpt] =
+ xbt_dict_get(sd_global->links, link_name);
+ }
+ return sd_global->recyclable_route;
+}
+
+/**
+ * \brief Returns the number of links on the route between two workstations
+ *
+ * \param src a workstation
+ * \param dst another workstation
+ * \return the number of links on the route between these two workstations
+ * \see SD_route_get_list()
+ */
+int SD_route_get_size(SD_workstation_t src, SD_workstation_t dst)
+{
+ SD_CHECK_INIT_DONE();
+ return xbt_dynar_length(surf_workstation_model->extension.
+ workstation.get_route(src->surf_workstation,
+ dst->surf_workstation));
+}
+
+/**
+ * \brief Returns the total power of a workstation
+ *
+ * \param workstation a workstation
+ * \return the total power of this workstation
+ * \see SD_workstation_get_available_power()
+ */
+double SD_workstation_get_power(SD_workstation_t workstation)
+{
+ SD_CHECK_INIT_DONE();
+ xbt_assert0(workstation != NULL, "Invalid parameter");
+ return surf_workstation_model->extension.workstation.
+ get_speed(workstation->surf_workstation, 1.0);
+}
+
+/**
+ * \brief Returns the proportion of available power in a workstation
+ *
+ * \param workstation a workstation
+ * \return the proportion of power currently available in this workstation (normally a number between 0 and 1)
+ * \see SD_workstation_get_power()
+ */
+double SD_workstation_get_available_power(SD_workstation_t workstation)
+{
+ SD_CHECK_INIT_DONE();
+ xbt_assert0(workstation != NULL, "Invalid parameter");
+ return surf_workstation_model->extension.
+ workstation.get_available_speed(workstation->surf_workstation);
+}
+
+/**
+ * \brief Returns an approximative estimated time for the given computation amount on a workstation
+ *
+ * \param workstation a workstation
+ * \param computation_amount the computation amount you want to evaluate (in flops)
+ * \return an approximative astimated computation time for the given computation amount on this workstation (in seconds)
+ */
+double SD_workstation_get_computation_time(SD_workstation_t workstation,
+ double computation_amount)
+{
+ SD_CHECK_INIT_DONE();
+ xbt_assert0(workstation != NULL, "Invalid parameter");
+ xbt_assert0(computation_amount >= 0,
+ "computation_amount must be greater than or equal to zero");
+ return computation_amount / SD_workstation_get_power(workstation);
+}
+
+/**
+ * \brief Returns the latency of the route between two workstations, i.e. the sum of all link latencies
+ * between the 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)
+{
+
+ const SD_link_t *links;
+ int nb_links;
+ double latency;
+ int i;
+
+ SD_CHECK_INIT_DONE();
+ xbt_assert0(src != NULL && dst != NULL, "Invalid parameter");
+ 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]);
+ }
+
+ return latency;
+}
+
+/**
+ * \brief Returns the bandwidth of the route between two workstations, i.e. the minimum link bandwidth of all
+ * between the workstations.
+ *
+ * \param src the first workstation
+ * \param dst the second workstation
+ * \return the bandwidth of the route between the two workstations (in bytes/second)
+ * \see SD_route_get_current_latency()
+ */
+double SD_route_get_current_bandwidth(SD_workstation_t src,
+ SD_workstation_t dst)
+{
+
+ const SD_link_t *links;
+ int nb_links;
+ double bandwidth;
+ double min_bandwidth;
+ int i;
+
+ SD_CHECK_INIT_DONE();
+ xbt_assert0(src != NULL && dst != NULL, "Invalid parameter");
+
+ links = SD_route_get_list(src, dst);
+ nb_links = SD_route_get_size(src, dst);
+ bandwidth = min_bandwidth = -1.0;
+
+
+ for (i = 0; i < nb_links; i++) {
+ bandwidth = SD_link_get_current_bandwidth(links[i]);
+ if (bandwidth < min_bandwidth || min_bandwidth == -1.0)
+ min_bandwidth = bandwidth;
+ }
+
+ return min_bandwidth;
+}
+
+/**
+ * \brief Returns an approximative estimated time for the given
+ * communication amount between two workstations
+ *
+ * \param src the first workstation
+ * \param dst the second workstation
+ * \param communication_amount the communication amount you want to evaluate (in bytes)
+ * \return an approximative astimated computation time for the given communication amount
+ * between the workstations (in seconds)
+ */
+double SD_route_get_communication_time(SD_workstation_t src,
+ SD_workstation_t dst,
+ double communication_amount)
+{
+
+
+ /* total time = latency + transmission time of the slowest link
+ transmission time of a link = communication amount / link bandwidth */
+
+ const SD_link_t *links;
+ int nb_links;
+ double bandwidth, min_bandwidth;
+ double latency;