X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/012e8850b96760b97bee7f40ce87b4093866153e..ef99a405745deb2eaaa8fd1539fa6377495f9217:/src/msg/task.c diff --git a/src/msg/task.c b/src/msg/task.c index af973f05ec..89a21ac1df 100644 --- a/src/msg/task.c +++ b/src/msg/task.c @@ -13,6 +13,18 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(task, msg, static char sprint_buffer[64]; +/** \defgroup m_task_management Managing functions of Tasks + * \brief This section describes the task structure of MSG + * (#m_task_t) and the functions for managing it. + * + * Since most scheduling algorithms rely on a concept of task + * that can be either computed locally or + * transferred on another processor, it seems to be the + * right level of abstraction for our purposes. A task + * may then be defined by a computing amount, a + * message size and some private data. + */ + /********************************* Task **************************************/ /** \ingroup m_task_management * \brief Creates a new #m_task_t. @@ -33,8 +45,8 @@ static char sprint_buffer[64]; * \see m_task_t * \return The new corresponding object. */ -m_task_t MSG_task_create(const char *name, long double compute_duration, - long double message_size, void *data) +m_task_t MSG_task_create(const char *name, double compute_duration, + double message_size, void *data) { simdata_task_t simdata = xbt_new0(s_simdata_task_t,1); m_task_t task = xbt_new0(s_m_task_t,1); @@ -48,9 +60,11 @@ m_task_t MSG_task_create(const char *name, long double compute_duration, simdata->sleeping = xbt_dynar_new(sizeof(m_process_t),NULL); simdata->computation_amount = compute_duration; simdata->message_size = message_size; + simdata->rate = -1.0; simdata->using = 1; simdata->sender = NULL; + return task; } @@ -99,7 +113,7 @@ MSG_error_t MSG_task_destroy(m_task_t task) xbt_assert0((xbt_dynar_length(task->simdata->sleeping)==0), "Task still used. There is a problem. Cannot destroy it now!"); - if(task->name) xbt_free(task->name); + if(task->name) free(task->name); xbt_dynar_free(&(task->simdata->sleeping)); @@ -109,8 +123,8 @@ MSG_error_t MSG_task_destroy(m_task_t task) if(action) action->resource_type->common_public->action_free(action); - xbt_free(task->simdata); - xbt_free(task); + free(task->simdata); + free(task); return MSG_OK; }