+/* Copyright (c) 2007-2009 Da 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 "private.h"
#include "simdag/simdag.h"
#include "xbt/sysdep.h"
case SD_RUNNING:
task->state_set = sd_global->running_task_set;
task->start_time =
- surf_workstation_model->common_public->action_get_start_time(task->
- surf_action);
+ surf_workstation_model->action_get_start_time(task->surf_action);
break;
case SD_DONE:
task->state_set = sd_global->done_task_set;
task->finish_time =
- surf_workstation_model->common_public->action_get_finish_time(task->
- surf_action);
+ surf_workstation_model->action_get_finish_time(task->surf_action);
task->remains = 0;
break;
case SD_FAILED:
xbt_assert0(task != NULL, "Invalid parameter");
if (task->surf_action)
- return task->surf_action->remains;
+ return surf_workstation_model->get_remains(task->surf_action);
else
return task->remains;
}
if (xbt_dynar_length(dst->tasks_before) == 0 && __SD_task_is_scheduled(dst))
__SD_task_set_state(dst, SD_READY);
- /* __SD_print_dependencies(src);
+ /* __SD_print_dependencies(src);
__SD_print_dependencies(dst); */
}
* SD_simulate() will stop as soon as the \ref e_SD_task_state_t "state" of this
* task becomes the one given in argument. The
* watch point is then automatically removed.
- *
+ *
* \param task a task
* \param state the \ref e_SD_task_state_t "state" you want to watch
* (cannot be #SD_NOT_SCHEDULED)
/**
* \brief Removes a watch point from a task
- *
+ *
* \param task a task
* \param state the \ref e_SD_task_state_t "state" you no longer want to watch
* \see SD_task_watch()
/**
* \brief Returns an approximative estimation of the execution time of a task.
- *
+ *
* The estimation is very approximative because the value returned is the time
* the task would take if it was executed now and if it was the only task.
- *
+ *
* \param task the task to evaluate
* \param workstation_nb number of workstations on which the task would be executed
* \param workstation_list the workstations on which the task would be executed
* The task state must be #SD_NOT_SCHEDULED.
* Once scheduled, a task will be executed as soon as possible in SD_simulate(),
* i.e. when its dependencies are satisfied.
- *
+ *
* \param task the task you want to schedule
* \param workstation_nb number of workstations on which the task will be executed
* \param workstation_list the workstations on which the task will be executed
__SD_task_destroy_scheduling_data(task);
if (__SD_task_is_running(task)) /* the task should become SD_FAILED */
- surf_workstation_model->common_public->action_cancel(task->surf_action);
+ surf_workstation_model->action_cancel(task->surf_action);
else
__SD_task_set_state(task, SD_NOT_SCHEDULED);
task->remains = task->amount;
task->surf_action = NULL;
if ((task->workstation_nb == 1) && (task->communication_amount[0] == 0.0)) {
task->surf_action =
- surf_workstation_model->extension_public->execute(surf_workstations[0],
- task->
- computation_amount
- [0]);
+ surf_workstation_model->extension.
+ workstation.execute(surf_workstations[0], task->computation_amount[0]);
} else if ((task->workstation_nb == 1)
&& (task->computation_amount[0] == 0.0)) {
task->surf_action =
- surf_workstation_model->
- extension_public->communicate(surf_workstations[0],
- surf_workstations[0],
- task->communication_amount[0],
- task->rate);
+ surf_workstation_model->extension.
+ workstation.communicate(surf_workstations[0], surf_workstations[0],
+ task->communication_amount[0], task->rate);
} else if ((task->workstation_nb == 2)
&& (task->computation_amount[0] == 0.0)
&& (task->computation_amount[1] == 0.0)) {
}
if (nb == 1) {
task->surf_action =
- surf_workstation_model->
- extension_public->communicate(surf_workstations[0],
- surf_workstations[1], value,
- task->rate);
+ surf_workstation_model->extension.
+ workstation.communicate(surf_workstations[0], surf_workstations[1],
+ value, task->rate);
}
}
if (!task->surf_action) {
sizeof(double) * task->workstation_nb * task->workstation_nb);
task->surf_action =
- surf_workstation_model->extension_public->execute_parallel_task(task->
- workstation_nb,
- surf_workstations,
- computation_amount,
- communication_amount,
- task->
- amount,
- task->
- rate);
+ surf_workstation_model->extension.
+ workstation.execute_parallel_task(task->workstation_nb,
+ surf_workstations, computation_amount,
+ communication_amount, task->amount,
+ task->rate);
} else {
xbt_free(surf_workstations);
}
- surf_workstation_model->common_public->action_set_data(task->surf_action,
- task);
+ surf_workstation_model->action_data_set(task->surf_action, task);
DEBUG1("surf_action = %p", task->surf_action);
candidates = xbt_new(SD_task_t, 8);
__SD_task_set_state(task, SD_DONE);
- surf_workstation_model->common_public->action_free(task->surf_action);
+ surf_workstation_model->action_unref(task->surf_action);
task->surf_action = NULL;
DEBUG0("Looking for candidates");
SD_CHECK_INIT_DONE();
xbt_assert0(task != NULL, "Invalid parameter");
if (task->surf_action)
- return surf_workstation_model->common_public->action_get_start_time(task->
- surf_action);
+ return surf_workstation_model->action_get_start_time(task->surf_action);
else
return task->start_time;
}
*
* The task state must be SD_RUNNING, SD_DONE or SD_FAILED.
* If the state is not completed yet, the returned value is an
- * estimation of the task finish time. This value can fluctuate
+ * estimation of the task finish time. This value can fluctuate
* until the task is completed.
*
* \param task: a task
xbt_assert0(task != NULL, "Invalid parameter");
if (task->surf_action) /* should never happen as actions are destroyed right after their completion */
- return surf_workstation_model->common_public->
- action_get_finish_time(task->surf_action);
+ return surf_workstation_model->action_get_finish_time(task->surf_action);
else
return task->finish_time;
}
xbt_free(task->name);
if (task->surf_action != NULL)
- surf_workstation_model->common_public->action_free(task->surf_action);
+ surf_workstation_model->action_unref(task->surf_action);
if (task->workstation_list != NULL)
xbt_free(task->workstation_list);