X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d4f9d0cf42605d96b91088c02ddfbf2411f89de1..28c048989504fa2c1f890d9a91784065e32de37d:/src/simdag/sd_global.cpp diff --git a/src/simdag/sd_global.cpp b/src/simdag/sd_global.cpp index 20476dcd06..c974b63849 100644 --- a/src/simdag/sd_global.cpp +++ b/src/simdag/sd_global.cpp @@ -64,8 +64,7 @@ void SD_init(int *argc, char **argv) * Do --help on any simgrid binary to see the list of currently existing configuration variables, and * see Section @ref options. * - * Example: - * SD_config("host/model","default"); + * Example: SD_config("host/model","default"); */ void SD_config(const char *key, const char *value){ xbt_assert(sd_global,"ERROR: Please call SD_init() before using SD_config()"); @@ -75,11 +74,11 @@ void SD_config(const char *key, const char *value){ /** * \brief Creates the environment * - * The environment (i.e. the \ref sg_host_management "hosts" and the \ref SD_link_management "links") is created with + * The environment (i.e. the \ref SD_host_api "hosts" and the \ref SD_link_api "links") is created with * the data stored in the given XML platform file. * * \param platform_file name of an XML file describing the environment to create - * \see sg_host_management, SD_link_management + * \see SD_host_api, SD_link_api * * The XML file follows this DTD: * @@ -153,7 +152,7 @@ xbt_dynar_t SD_simulate(double how_long) { /* let's see which tasks are done */ xbt_dynar_foreach(all_existing_models, iter, model) { while ((action = surf_model_extract_done_action_set(model))) { - task = (SD_task_t) action->getData(); + task = static_cast(action->getData()); task->start_time = task->surf_action->getStartTime(); task->finish_time = surf_get_clock(); @@ -163,7 +162,7 @@ xbt_dynar_t SD_simulate(double how_long) { task->surf_action = NULL; /* the state has changed. Add it only if it's the first change */ - if (!xbt_dynar_member(sd_global->return_set, &task)) { + if (xbt_dynar_member(sd_global->return_set, &task) == 0) { xbt_dynar_push(sd_global->return_set, &task); } @@ -177,14 +176,14 @@ xbt_dynar_t SD_simulate(double how_long) { XBT_DEBUG("Released a dependency on %s: %d remain(s). Became schedulable if %d=0", SD_task_get_name(dst), dst->unsatisfied_dependencies, dst->is_not_ready); - if (!(dst->unsatisfied_dependencies)) { + if (dst->unsatisfied_dependencies == 0) { if (SD_task_get_state(dst) == SD_SCHEDULED) SD_task_set_state(dst, SD_RUNNABLE); else SD_task_set_state(dst, SD_SCHEDULABLE); } - if (SD_task_get_state(dst) == SD_NOT_SCHEDULED && !(dst->is_not_ready)) { + if (SD_task_get_state(dst) == SD_NOT_SCHEDULED && dst->is_not_ready == 0) { SD_task_set_state(dst, SD_SCHEDULABLE); } @@ -199,7 +198,7 @@ xbt_dynar_t SD_simulate(double how_long) { XBT_DEBUG("%s is a transfer, %s may be ready now if %d=0", SD_task_get_name(dst), SD_task_get_name(comm_dst), comm_dst->is_not_ready); - if (!(comm_dst->is_not_ready)) { + if (comm_dst->is_not_ready == 0) { SD_task_set_state(comm_dst, SD_SCHEDULABLE); } } @@ -216,7 +215,7 @@ xbt_dynar_t SD_simulate(double how_long) { /* let's see which tasks have just failed */ while ((action = surf_model_extract_failed_action_set(model))) { - task = (SD_task_t) action->getData(); + task = static_cast(action->getData()); task->start_time = task->surf_action->getStartTime(); task->finish_time = surf_get_clock(); XBT_VERB("Task '%s' failed", SD_task_get_name(task)); @@ -229,15 +228,14 @@ xbt_dynar_t SD_simulate(double how_long) { } } - if (!sd_global->watch_point_reached && how_long<0){ - if (!xbt_dynar_is_empty(sd_global->initial_task_set)) { - XBT_WARN("Simulation is finished but %lu tasks are still not done", - xbt_dynar_length(sd_global->initial_task_set)); - static const char* state_names[] = - { "SD_NOT_SCHEDULED", "SD_SCHEDULABLE", "SD_SCHEDULED", "SD_RUNNABLE", "SD_RUNNING", "SD_DONE","SD_FAILED" }; - xbt_dynar_foreach(sd_global->initial_task_set, iter, task){ - XBT_WARN("%s is in %s state", SD_task_get_name(task), state_names[SD_task_get_state(task)]); - } + if (!sd_global->watch_point_reached && how_long<0 && + xbt_dynar_is_empty(sd_global->initial_task_set) == 0) { + XBT_WARN("Simulation is finished but %lu tasks are still not done", + xbt_dynar_length(sd_global->initial_task_set)); + static const char* state_names[] = + { "SD_NOT_SCHEDULED", "SD_SCHEDULABLE", "SD_SCHEDULED", "SD_RUNNABLE", "SD_RUNNING", "SD_DONE","SD_FAILED" }; + xbt_dynar_foreach(sd_global->initial_task_set, iter, task){ + XBT_WARN("%s is in %s state", SD_task_get_name(task), state_names[SD_task_get_state(task)]); } } @@ -249,7 +247,7 @@ xbt_dynar_t SD_simulate(double how_long) { } /** @brief Returns the current clock, in seconds */ -double SD_get_clock(void) { +double SD_get_clock() { return surf_get_clock(); } @@ -260,7 +258,7 @@ double SD_get_clock(void) { * * \see SD_init(), SD_task_destroy() */ -void SD_exit(void) +void SD_exit() { TRACE_surf_resource_utilization_release();