X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/793c20751c480070ba0e0887eb1f5fe11458b2ef..892e136b3be07e45110a5a2db2889470386e954a:/teshsuite/simdag/flatifier/flatifier.cpp diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index 7dfc6a67e5..bf94475198 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -40,35 +40,30 @@ static int parse_cmdline(int *timings, char **platformFile, int argc, char **arg static void create_environment(xbt_os_timer_t parse_time, const char *platformFile) { - xbt_ex_t e; - TRY { + try { xbt_os_cputimer_start(parse_time); SD_create_environment(platformFile); xbt_os_cputimer_stop(parse_time); } - CATCH(e) { - xbt_die("Error while loading %s: %s", platformFile, e.msg); + catch (std::exception& e) { + xbt_die("Error while loading %s: %s", platformFile, e.what()); } } int main(int argc, char **argv) { - char *platformFile = NULL; - unsigned int totalHosts, totalLinks; + char *platformFile = nullptr; int timings=0; int version = 4; - const char *link_ctn = "link_ctn"; unsigned int i; - xbt_dict_t props = NULL; - xbt_dict_cursor_t cursor = NULL; - xbt_lib_cursor_t cursor_src = NULL; - xbt_lib_cursor_t cursor_dst = NULL; + xbt_dict_t props = nullptr; + xbt_dict_cursor_t cursor = nullptr; + xbt_lib_cursor_t cursor_src = nullptr; + xbt_lib_cursor_t cursor_dst = nullptr; char *src,*dst,*key,*data; sg_netcard_t value1; sg_netcard_t value2; - sg_host_t *hosts; - SD_link_t *links; xbt_os_timer_t parse_time = xbt_os_timer_new(); SD_init(&argc, argv); @@ -91,8 +86,8 @@ int main(int argc, char **argv) printf("\n"); // Hosts - totalHosts = sg_host_count(); - hosts = sg_host_list(); + unsigned int totalHosts = sg_host_count(); + sg_host_t *hosts = sg_host_list(); qsort((void *) hosts, totalHosts, sizeof(sg_host_t), name_compare_hosts); for (i = 0; i < totalHosts; i++) { @@ -121,8 +116,8 @@ int main(int argc, char **argv) } // Links - totalLinks = sg_link_count(); - links = sg_link_list(); + unsigned int totalLinks = sg_link_count(); + SD_link_t *links = sg_link_list(); qsort((void *) links, totalLinks, sizeof(SD_link_t), name_compare_links); @@ -144,11 +139,11 @@ int main(int argc, char **argv) xbt_dict_foreach(host_list, cursor_dst, dst, host2){ //to host std::vector *route = new std::vector(); value2 = sg_host_by_name(dst)->pimpl_netcard; - routing_platf->getRouteAndLatency(value1, value2, route,NULL); + routing_platf->getRouteAndLatency(value1, value2, route,nullptr); if (! route->empty()){ printf(" \n ", src, dst); for (auto link: *route) - printf("<%s id=\"%s\"/>",link_ctn,link->getName()); + printf("",link->getName()); printf("\n \n"); } delete route; @@ -158,9 +153,9 @@ int main(int argc, char **argv) if(value2->isRouter()){ printf(" \n ", src, dst); std::vector *route = new std::vector(); - routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route,NULL); + routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route,nullptr); for (auto link : *route) - printf("<%s id=\"%s\"/>",link_ctn,link->getName()); + printf("",link->getName()); delete route; printf("\n \n"); } @@ -175,9 +170,9 @@ int main(int argc, char **argv) if(value2->isRouter()){ printf(" \n ", src, dst); std::vector *route = new std::vector(); - routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route,NULL); + routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route,nullptr); for(auto link :*route) - printf("<%s id=\"%s\"/>",link_ctn,link->getName()); + printf("",link->getName()); delete route; printf("\n \n"); } @@ -186,9 +181,9 @@ int main(int argc, char **argv) printf(" \n ",src, dst); std::vector *route = new std::vector(); value2 = sg_host_by_name(dst)->pimpl_netcard; - routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route, NULL); + routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route, nullptr); for(auto link : *route) - printf("<%s id=\"%s\"/>",link_ctn,link->getName()); + printf("",link->getName()); delete route; printf("\n \n"); } @@ -197,10 +192,10 @@ int main(int argc, char **argv) printf("\n"); printf("\n"); + free(hosts); + free(links); } - free(hosts); - free(links); SD_exit(); xbt_os_timer_free(parse_time);