void AsVivaldi::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat)
{
  s_surf_parsing_link_up_down_t info;

  XBT_DEBUG("vivaldi_get_route_and_latency from '%s'[%d] '%s'[%d]",
		  src->getName(), src->getId(), dst->getName(), dst->getId());

  if(src->getRcType() == SURF_NETWORK_ELEMENT_AS) {
    char *src_name = ROUTER_PEER(src->getName());
    char *dst_name = ROUTER_PEER(dst->getName());
    route->gw_src = (sg_routing_edge_t) xbt_lib_get_or_null(as_router_lib, src_name, ROUTING_ASR_LEVEL);
    route->gw_dst = (sg_routing_edge_t) xbt_lib_get_or_null(as_router_lib, dst_name, ROUTING_ASR_LEVEL);
    xbt_free(src_name);
    xbt_free(dst_name);
  }

  double euclidean_dist;
  xbt_dynar_t src_ctn, dst_ctn;
  char *tmp_src_name, *tmp_dst_name;

  if(src->getRcType() == SURF_NETWORK_ELEMENT_HOST){
    tmp_src_name = HOST_PEER(src->getName());

    if(p_linkUpDownList){
      info = xbt_dynar_get_as(p_linkUpDownList, src->getId(), s_surf_parsing_link_up_down_t);
      if(info.link_up) { // link up
        xbt_dynar_push_as(route->link_list, void*, info.link_up);
        if (lat)
          *lat += static_cast<Link*>(info.link_up)->getLatency();
      }
    }
Beispiel #2
0
static void vivaldi_get_route_and_latency(
    AS_t rc, sg_routing_edge_t src_p, sg_routing_edge_t dst_p,
    sg_platf_route_cbarg_t route, double *lat)
{
  s_surf_parsing_link_up_down_t info;

  XBT_DEBUG("vivaldi_get_route_and_latency from '%s'[%d] '%s'[%d]",src_p->name,src_p->id,dst_p->name,dst_p->id);
  char *src = (char*)src_p->name;
  char *dst = (char*)dst_p->name;

  if(src_p->rc_type == SURF_NETWORK_ELEMENT_AS) {
    char *rp_src = ROUTER_PEER(src);
    char *rp_dst = ROUTER_PEER(dst);
    route->gw_src = xbt_lib_get_or_null(as_router_lib, rp_src,
                                        ROUTING_ASR_LEVEL);
    route->gw_dst = xbt_lib_get_or_null(as_router_lib, rp_dst,
                                        ROUTING_ASR_LEVEL);
    xbt_free(rp_src);
    xbt_free(rp_dst);
  }

  double euclidean_dist;
  xbt_dynar_t src_ctn, dst_ctn;
  char *tmp_src_name, *tmp_dst_name;

  if(src_p->rc_type == SURF_NETWORK_ELEMENT_HOST){
    tmp_src_name = HOST_PEER(src);

    if(rc->link_up_down_list){
      info = xbt_dynar_get_as(rc->link_up_down_list,src_p->id,s_surf_parsing_link_up_down_t);
      if(info.link_up) { // link up
        xbt_dynar_push_as(route->link_list,void*,info.link_up);
        if (lat)
          *lat += surf_network_model->extension.network.get_link_latency(info.link_up);
      }