X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f986372d0ffe869b6586e4ea62ab6bf4beb9b9fd..c3b30399c645e6d05d67a2cb03e8432958bc11b9:/examples/simdag/scheduling/minmin_test.c diff --git a/examples/simdag/scheduling/minmin_test.c b/examples/simdag/scheduling/minmin_test.c index 560f981fcf..de62a15e5f 100644 --- a/examples/simdag/scheduling/minmin_test.c +++ b/examples/simdag/scheduling/minmin_test.c @@ -13,6 +13,10 @@ #include "xbt/ex.h" #include +#ifdef HAVE_JEDULE +#include "simgrid/jedule/jedule_sd_binding.h" +#endif + XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this SimDag example"); @@ -116,10 +120,16 @@ static double finish_on_at(SD_task_t task, sg_host_t workstation) grand_parent_workstation_list = SD_task_get_workstation_list(grand_parent); /* Estimate the redistribution time from this parent */ - redist_time = - SD_route_get_communication_time(grand_parent_workstation_list - [0], workstation, - SD_task_get_amount(parent)); + if (SD_task_get_amount(parent) == 0){ + redist_time= 0; + } else { + redist_time = + SD_route_get_latency(grand_parent_workstation_list[0], + workstation) + + SD_task_get_amount(parent) / + SD_route_get_bandwidth(grand_parent_workstation_list[0], + workstation); + } data_available = SD_task_get_finish_time(grand_parent) + redist_time; @@ -176,73 +186,6 @@ static sg_host_t SD_task_get_best_workstation(SD_task_t task) return best_workstation; } -static void output_xml(FILE * out, xbt_dynar_t dax) -{ - unsigned int i, j, k; - int current_nworkstations; - const int nworkstations = sg_host_count(); - const sg_host_t *workstations = sg_host_list(); - SD_task_t task; - sg_host_t *list; - - fprintf(out, "\n"); - fprintf(out, "\n"); - fprintf(out, " \n"); - fprintf(out, " \n"); - fprintf(out, " \n"); - fprintf(out, - " \n", - nworkstations); - fprintf(out, " \n"); - fprintf(out, " \n"); - fprintf(out, " \n"); - - xbt_dynar_foreach(dax, i, task) { - fprintf(out, " \n"); - fprintf(out, " \n", - SD_task_get_name(task)); - fprintf(out, " \n"); - if (SD_task_get_kind(task) == SD_TASK_COMM_E2E) - fprintf(out, "transfer\"/>\n"); - - fprintf(out, - " \n", - SD_task_get_start_time(task)); - fprintf(out, - " \n", - SD_task_get_finish_time(task)); - fprintf(out, " \n"); - - current_nworkstations = SD_task_get_workstation_count(task); - - fprintf(out, - " \n", - current_nworkstations); - - fprintf(out, " \n"); - list = SD_task_get_workstation_list(task); - for (j = 0; j < current_nworkstations; j++) { - for (k = 0; k < nworkstations; k++) { - if (!strcmp(sg_host_get_name(workstations[k]), - sg_host_get_name(list[j]))) { - fprintf(out, " \n", - k); - fprintf(out, - " \n"); - break; - } - } - } - fprintf(out, " \n"); - fprintf(out, " \n"); - fprintf(out, " \n"); - } - fprintf(out, " \n"); - fprintf(out, "\n"); -} - int main(int argc, char **argv) { unsigned int cursor; @@ -252,21 +195,16 @@ int main(int argc, char **argv) sg_host_t workstation, selected_workstation = NULL; int total_nworkstations = 0; const sg_host_t *workstations = NULL; + char * tracefilename = NULL; xbt_dynar_t dax; - FILE *out = NULL; /* initialization of SD */ SD_init(&argc, argv); /* Check our arguments */ xbt_assert(argc > 2, "Usage: %s platform_file dax_file [jedule_file]\n" - "\tExample: %s simulacrum_7_hosts.xml Montage_25.xml Montage_25.jed", - argv[0], argv[0]); + "\tExample: %s simulacrum_7_hosts.xml Montage_25.xml Montage_25.jed", argv[0], argv[0]); - char *last = strrchr(argv[2], '.'); - char * tracefilename = bprintf("%.*s.jed",(int) (last == NULL ? - strlen(argv[2]) : - last - argv[2]), argv[2]); if (argc == 4) tracefilename = xbt_strdup(argv[3]); @@ -355,21 +293,13 @@ int main(int argc, char **argv) XBT_INFO("Simulation Time: %f", SD_get_clock()); - - - - XBT_INFO - ("------------------- Produce the trace file---------------------------"); - XBT_INFO("Producing the trace of the run into %s", tracefilename); - out = fopen(tracefilename, "w"); - xbt_assert(out, "Cannot write to %s", tracefilename); + XBT_INFO("------------------- Produce the trace file---------------------------"); + XBT_INFO("Producing a jedule output (if active) of the run into %s", tracefilename?tracefilename:"./minmin_test.jed"); +#ifdef HAVE_JEDULE + jedule_sd_dump(tracefilename); +#endif free(tracefilename); - output_xml(out, dax); - - fclose(out); - - xbt_dynar_free_container(&ready_tasks); xbt_dynar_foreach(dax, cursor, task) {