X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ddb9b227cc31cdf0f74b65b9c0312fd416417c57..d9a2ba6da1bdc02e8adeb3e87f792d5291b2ea10:/teshsuite/simdag/platforms/flatifier.c diff --git a/teshsuite/simdag/platforms/flatifier.c b/teshsuite/simdag/platforms/flatifier.c index f036d63f58..7285eaecda 100644 --- a/teshsuite/simdag/platforms/flatifier.c +++ b/teshsuite/simdag/platforms/flatifier.c @@ -19,6 +19,8 @@ #include "xbt/log.h" #include "xbt/dict.h" #include "xbt/ex.h" +#include "surf/surf.h" +#include "surf/surf_private.h" XBT_LOG_NEW_DEFAULT_CATEGORY(validator, "Logging specific to this SimDag example"); @@ -45,10 +47,13 @@ int main(int argc, char **argv) { char *platformFile = NULL; int totalHosts, totalLinks, tmp_length; - int i, j, k; + int j, k; + unsigned int i; xbt_dict_t props = NULL; xbt_dict_cursor_t cursor = NULL; - char *key, *data; + xbt_dict_cursor_t cursor_src = NULL; + xbt_dict_cursor_t cursor_dst = NULL; + char *src,*dst,*key,*data; xbt_ex_t e; const SD_workstation_t *hosts; @@ -63,13 +68,13 @@ int main(int argc, char **argv) } CATCH(e) { xbt_die(bprintf("Error while loading %s: %s",platformFile,e.msg)); } - printf("\n"); printf("\n"); printf("\n"); printf("\n"); + // Hosts totalHosts = SD_workstation_get_number(); hosts = SD_workstation_get_list(); qsort((void *) hosts, totalHosts, sizeof(SD_workstation_t), @@ -91,6 +96,16 @@ int main(int argc, char **argv) } } + // Routers + xbt_dict_foreach(global_routing->where_network_elements, cursor, key, data) { + if(((network_element_info_t)xbt_dict_get(global_routing->where_network_elements, key))->rc_type + == SURF_NETWORK_ELEMENT_ROUTER) + { + printf(" \n",key); + } + } + + // Links totalLinks = SD_link_get_number(); links = SD_link_get_list(); qsort((void *) links, totalLinks, sizeof(SD_link_t), name_compare_links); @@ -109,22 +124,39 @@ int main(int argc, char **argv) } } - for (i = 0; i < totalHosts; i++) { - for (j = 0; j < totalHosts; j++) { - tmp = SD_route_get_list(hosts[i], hosts[j]); - if (tmp) { - printf(" \n ", - SD_workstation_get_name(hosts[i]), - SD_workstation_get_name(hosts[j])); - - tmp_length = SD_route_get_size(hosts[i], hosts[j]); - for (k = 0; k < tmp_length; k++) { - printf("", SD_link_get_name(tmp[k])); - } - printf("\n \n"); - } - } + // Routes + xbt_dict_foreach(global_routing->where_network_elements, cursor_src, src, data) + { + if(((network_element_info_t)xbt_dict_get(global_routing->where_network_elements, src))->rc_type + == SURF_NETWORK_ELEMENT_ROUTER || + ((network_element_info_t)xbt_dict_get(global_routing->where_network_elements, src))->rc_type + == SURF_NETWORK_ELEMENT_HOST) + { + xbt_dict_foreach(global_routing->where_network_elements, cursor_dst, dst, data) + { + if(((network_element_info_t)xbt_dict_get(global_routing->where_network_elements, dst))->rc_type + == SURF_NETWORK_ELEMENT_ROUTER || + ((network_element_info_t)xbt_dict_get(global_routing->where_network_elements, dst))->rc_type + == SURF_NETWORK_ELEMENT_HOST) + { + printf(" \n " + ,src + ,dst); + xbt_dynar_t route = global_routing->get_route(src,dst); + for(i=0;iname); + printf("",link_name); + } + printf("\n \n"); + + } + } + } } + printf("\n"); printf("\n"); SD_exit();