X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5b1bf4b927630226493504bec19ea7356f8e70ff..bd40b9e8ea0ee4905025eef6ab5767f7fa25bba8:/examples/simdag/daxload/sd_daxload.c diff --git a/examples/simdag/daxload/sd_daxload.c b/examples/simdag/daxload/sd_daxload.c index 17349494ed..e268452deb 100644 --- a/examples/simdag/daxload/sd_daxload.c +++ b/examples/simdag/daxload/sd_daxload.c @@ -1,13 +1,13 @@ /* simple test trying to load a DAX file. */ -/* Copyright (c) 2009-2015. The SimGrid Team. +/* Copyright (c) 2009-2017. The SimGrid Team. * All rights reserved. */ /* 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 "simgrid/simdag.h" -#include "xbt/file.h" + #include #include @@ -44,7 +44,7 @@ int main(int argc, char **argv) if (!dax){ XBT_ERROR("A problem occurred during DAX parsing (cycle or syntax). Do not continue this test"); free(tracefilename); - SD_exit(); + exit(255); } @@ -64,23 +64,25 @@ int main(int argc, char **argv) /* Schedule them all on the first host */ XBT_INFO("------------------- Schedule tasks ---------------------------"); - const sg_host_t *ws_list = sg_host_list(); + sg_host_t *host_list = sg_host_list(); int hosts_count = sg_host_count(); - qsort((void *) ws_list, hosts_count, sizeof(sg_host_t), name_compare_hosts); + qsort((void *) host_list, hosts_count, 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")) - SD_task_schedulel(task, 1, ws_list[0]); + SD_task_schedulel(task, 1, host_list[0]); else - SD_task_schedulel(task, 1, ws_list[cursor % hosts_count]); + SD_task_schedulel(task, 1, host_list[cursor % hosts_count]); } } + xbt_free(host_list); XBT_INFO("------------------- Run the schedule ---------------------------"); SD_simulate(-1); XBT_INFO("------------------- Produce the trace file---------------------------"); - XBT_INFO("Producing the trace of the run into %s", xbt_basename(tracefilename)); + char* basename = strrchr(tracefilename, '/'); + XBT_INFO("Producing the trace of the run into %s", basename ? basename + 1 : tracefilename); FILE *out = fopen(tracefilename, "w"); xbt_assert(out, "Cannot write to %s", tracefilename); free(tracefilename); @@ -100,13 +102,12 @@ int main(int argc, char **argv) sg_host_get_name(wsl[0]), SD_task_get_amount(task), SD_task_get_name(task)); break; default: - xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task), SD_task_get_kind(task)); + xbt_die("Task %s is of unknown kind %u", SD_task_get_name(task), SD_task_get_kind(task)); } SD_task_destroy(task); } fclose(out); xbt_dynar_free_container(&dax); - SD_exit(); return 0; }