-static int surf_parse_bypass_platform()
-{
- char buffer[22];
- unsigned int i,j;
- char* link_id;
-
- p_host_attr p_host;
- p_link_attr p_link;
- p_route_attr p_route;
-
- static int AX_ptr = 0;
- static int surfxml_bufferstack_size = 2048;
-
- /* FIXME allocating memory for the buffer, I think 2kB should be enough */
- surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
- /* <platform> */
- SURFXML_BUFFER_SET(platform_version, "2");
-#ifndef BYPASS_CPU
- SURFXML_START_TAG(platform);
-#endif
-
- // Add Hosts
- xbt_dynar_foreach(host_list_d,i,p_host)
- {
-
-#ifdef BYPASS_MODEL
- INFO0("Bypass_Cpu");
- create_host(p_host->id,p_host->power_peak,p_host->power_scale,p_host->power_trace,
- p_host->state_initial,p_host->state_trace);
- //add to routing model host list
- surf_route_add_host((char*)p_host->id);
-#else
-
- SURFXML_BUFFER_SET(host_id,p_host->id);
- sprintf(buffer,"%f",p_host->power_peak);
- SURFXML_BUFFER_SET(host_power,buffer);
- SURFXML_BUFFER_SET(host_availability, "1.0");
- SURFXML_BUFFER_SET(host_availability_file, "");
- A_surfxml_host_state = A_surfxml_host_state_ON;
- SURFXML_BUFFER_SET(host_state_file, "");
- SURFXML_BUFFER_SET(host_interference_send, "1.0");
- SURFXML_BUFFER_SET(host_interference_recv, "1.0");
- SURFXML_BUFFER_SET(host_interference_send_recv, "1.0");
- SURFXML_BUFFER_SET(host_max_outgoing_rate, "-1.0");
- SURFXML_START_TAG(host);
- SURFXML_END_TAG(host);
-#endif
- }
-
- //add Links
- INFO0("Start Adding Links");
- xbt_dynar_foreach(link_list_d,i,p_link)
- {
-#ifdef BYPASS_MODEL
-
- INFO0("Bypass_Network");
- surf_link_create_resouce((char*)p_link->id,p_link->bandwidth,p_link->latency);
-#else
-
- SURFXML_BUFFER_SET(link_id,p_link->id);
- sprintf(buffer,"%f",p_link->bandwidth);
- SURFXML_BUFFER_SET(link_bandwidth,buffer);
- SURFXML_BUFFER_SET(link_bandwidth_file, "");
- sprintf(buffer,"%f",p_link->latency);
- SURFXML_BUFFER_SET(link_latency,buffer);
- SURFXML_BUFFER_SET(link_latency_file, "");
- A_surfxml_link_state = A_surfxml_link_state_ON;
- SURFXML_BUFFER_SET(link_state_file, "");
- A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
- SURFXML_START_TAG(link);
- SURFXML_END_TAG(link);
-#endif
- }
-
- // add route
- INFO0("Start Adding routes");
- xbt_dynar_foreach(route_list_d,i,p_route)
- {
-#ifdef BYPASS_MODEL
- surf_route_set_resource((char*)p_route->src_id,(char*)p_route->dest_id,p_route->links_id,0);
-#else
-
- SURFXML_BUFFER_SET(route_src,p_route->src_id);
- SURFXML_BUFFER_SET(route_dst,p_route->dest_id);
- SURFXML_BUFFER_SET(route_impact_on_src, "0.0");
- SURFXML_BUFFER_SET(route_impact_on_dst, "0.0");
- SURFXML_BUFFER_SET(route_impact_on_src_with_other_recv, "0.0");
- SURFXML_BUFFER_SET(route_impact_on_dst_with_other_send, "0.0");
- SURFXML_START_TAG(route);
-
- xbt_dynar_foreach(p_route->links_id,j,link_id)
- {
- SURFXML_BUFFER_SET(link_c_ctn_id,link_id);
- SURFXML_START_TAG(link_c_ctn);
- SURFXML_END_TAG(link_c_ctn);
-
- }
-
- SURFXML_END_TAG(route);
-#endif
- }
- /* </platform> */
- INFO0("Register Platform");
-#ifndef BYPASS_MODEL
- SURFXML_END_TAG(platform);
-#endif
-
- free(surfxml_bufferstack);
- return 0; // must return 0 ?!!
-