- /* test the route between two workstations */
- SD_workstation_t src, dst;
- xbt_dict_cursor_first(sd_global->workstations, &cursor);
- xbt_dict_cursor_get_or_free(&cursor, &name, (void**) &src);
- xbt_dict_cursor_step(cursor);
- xbt_dict_cursor_get_or_free(&cursor, &name, (void**) &dst);
- xbt_dict_cursor_free(&cursor);
-
- SD_link_t *route = SD_workstation_route_get_list(src, dst);
- int route_size = SD_workstation_route_get_size(src, dst);
-
- printf("Route between %s and %s (%d links) : ", SD_workstation_get_name(src), SD_workstation_get_name(dst), route_size);
- int i;
- for (i = 0; i < route_size; i++) {
- printf("%s ", SD_link_get_name(route[i]));
+ DEBUG1("Total time: %f", total_time);
+
+ elapsed_time = surf_solve();
+ DEBUG1("surf_solve() returns %f", elapsed_time);
+ if (elapsed_time > 0.0)
+ total_time += elapsed_time;
+
+ /* let's see which tasks are done */
+ xbt_dynar_foreach(model_list, iter, model) {
+ while ((action = xbt_swag_extract(model->states.done_action_set))) {
+ task = action->data;
+ task->start_time = surf_workstation_model->action_get_start_time(task->surf_action);
+ task->finish_time = surf_get_clock();
+ VERB1("Task '%s' done", SD_task_get_name(task));
+ DEBUG0("Calling __SD_task_just_done");
+ __SD_task_just_done(task);
+ DEBUG1("__SD_task_just_done called on task '%s'",
+ SD_task_get_name(task));
+
+ /* the state has changed */
+ if (!xbt_dynar_member(changed_tasks, &task))
+ xbt_dynar_push(changed_tasks, &task);
+
+ /* remove the dependencies after this task */
+ xbt_dynar_foreach(task->tasks_after, depcnt, dependency){
+ dst = dependency->dst;
+ if (dst->unsatisfied_dependencies>0)
+ dst->unsatisfied_dependencies--;
+ if (dst->is_not_ready>0)
+ dst->is_not_ready--;
+
+ if (!(dst->unsatisfied_dependencies)){
+ if (__SD_task_is_scheduled(dst))
+ __SD_task_set_state(dst, SD_RUNNABLE);
+ else
+ __SD_task_set_state(dst, SD_SCHEDULABLE);
+ }
+
+ if (SD_task_get_kind(dst) == SD_TASK_COMM_E2E){
+ SD_dependency_t comm_dep;
+ SD_task_t comm_dst;
+ xbt_dynar_get_cpy(dst->tasks_after, 0, &comm_dep);
+ comm_dst = comm_dep->dst;
+ if (__SD_task_is_not_scheduled(comm_dst) &&
+ comm_dst->is_not_ready>0){
+ comm_dst->is_not_ready--;
+
+ if (!(comm_dst->is_not_ready)){
+ __SD_task_set_state(comm_dst, SD_SCHEDULABLE);
+ }
+ }
+ }
+
+ /* is dst runnable now? */
+ if (__SD_task_is_runnable(dst) && !sd_global->watch_point_reached) {
+ VERB1("Executing task '%s'", SD_task_get_name(dst));
+ if (__SD_task_try_to_run(dst) &&
+ !xbt_dynar_member(changed_tasks, &task))
+ xbt_dynar_push(changed_tasks, &task);
+ }
+ }
+ }
+
+ /* let's see which tasks have just failed */
+ while ((action = xbt_swag_extract(model->states.failed_action_set))) {
+ task = action->data;
+ task->start_time = surf_workstation_model->action_get_start_time(task->surf_action);
+ task->finish_time = surf_get_clock();
+ VERB1("Task '%s' failed", SD_task_get_name(task));
+ __SD_task_set_state(task, SD_FAILED);
+ surf_workstation_model->action_unref(action);
+ task->surf_action = NULL;
+
+ if (!xbt_dynar_member(changed_tasks, &task))
+ xbt_dynar_push(changed_tasks, &task);
+ }
+ }
+
+ while (surf_timer_model->extension.timer.get(&fun, (void *) &arg)) {
+ }