X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a358115a6d6ef855fc2d664fc8d7ae6826ae92e3..a4fc28ec2b9c97fc5bff04e0e5f420703f5ab419:/teshsuite/simdag/availability/availability_test.c diff --git a/teshsuite/simdag/availability/availability_test.c b/teshsuite/simdag/availability/availability_test.c index 88d34f07a6..a0f3c73c3a 100644 --- a/teshsuite/simdag/availability/availability_test.c +++ b/teshsuite/simdag/availability/availability_test.c @@ -4,24 +4,15 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include -#include #include -#include -#include #include #include -#include -#include XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging for the current example"); static int name_compare_hosts(const void *n1, const void *n2) { - return strcmp( - sg_host_get_name(*(sg_host_t *) n1), - sg_host_get_name(*(sg_host_t *) n2) - ); + return strcmp(sg_host_get_name(*(sg_host_t *) n1), sg_host_get_name(*(sg_host_t *) n2)); } static void scheduleDAX(xbt_dynar_t dax) @@ -33,54 +24,34 @@ static void scheduleDAX(xbt_dynar_t dax) int totalHosts = sg_host_count(); qsort((void *) ws_list, totalHosts, sizeof(sg_host_t), name_compare_hosts); - xbt_dynar_foreach(dax, cursor, task) { if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) { - if (!strcmp(SD_task_get_name(task), "end") - || !strcmp(SD_task_get_name(task), "root")) { - XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), - sg_host_get_name(ws_list[0])); + if (!strcmp(SD_task_get_name(task), "end") || !strcmp(SD_task_get_name(task), "root")) { + XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), sg_host_get_name(ws_list[0])); SD_task_schedulel(task, 1, ws_list[0]); } else { - XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), - sg_host_get_name(ws_list[(cursor) % totalHosts])); + XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), sg_host_get_name(ws_list[(cursor) % totalHosts])); SD_task_schedulel(task, 1, ws_list[(cursor) % totalHosts]); } } } } -static xbt_dynar_t initDynamicThrottling(int argc, char *argv[]) +int main(int argc, char *argv[]) { SD_init(&argc, argv); - xbt_assert(argc == 3, - "Error on parameters.\n" - "Usage: %s \n", argv[0]); - - FILE *testFile = fopen(argv[1], "r"); - xbt_assert(testFile, "Cannot open platform file %s.\n", argv[1]); - testFile = fopen(argv[2], "r"); - xbt_assert(testFile, "Cannot open DAX file %s.\n", argv[2]); + xbt_assert(argc > 2, "Usage: %s platform_file dax_file\n" + "\tExample: %s simulacrum_7_hosts.xml Montage_25.xml", argv[0], argv[0]); SD_create_environment(argv[1]); xbt_dynar_t dax = SD_daxload(argv[2]); - // Schedule DAX XBT_INFO("Scheduling DAX..."); scheduleDAX(dax); XBT_INFO("DAX scheduled"); SD_simulate(-1); XBT_INFO("Simulation done."); - return dax; -} - -int main(int argc, char *argv[]) -{ - - /* Start process... */ - xbt_dynar_t dax = initDynamicThrottling(argc, argv); - // Free memory while (!xbt_dynar_is_empty(dax)) { SD_task_t task = xbt_dynar_pop_as(dax, SD_task_t);