git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6008
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
XBT_PUBLIC(void) MSG_paje_output(const char *filename);
XBT_PUBLIC(double) MSG_get_clock(void);
XBT_PUBLIC(void) MSG_paje_output(const char *filename);
XBT_PUBLIC(double) MSG_get_clock(void);
+XBT_PUBLIC(unsigned long int) MSG_get_sent_msg(void);
+
/************************** Host handling ***********************************/
XBT_PUBLIC(MSG_error_t) MSG_host_set_data(m_host_t host, void *data);
/************************** Host handling ***********************************/
XBT_PUBLIC(MSG_error_t) MSG_host_set_data(m_host_t host, void *data);
XBT_PUBLIC(m_task_t) MSG_task_create(const char *name, double compute_duration,
double message_size, void *data);
XBT_PUBLIC(m_task_t) MSG_task_create(const char *name, double compute_duration,
double message_size, void *data);
-XBT_PUBLIC(m_task_t) MSG_parallel_task_create(const char *name,
+XBT_PUBLIC(m_task_t) MSG_parallel_task_create(const char *name,
int host_nb,
const m_host_t *host_list,
double *computation_amount,
int host_nb,
const m_host_t *host_list,
double *computation_amount,
XBT_PUBLIC(MSG_error_t) MSG_task_get(m_task_t * task, m_channel_t channel);
XBT_PUBLIC(MSG_error_t) MSG_task_get_with_timeout(m_task_t * task, m_channel_t channel,
double max_duration);
XBT_PUBLIC(MSG_error_t) MSG_task_get(m_task_t * task, m_channel_t channel);
XBT_PUBLIC(MSG_error_t) MSG_task_get_with_timeout(m_task_t * task, m_channel_t channel,
double max_duration);
-XBT_PUBLIC(MSG_error_t) MSG_task_get_from_host(m_task_t * task, int channel,
+XBT_PUBLIC(MSG_error_t) MSG_task_get_from_host(m_task_t * task, int channel,
MSG_task_receive_from_host(m_task_t * task, const char* alias, m_host_t host);
MSG_task_receive_from_host(m_task_t * task, const char* alias, m_host_t host);
-XBT_PUBLIC(MSG_error_t) MSG_task_get_ext(m_task_t * task, int channel,
+XBT_PUBLIC(MSG_error_t) MSG_task_get_ext(m_task_t * task, int channel,
double max_duration, m_host_t host);
double max_duration, m_host_t host);
-XBT_PUBLIC(MSG_error_t) MSG_task_put(m_task_t task, m_host_t dest,
+XBT_PUBLIC(MSG_error_t) MSG_task_put(m_task_t task, m_host_t dest,
m_channel_t channel);
XBT_PUBLIC(MSG_error_t) MSG_task_put_bounded(m_task_t task,
m_host_t dest, m_channel_t channel,
double max_rate);
m_channel_t channel);
XBT_PUBLIC(MSG_error_t) MSG_task_put_bounded(m_task_t task,
m_host_t dest, m_channel_t channel,
double max_rate);
-XBT_PUBLIC(MSG_error_t) MSG_task_put_with_timeout(m_task_t task, m_host_t dest,
+XBT_PUBLIC(MSG_error_t) MSG_task_put_with_timeout(m_task_t task, m_host_t dest,
m_channel_t channel, double max_duration);
XBT_PUBLIC(MSG_error_t) MSG_task_execute(m_task_t task);
XBT_PUBLIC(MSG_error_t) MSG_parallel_task_execute(m_task_t task);
m_channel_t channel, double max_duration);
XBT_PUBLIC(MSG_error_t) MSG_task_execute(m_task_t task);
XBT_PUBLIC(MSG_error_t) MSG_parallel_task_execute(m_task_t task);
XBT_PUBLIC(double) MSG_task_get_data_size(m_task_t task);
XBT_PUBLIC(double) MSG_task_get_data_size(m_task_t task);
MSG_task_receive_ext(m_task_t* task, const char* alias, double timeout, m_host_t host);
MSG_task_receive_ext(m_task_t* task, const char* alias, double timeout, m_host_t host);
MSG_task_receive_with_timeout(m_task_t * task, const char* alias, double timeout);
MSG_task_receive_with_timeout(m_task_t * task, const char* alias, double timeout);
MSG_task_receive(m_task_t * task, const char* alias);
MSG_task_receive(m_task_t * task, const char* alias);
MSG_task_listen(const char* alias);
MSG_task_listen(const char* alias);
MSG_task_listen_from_host(const char* alias, m_host_t host);
MSG_task_listen_from_host(const char* alias, m_host_t host);
MSG_alias_select_from(const char* alias, double timeout, int* PID);
MSG_alias_select_from(const char* alias, double timeout, int* PID);
MSG_task_send_with_timeout(m_task_t task, const char* alias, double timeout);
MSG_task_send_with_timeout(m_task_t task, const char* alias, double timeout);
MSG_task_send(m_task_t task,const char* alias);
MSG_task_send(m_task_t task,const char* alias);
MSG_task_send_bounded(m_task_t task, const char* alias, double rate);
XBT_PUBLIC(int)
MSG_task_send_bounded(m_task_t task, const char* alias, double rate);
XBT_PUBLIC(int)
/** \defgroup msg_simulation MSG simulation Functions
* \brief This section describes the functions you need to know to
/** \defgroup msg_simulation MSG simulation Functions
* \brief This section describes the functions you need to know to
- * set up a simulation. You should have a look at \ref MSG_examples
+ * set up a simulation. You should have a look at \ref MSG_examples
* to have an overview of their usage.
*/
/** @addtogroup msg_simulation
* to have an overview of their usage.
*/
/** @addtogroup msg_simulation
XBT_LOG_CONNECT(msg_kernel, msg);
XBT_LOG_CONNECT(msg_mailbox, msg);
XBT_LOG_CONNECT(msg_process, msg);
XBT_LOG_CONNECT(msg_kernel, msg);
XBT_LOG_CONNECT(msg_mailbox, msg);
XBT_LOG_CONNECT(msg_process, msg);
SIMIX_global_init(argc, argv);
msg_global = xbt_new0(s_MSG_Global_t, 1);
SIMIX_global_init(argc, argv);
msg_global = xbt_new0(s_MSG_Global_t, 1);
msg_global->process_list = xbt_fifo_new();
msg_global->max_channel = 0;
msg_global->PID = 1;
msg_global->process_list = xbt_fifo_new();
msg_global->max_channel = 0;
msg_global->PID = 1;
+ msg_global->sent_msg = 0;
/* initialization of the mailbox module */
MSG_mailbox_mod_init();
/* initialization of the mailbox module */
MSG_mailbox_mod_init();
*/
/** @addtogroup m_channel_management
* \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Channels" --> \endhtmlonly
*/
/** @addtogroup m_channel_management
* \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Channels" --> \endhtmlonly
*
* For convenience, the simulator provides the notion of channel
* that is close to the tag notion in MPI. A channel is not a
*
* For convenience, the simulator provides the notion of channel
* that is close to the tag notion in MPI. A channel is not a
/** \ingroup m_channel_management
* \brief Return the number of channel in the simulation.
*
/** \ingroup m_channel_management
* \brief Return the number of channel in the simulation.
*
- * This function has to be called once the number of channel is fixed. I can't
+ * This function has to be called once the number of channel is fixed. I can't
figure out a reason why anyone would like to call this function but nevermind.
* \return the number of channel in the simulation.
*/
figure out a reason why anyone would like to call this function but nevermind.
* \return the number of channel in the simulation.
*/
{
return SIMIX_get_clock();
}
{
return SIMIX_get_clock();
}
+
+unsigned long int MSG_get_sent_msg() {
+ return msg_global->sent_msg;
+}
* \brief Return the last value returned by a MSG function (except
* MSG_get_errno...).
*/
* \brief Return the last value returned by a MSG function (except
* MSG_get_errno...).
*/
MSG_get_errno(void)
{
return PROCESS_GET_ERRNO();
MSG_get_errno(void)
{
return PROCESS_GET_ERRNO();
* \return #MSG_FATAL if \a task is not properly initialized and
* #MSG_OK otherwise.
*/
* \return #MSG_FATAL if \a task is not properly initialized and
* #MSG_OK otherwise.
*/
MSG_task_execute(m_task_t task)
{
simdata_task_t simdata = NULL;
m_process_t self = MSG_process_self();
CHECK_HOST();
MSG_task_execute(m_task_t task)
{
simdata_task_t simdata = NULL;
m_process_t self = MSG_process_self();
CHECK_HOST();
simdata = task->simdata;
xbt_assert0((!simdata->compute) && (task->simdata->refcount == 1),"This task is executed somewhere else. Go fix your code!");
simdata = task->simdata;
xbt_assert0((!simdata->compute) && (task->simdata->refcount == 1),"This task is executed somewhere else. Go fix your code!");
DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
simdata->refcount ++;
SIMIX_mutex_lock(simdata->mutex);
simdata->compute = SIMIX_action_execute(SIMIX_host_self(), task->name, simdata->computation_amount);
SIMIX_action_set_priority(simdata->compute, simdata->priority);
simdata->refcount ++;
SIMIX_mutex_lock(simdata->mutex);
simdata->compute = SIMIX_action_execute(SIMIX_host_self(), task->name, simdata->computation_amount);
SIMIX_action_set_priority(simdata->compute, simdata->priority);
self->simdata->waiting_task = task;
SIMIX_register_action_to_condition(simdata->compute, simdata->cond);
SIMIX_cond_wait(simdata->cond, simdata->mutex);
SIMIX_unregister_action_to_condition(simdata->compute, simdata->cond);
self->simdata->waiting_task = NULL;
self->simdata->waiting_task = task;
SIMIX_register_action_to_condition(simdata->compute, simdata->cond);
SIMIX_cond_wait(simdata->cond, simdata->mutex);
SIMIX_unregister_action_to_condition(simdata->compute, simdata->cond);
self->simdata->waiting_task = NULL;
SIMIX_mutex_unlock(simdata->mutex);
simdata->refcount --;
SIMIX_mutex_unlock(simdata->mutex);
simdata->refcount --;
-
- if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE)
+
+ if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE)
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_OK);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_OK);
- }
- else if(SIMIX_host_get_state(SIMIX_host_self()) == 0)
+ }
+ else if(SIMIX_host_get_state(SIMIX_host_self()) == 0)
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_HOST_FAILURE);
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_HOST_FAILURE);
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
/** \ingroup m_task_management
* \brief Creates a new #m_task_t (a parallel one....).
*
/** \ingroup m_task_management
* \brief Creates a new #m_task_t (a parallel one....).
*
- * A constructor for #m_task_t taking six arguments and returning the
+ * A constructor for #m_task_t taking six arguments and returning the
corresponding object.
* \param name a name for the object. It is for user-level information
and can be NULL.
corresponding object.
* \param name a name for the object. It is for user-level information
and can be NULL.
* \see m_task_t
* \return The new corresponding object.
*/
* \see m_task_t
* \return The new corresponding object.
*/
MSG_parallel_task_create(const char *name,int host_nb, const m_host_t * host_list, double *computation_amount, double *communication_amount, void *data)
{
int i;
simdata_task_t simdata = xbt_new0(s_simdata_task_t, 1);
m_task_t task = xbt_new0(s_m_task_t, 1);
task->simdata = simdata;
MSG_parallel_task_create(const char *name,int host_nb, const m_host_t * host_list, double *computation_amount, double *communication_amount, void *data)
{
int i;
simdata_task_t simdata = xbt_new0(s_simdata_task_t, 1);
m_task_t task = xbt_new0(s_m_task_t, 1);
task->simdata = simdata;
/* Task structure */
task->name = xbt_strdup(name);
task->data = data;
/* Task structure */
task->name = xbt_strdup(name);
task->data = data;
/* Simulator Data */
simdata->computation_amount = 0;
simdata->message_size = 0;
/* Simulator Data */
simdata->computation_amount = 0;
simdata->message_size = 0;
simdata->sender = NULL;
simdata->receiver = NULL;
simdata->source = NULL;
simdata->sender = NULL;
simdata->receiver = NULL;
simdata->source = NULL;
simdata->host_nb = host_nb;
simdata->host_list = xbt_new0(smx_host_t, host_nb);
simdata->comp_amount = computation_amount;
simdata->comm_amount = communication_amount;
simdata->host_nb = host_nb;
simdata->host_list = xbt_new0(smx_host_t, host_nb);
simdata->comp_amount = computation_amount;
simdata->comm_amount = communication_amount;
for (i = 0; i < host_nb; i++)
simdata->host_list[i] = host_list[i]->simdata->smx_host;
for (i = 0; i < host_nb; i++)
simdata->host_list[i] = host_list[i]->simdata->smx_host;
MSG_parallel_task_execute(m_task_t task)
{
simdata_task_t simdata = NULL;
m_process_t self = MSG_process_self();
CHECK_HOST();
MSG_parallel_task_execute(m_task_t task)
{
simdata_task_t simdata = NULL;
m_process_t self = MSG_process_self();
CHECK_HOST();
xbt_assert0((!simdata->compute) && (task->simdata->refcount == 1),"This task is executed somewhere else. Go fix your code!");
xbt_assert0((!simdata->compute) && (task->simdata->refcount == 1),"This task is executed somewhere else. Go fix your code!");
xbt_assert0(simdata->host_nb,"This is not a parallel task. Go to hell.");
xbt_assert0(simdata->host_nb,"This is not a parallel task. Go to hell.");
DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
SIMIX_mutex_lock(simdata->mutex);
simdata->compute =
SIMIX_action_parallel_execute(task->name, simdata->host_nb, simdata->host_list, simdata->comp_amount, simdata->comm_amount, 1.0, -1.0);
SIMIX_mutex_lock(simdata->mutex);
simdata->compute =
SIMIX_action_parallel_execute(task->name, simdata->host_nb, simdata->host_list, simdata->comp_amount, simdata->comm_amount, 1.0, -1.0);
self->simdata->waiting_task = task;
SIMIX_register_action_to_condition(simdata->compute, simdata->cond);
SIMIX_cond_wait(simdata->cond, simdata->mutex);
SIMIX_unregister_action_to_condition(simdata->compute, simdata->cond);
self->simdata->waiting_task = NULL;
self->simdata->waiting_task = task;
SIMIX_register_action_to_condition(simdata->compute, simdata->cond);
SIMIX_cond_wait(simdata->cond, simdata->mutex);
SIMIX_unregister_action_to_condition(simdata->compute, simdata->cond);
self->simdata->waiting_task = NULL;
SIMIX_mutex_unlock(simdata->mutex);
simdata->refcount --;
SIMIX_mutex_unlock(simdata->mutex);
simdata->refcount --;
-
- if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE)
+
+ if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE)
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_OK);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_OK);
- }
- else if(SIMIX_host_get_state(SIMIX_host_self()) == 0)
+ }
+ else if(SIMIX_host_get_state(SIMIX_host_self()) == 0)
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_HOST_FAILURE);
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_HOST_FAILURE);
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
{
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
SIMIX_action_destroy(task->simdata->compute);
*
* \param nb_sec a number of second
*/
*
* \param nb_sec a number of second
*/
MSG_process_sleep(double nb_sec)
{
smx_action_t act_sleep;
m_process_t proc = MSG_process_self();
smx_mutex_t mutex;
smx_cond_t cond;
MSG_process_sleep(double nb_sec)
{
smx_action_t act_sleep;
m_process_t proc = MSG_process_self();
smx_mutex_t mutex;
smx_cond_t cond;
/* create action to sleep */
act_sleep = SIMIX_action_sleep(SIMIX_process_get_host(proc->simdata->s_process), nb_sec);
/* create action to sleep */
act_sleep = SIMIX_action_sleep(SIMIX_process_get_host(proc->simdata->s_process), nb_sec);
mutex = SIMIX_mutex_init();
SIMIX_mutex_lock(mutex);
mutex = SIMIX_mutex_init();
SIMIX_mutex_lock(mutex);
/* create conditional and register action to it */
cond = SIMIX_cond_init();
/* create conditional and register action to it */
cond = SIMIX_cond_init();
SIMIX_register_action_to_condition(act_sleep, cond);
SIMIX_cond_wait(cond, mutex);
SIMIX_unregister_action_to_condition(act_sleep, cond);
SIMIX_mutex_unlock(mutex);
SIMIX_register_action_to_condition(act_sleep, cond);
SIMIX_cond_wait(cond, mutex);
SIMIX_unregister_action_to_condition(act_sleep, cond);
SIMIX_mutex_unlock(mutex);
/* remove variables */
SIMIX_cond_destroy(cond);
SIMIX_mutex_destroy(mutex);
/* remove variables */
SIMIX_cond_destroy(cond);
SIMIX_mutex_destroy(mutex);
-
- if (SIMIX_action_get_state(act_sleep) == SURF_ACTION_DONE)
+
+ if (SIMIX_action_get_state(act_sleep) == SURF_ACTION_DONE)
- if (SIMIX_host_get_state(SIMIX_host_self()) == SURF_CPU_OFF)
+ if (SIMIX_host_get_state(SIMIX_host_self()) == SURF_CPU_OFF)
{
SIMIX_action_destroy(act_sleep);
MSG_RETURN(MSG_HOST_FAILURE);
}
{
SIMIX_action_destroy(act_sleep);
MSG_RETURN(MSG_HOST_FAILURE);
}
{
SIMIX_action_destroy(act_sleep);
MSG_RETURN(MSG_HOST_FAILURE);
}
{
SIMIX_action_destroy(act_sleep);
MSG_RETURN(MSG_HOST_FAILURE);
}
* \brief Return the number of MSG tasks currently running on
* the host of the current running process.
*/
* \brief Return the number of MSG tasks currently running on
* the host of the current running process.
*/
MSG_get_msgload(void)
{
xbt_die("not implemented yet");
MSG_get_msgload(void)
{
xbt_die("not implemented yet");
* \return #MSG_FATAL if \a task is equal to \c NULL, #MSG_WARNING
if \a *task is not equal to \c NULL, and #MSG_OK otherwise.
*/
* \return #MSG_FATAL if \a task is equal to \c NULL, #MSG_WARNING
if \a *task is not equal to \c NULL, and #MSG_OK otherwise.
*/
MSG_task_get_from_host(m_task_t * task, m_channel_t channel, m_host_t host)
{
return MSG_task_get_ext(task, channel, -1, host);
MSG_task_get_from_host(m_task_t * task, m_channel_t channel, m_host_t host)
{
return MSG_task_get_ext(task, channel, -1, host);
* \return #MSG_FATAL if \a task is equal to \c NULL, #MSG_WARNING
* if \a *task is not equal to \c NULL, and #MSG_OK otherwise.
*/
* \return #MSG_FATAL if \a task is equal to \c NULL, #MSG_WARNING
* if \a *task is not equal to \c NULL, and #MSG_OK otherwise.
*/
MSG_task_get(m_task_t * task, m_channel_t channel)
{
return MSG_task_get_with_timeout(task, channel, -1);
MSG_task_get(m_task_t * task, m_channel_t channel)
{
return MSG_task_get_with_timeout(task, channel, -1);
listening. This value has to be >=0 and < than the maximal
number of channels fixed with MSG_set_channel_number().
* \param max_duration the maximum time to wait for a task before giving
listening. This value has to be >=0 and < than the maximal
number of channels fixed with MSG_set_channel_number().
* \param max_duration the maximum time to wait for a task before giving
- up. In such a case, #MSG_TRANSFER_FAILURE will be returned, \a task
+ up. In such a case, #MSG_TRANSFER_FAILURE will be returned, \a task
will not be modified and will still be
will not be modified and will still be
- equal to \c NULL when returning.
+ equal to \c NULL when returning.
* \return #MSG_FATAL if \a task is equal to \c NULL, #MSG_WARNING
if \a *task is not equal to \c NULL, and #MSG_OK otherwise.
*/
* \return #MSG_FATAL if \a task is equal to \c NULL, #MSG_WARNING
if \a *task is not equal to \c NULL, and #MSG_OK otherwise.
*/
MSG_task_get_with_timeout(m_task_t * task, m_channel_t channel, double max_duration)
{
return MSG_task_get_ext(task, channel, max_duration, NULL);
MSG_task_get_with_timeout(m_task_t * task, m_channel_t channel, double max_duration)
{
return MSG_task_get_ext(task, channel, max_duration, NULL);
* by an agent for handling some task.
*/
* by an agent for handling some task.
*/
MSG_task_get_ext(m_task_t * task, m_channel_t channel, double timeout,m_host_t host)
{
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d",channel);
MSG_task_get_ext(m_task_t * task, m_channel_t channel, double timeout,m_host_t host)
{
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d",channel);
return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_channel(MSG_host_self(), channel), task, host, timeout);
}
return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_channel(MSG_host_self(), channel), task, host, timeout);
}
MSG_task_receive_from_host(m_task_t * task, const char* alias, m_host_t host)
{
return MSG_task_receive_ext(task, alias, -1, host);
}
MSG_task_receive_from_host(m_task_t * task, const char* alias, m_host_t host)
{
return MSG_task_receive_ext(task, alias, -1, host);
}
MSG_task_receive(m_task_t * task, const char* alias)
{
MSG_task_receive(m_task_t * task, const char* alias)
{
- return MSG_task_receive_with_timeout(task, alias, -1);
+ return MSG_task_receive_with_timeout(task, alias, -1);
MSG_task_receive_with_timeout(m_task_t * task, const char* alias, double timeout)
{
MSG_task_receive_with_timeout(m_task_t * task, const char* alias, double timeout)
{
- return MSG_task_receive_ext(task, alias, timeout, NULL);
+ return MSG_task_receive_ext(task, alias, timeout, NULL);
MSG_task_receive_ext(m_task_t* task, const char* alias, double timeout, m_host_t host)
{
return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_alias(alias), task, host, timeout);
MSG_task_receive_ext(m_task_t* task, const char* alias, double timeout, m_host_t host)
{
return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_alias(alias), task, host, timeout);
* #MSG_TRANSFER_FAILURE if the transfer could not be properly done
* (network failure, dest failure)
*/
* #MSG_TRANSFER_FAILURE if the transfer could not be properly done
* (network failure, dest failure)
*/
MSG_task_put(m_task_t task, m_host_t dest, m_channel_t channel)
{
return MSG_task_put_with_timeout(task, dest, channel, -1.0);
}
/** \ingroup msg_gos_functions
MSG_task_put(m_task_t task, m_host_t dest, m_channel_t channel)
{
return MSG_task_put_with_timeout(task, dest, channel, -1.0);
}
/** \ingroup msg_gos_functions
- * \brief Does exactly the same as MSG_task_put but with a bounded transmition
+ * \brief Does exactly the same as MSG_task_put but with a bounded transmition
* rate.
*
* \sa MSG_task_put
* rate.
*
* \sa MSG_task_put
task. This value has to be >=0 and < than the maximal number of
channels fixed with MSG_set_channel_number().
* \param timeout the maximum time to wait for a task before giving
task. This value has to be >=0 and < than the maximal number of
channels fixed with MSG_set_channel_number().
* \param timeout the maximum time to wait for a task before giving
- up. In such a case, #MSG_TRANSFER_FAILURE will be returned, \a task
- will not be modified
+ up. In such a case, #MSG_TRANSFER_FAILURE will be returned, \a task
+ will not be modified
* \return #MSG_FATAL if \a task is not properly initialized and
#MSG_OK otherwise. Returns #MSG_HOST_FAILURE if the host on which
this function was called was shut down. Returns
#MSG_TRANSFER_FAILURE if the transfer could not be properly done
(network failure, dest failure, timeout...)
*/
* \return #MSG_FATAL if \a task is not properly initialized and
#MSG_OK otherwise. Returns #MSG_HOST_FAILURE if the host on which
this function was called was shut down. Returns
#MSG_TRANSFER_FAILURE if the transfer could not be properly done
(network failure, dest failure, timeout...)
*/
MSG_task_put_with_timeout(m_task_t task, m_host_t dest, m_channel_t channel, double timeout)
{
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
MSG_task_put_with_timeout(m_task_t task, m_host_t dest, m_channel_t channel, double timeout)
{
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
return MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_channel(dest, channel), task, timeout);
}
return MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_channel(dest, channel), task, timeout);
}
MSG_task_send(m_task_t task,const char* alias)
{
return MSG_task_send_with_timeout(task, alias, -1);
}
MSG_task_send(m_task_t task,const char* alias)
{
return MSG_task_send_with_timeout(task, alias, -1);
}
MSG_task_send_bounded(m_task_t task, const char* alias, double maxrate)
{
task->simdata->rate = maxrate;
return MSG_task_send(task, alias);
}
MSG_task_send_bounded(m_task_t task, const char* alias, double maxrate)
{
task->simdata->rate = maxrate;
return MSG_task_send(task, alias);
}
MSG_task_send_with_timeout(m_task_t task, const char* alias, double timeout)
{
return MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_alias(alias), task, timeout);
}
MSG_task_send_with_timeout(m_task_t task, const char* alias, double timeout)
{
return MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_alias(alias), task, timeout);
}
MSG_task_listen(const char* alias)
{
CHECK_HOST();
MSG_task_listen(const char* alias)
{
CHECK_HOST();
return !MSG_mailbox_is_empty(MSG_mailbox_get_by_alias(alias));
}
return !MSG_mailbox_is_empty(MSG_mailbox_get_by_alias(alias));
}
number of channels fixed with MSG_set_channel_number().
* \return 1 if there is a pending communication and 0 otherwise
*/
number of channels fixed with MSG_set_channel_number().
* \return 1 if there is a pending communication and 0 otherwise
*/
MSG_task_Iprobe(m_channel_t channel)
{
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
MSG_task_Iprobe(m_channel_t channel)
{
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
return !MSG_mailbox_is_empty(MSG_mailbox_get_by_channel(MSG_host_self(), channel));
}
return !MSG_mailbox_is_empty(MSG_mailbox_get_by_channel(MSG_host_self(), channel));
}
* \return the number of tasks waiting to be received on \a channel
and sent by \a host.
*/
* \return the number of tasks waiting to be received on \a channel
and sent by \a host.
*/
MSG_task_probe_from_host(int channel, m_host_t host)
{
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
MSG_task_probe_from_host(int channel, m_host_t host)
{
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
-
- return MSG_mailbox_get_count_host_waiting_tasks(MSG_mailbox_get_by_channel(MSG_host_self(), channel),host);
-
+
+ return MSG_mailbox_get_count_host_waiting_tasks(MSG_mailbox_get_by_channel(MSG_host_self(), channel),host);
+
MSG_task_listen_from_host(const char* alias, m_host_t host)
{
CHECK_HOST();
MSG_task_listen_from_host(const char* alias, m_host_t host)
{
CHECK_HOST();
-
- return MSG_mailbox_get_count_host_waiting_tasks(MSG_mailbox_get_by_alias(alias),host);
+
+ return MSG_mailbox_get_count_host_waiting_tasks(MSG_mailbox_get_by_alias(alias),host);
}
/** \ingroup msg_gos_functions
}
/** \ingroup msg_gos_functions
number of channels fixed with MSG_set_channel_number().
* \return -1 if there is no pending communication and the PID of the process who sent it otherwise
*/
number of channels fixed with MSG_set_channel_number().
* \return -1 if there is no pending communication and the PID of the process who sent it otherwise
*/
MSG_task_probe_from(m_channel_t channel)
{
m_task_t task;
CHECK_HOST();
MSG_task_probe_from(m_channel_t channel)
{
m_task_t task;
CHECK_HOST();
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
if(NULL == (task = MSG_mailbox_get_head(MSG_mailbox_get_by_channel(MSG_host_self(), channel))))
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
if(NULL == (task = MSG_mailbox_get_head(MSG_mailbox_get_by_channel(MSG_host_self(), channel))))
/** \ingroup msg_gos_functions
* \brief Wait for at most \a max_duration second for a task reception
/** \ingroup msg_gos_functions
* \brief Wait for at most \a max_duration second for a task reception
* \a PID is updated with the PID of the first process that triggered this event if any.
*
* It takes three parameters:
* \a PID is updated with the PID of the first process that triggered this event if any.
*
* It takes three parameters:
* \return #MSG_HOST_FAILURE if the host is shut down in the meantime
and #MSG_OK otherwise.
*/
* \return #MSG_HOST_FAILURE if the host is shut down in the meantime
and #MSG_OK otherwise.
*/
MSG_channel_select_from(m_channel_t channel,double timeout, int *PID)
{
m_host_t h = NULL;
MSG_channel_select_from(m_channel_t channel,double timeout, int *PID)
{
m_host_t h = NULL;
int first_time = 1;
smx_cond_t cond;
msg_mailbox_t mailbox;
int first_time = 1;
smx_cond_t cond;
msg_mailbox_t mailbox;
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d",channel);
xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d",channel);
{
*PID = MSG_task_probe_from(channel);
MSG_RETURN(MSG_OK);
{
*PID = MSG_task_probe_from(channel);
MSG_RETURN(MSG_OK);
{
CHECK_HOST();
h = MSG_host_self();
h_simdata = h->simdata;
{
CHECK_HOST();
h = MSG_host_self();
h_simdata = h->simdata;
-
- mailbox = MSG_mailbox_get_by_channel(MSG_host_self(), channel);
-
+
+ mailbox = MSG_mailbox_get_by_channel(MSG_host_self(), channel);
+
while(MSG_mailbox_is_empty(mailbox))
{
while(MSG_mailbox_is_empty(mailbox))
{
{
MSG_RETURN(MSG_OK);
}
}
{
MSG_RETURN(MSG_OK);
}
}
SIMIX_mutex_lock(h_simdata->mutex);
SIMIX_mutex_lock(h_simdata->mutex);
xbt_assert1(!MSG_mailbox_get_cond(mailbox),"A process is already blocked on this channel %d",channel);
xbt_assert1(!MSG_mailbox_get_cond(mailbox),"A process is already blocked on this channel %d",channel);
cond = SIMIX_cond_init();
cond = SIMIX_cond_init();
MSG_mailbox_set_cond(mailbox, cond);
MSG_mailbox_set_cond(mailbox, cond);
{
SIMIX_cond_wait_timeout(cond, h_simdata->mutex, timeout);
{
SIMIX_cond_wait_timeout(cond, h_simdata->mutex, timeout);
{
SIMIX_cond_wait(cond, h_simdata->mutex);
}
{
SIMIX_cond_wait(cond, h_simdata->mutex);
}
SIMIX_cond_destroy(cond);
SIMIX_mutex_unlock(h_simdata->mutex);
SIMIX_cond_destroy(cond);
SIMIX_mutex_unlock(h_simdata->mutex);
-
- if (SIMIX_host_get_state(h_simdata->smx_host) == 0)
+
+ if (SIMIX_host_get_state(h_simdata->smx_host) == 0)
{
MSG_RETURN(MSG_HOST_FAILURE);
}
{
MSG_RETURN(MSG_HOST_FAILURE);
}
MSG_mailbox_set_cond(mailbox,NULL);
first_time = 0;
}
MSG_mailbox_set_cond(mailbox,NULL);
first_time = 0;
}
if(NULL == (t = MSG_mailbox_get_head(mailbox)))
MSG_RETURN(MSG_OK);
if(NULL == (t = MSG_mailbox_get_head(mailbox)))
MSG_RETURN(MSG_OK);
{
*PID = MSG_process_get_PID(t->simdata->sender);
}
{
*PID = MSG_process_get_PID(t->simdata->sender);
}
MSG_alias_select_from(const char* alias, double timeout, int* PID)
{
m_host_t h = NULL;
MSG_alias_select_from(const char* alias, double timeout, int* PID)
{
m_host_t h = NULL;
int first_time = 1;
smx_cond_t cond;
msg_mailbox_t mailbox;
int first_time = 1;
smx_cond_t cond;
msg_mailbox_t mailbox;
{
*PID = MSG_task_listen_from(alias);
MSG_RETURN(MSG_OK);
{
*PID = MSG_task_listen_from(alias);
MSG_RETURN(MSG_OK);
{
CHECK_HOST();
h = MSG_host_self();
h_simdata = h->simdata;
{
CHECK_HOST();
h = MSG_host_self();
h_simdata = h->simdata;
DEBUG2("Probing on alias %s (%s)", alias, h->name);
DEBUG2("Probing on alias %s (%s)", alias, h->name);
-
- mailbox = MSG_mailbox_get_by_alias(alias);
-
+
+ mailbox = MSG_mailbox_get_by_alias(alias);
+
while(MSG_mailbox_is_empty(mailbox))
{
while(MSG_mailbox_is_empty(mailbox))
{
{
MSG_RETURN(MSG_OK);
}
}
{
MSG_RETURN(MSG_OK);
}
}
SIMIX_mutex_lock(h_simdata->mutex);
SIMIX_mutex_lock(h_simdata->mutex);
xbt_assert1(!MSG_mailbox_get_cond(mailbox),"A process is already blocked on this alias %s",alias);
xbt_assert1(!MSG_mailbox_get_cond(mailbox),"A process is already blocked on this alias %s",alias);
cond = SIMIX_cond_init();
cond = SIMIX_cond_init();
MSG_mailbox_set_cond(mailbox, cond);
MSG_mailbox_set_cond(mailbox, cond);
{
SIMIX_cond_wait_timeout(cond, h_simdata->mutex, timeout);
{
SIMIX_cond_wait_timeout(cond, h_simdata->mutex, timeout);
{
SIMIX_cond_wait(cond, h_simdata->mutex);
}
{
SIMIX_cond_wait(cond, h_simdata->mutex);
}
SIMIX_cond_destroy(cond);
SIMIX_mutex_unlock(h_simdata->mutex);
SIMIX_cond_destroy(cond);
SIMIX_mutex_unlock(h_simdata->mutex);
-
- if (SIMIX_host_get_state(h_simdata->smx_host) == 0)
+
+ if (SIMIX_host_get_state(h_simdata->smx_host) == 0)
{
MSG_RETURN(MSG_HOST_FAILURE);
}
{
MSG_RETURN(MSG_HOST_FAILURE);
}
MSG_mailbox_set_cond(mailbox,NULL);
first_time = 0;
}
MSG_mailbox_set_cond(mailbox,NULL);
first_time = 0;
}
if(NULL == (t = MSG_mailbox_get_head(mailbox)))
MSG_RETURN(MSG_OK);
if(NULL == (t = MSG_mailbox_get_head(mailbox)))
MSG_RETURN(MSG_OK);
{
*PID = MSG_process_get_PID(t->simdata->sender);
}
{
*PID = MSG_process_get_PID(t->simdata->sender);
}
*/
/** @addtogroup m_process_management
* \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Agents" --> \endhtmlonly
*/
/** @addtogroup m_process_management
* \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Agents" --> \endhtmlonly
* We need to simulate many independent scheduling decisions, so
* the concept of <em>process</em> is at the heart of the
* simulator. A process may be defined as a <em>code</em>, with
* We need to simulate many independent scheduling decisions, so
* the concept of <em>process</em> is at the heart of the
* simulator. A process may be defined as a <em>code</em>, with
/** \ingroup m_process_management
* \brief Creates and runs a new #m_process_t.
*
/** \ingroup m_process_management
* \brief Creates and runs a new #m_process_t.
*
- * Does exactly the same as #MSG_process_create_with_arguments but without
+ * Does exactly the same as #MSG_process_create_with_arguments but without
providing standard arguments (\a argc, \a argv, \a start_time, \a kill_time).
* \sa MSG_process_create_with_arguments
*/
providing standard arguments (\a argc, \a argv, \a start_time, \a kill_time).
* \sa MSG_process_create_with_arguments
*/
/** \ingroup m_process_management
* \brief Creates and runs a new #m_process_t.
/** \ingroup m_process_management
* \brief Creates and runs a new #m_process_t.
- * A constructor for #m_process_t taking four arguments and returning the
+ * A constructor for #m_process_t taking four arguments and returning the
* corresponding object. The structure (and the corresponding thread) is
* created, and put in the list of ready process.
* \param name a name for the object. It is for user-level information
* corresponding object. The structure (and the corresponding thread) is
* created, and put in the list of ready process.
* \param name a name for the object. It is for user-level information
void *data, m_host_t host,
int argc, char **argv)
{
void *data, m_host_t host,
int argc, char **argv)
{
- return MSG_process_create_with_environment(name, code, data, host,
+ return MSG_process_create_with_environment(name, code, data, host,
argc,argv,NULL);
}
/** \ingroup m_process_management
* \brief Creates and runs a new #m_process_t.
argc,argv,NULL);
}
/** \ingroup m_process_management
* \brief Creates and runs a new #m_process_t.
- * A constructor for #m_process_t taking four arguments and returning the
+ * A constructor for #m_process_t taking four arguments and returning the
* corresponding object. The structure (and the corresponding thread) is
* created, and put in the list of ready process.
* \param name a name for the object. It is for user-level information
* corresponding object. The structure (and the corresponding thread) is
* created, and put in the list of ready process.
* \param name a name for the object. It is for user-level information
/** \ingroup m_process_management
* \brief Return the user data of a #m_process_t.
*
/** \ingroup m_process_management
* \brief Return the user data of a #m_process_t.
*
- * This function checks whether \a process is a valid pointer or not
+ * This function checks whether \a process is a valid pointer or not
and return the user data associated to \a process if it is possible.
*/
void *MSG_process_get_data(m_process_t process)
and return the user data associated to \a process if it is possible.
*/
void *MSG_process_get_data(m_process_t process)
/** \ingroup m_process_management
* \brief Set the user data of a #m_process_t.
*
/** \ingroup m_process_management
* \brief Set the user data of a #m_process_t.
*
- * This function checks whether \a process is a valid pointer or not
+ * This function checks whether \a process is a valid pointer or not
and set the user data associated to \a process if it is possible.
*/
MSG_error_t MSG_process_set_data(m_process_t process, void *data)
and set the user data associated to \a process if it is possible.
*/
MSG_error_t MSG_process_set_data(m_process_t process, void *data)
/** \ingroup m_process_management
* \brief Return the location on which an agent is running.
*
/** \ingroup m_process_management
* \brief Return the location on which an agent is running.
*
- * This function checks whether \a process is a valid pointer or not
- and return the m_host_t corresponding to the location on which \a
+ * This function checks whether \a process is a valid pointer or not
+ and return the m_host_t corresponding to the location on which \a
process is running.
*/
m_host_t MSG_process_get_host(m_process_t process)
process is running.
*/
m_host_t MSG_process_get_host(m_process_t process)
*
* \brief Return a #m_process_t given its PID.
*
*
* \brief Return a #m_process_t given its PID.
*
- * This function search in the list of all the created m_process_t for a m_process_t
- whose PID is equal to \a PID. If no host is found, \c NULL is returned.
+ * This function search in the list of all the created m_process_t for a m_process_t
+ whose PID is equal to \a PID. If no host is found, \c NULL is returned.
Note that the PID are uniq in the whole simulation, not only on a given host.
*/
m_process_t MSG_process_from_PID(int PID)
Note that the PID are uniq in the whole simulation, not only on a given host.
*/
m_process_t MSG_process_from_PID(int PID)
/** \ingroup m_process_management
* \brief Returns the process ID of \a process.
*
/** \ingroup m_process_management
* \brief Returns the process ID of \a process.
*
- * This function checks whether \a process is a valid pointer or not
+ * This function checks whether \a process is a valid pointer or not
and return its PID (or 0 in case of problem).
*/
int MSG_process_get_PID(m_process_t process)
{
and return its PID (or 0 in case of problem).
*/
int MSG_process_get_PID(m_process_t process)
{
- /* Do not raise an exception here: this function is used in the logs,
+ /* Do not raise an exception here: this function is used in the logs,
and it will be called back by the exception handling stuff */
if (process == NULL || process->simdata == NULL)
return 0;
and it will be called back by the exception handling stuff */
if (process == NULL || process->simdata == NULL)
return 0;
/** \ingroup m_process_management
* \brief Returns the process ID of the parent of \a process.
*
/** \ingroup m_process_management
* \brief Returns the process ID of the parent of \a process.
*
- * This function checks whether \a process is a valid pointer or not
- and return its PID. Returns -1 if the agent has not been created by
+ * This function checks whether \a process is a valid pointer or not
+ and return its PID. Returns -1 if the agent has not been created by
another agent.
*/
int MSG_process_get_PPID(m_process_t process)
another agent.
*/
int MSG_process_get_PPID(m_process_t process)
/** \ingroup m_process_management
* \brief Return the name of an agent.
*
/** \ingroup m_process_management
* \brief Return the name of an agent.
*
- * This function checks whether \a process is a valid pointer or not
+ * This function checks whether \a process is a valid pointer or not
and return its name.
*/
const char *MSG_process_get_name(m_process_t process)
and return its name.
*/
const char *MSG_process_get_name(m_process_t process)
* by the parameter alias and add it in the global dictionary.
*
* \param alias The alias of the mailbox to create.
* by the parameter alias and add it in the global dictionary.
*
* \param alias The alias of the mailbox to create.
* \return The newly created mailbox.
*/
XBT_PUBLIC(msg_mailbox_t)
* \return The newly created mailbox.
*/
XBT_PUBLIC(msg_mailbox_t)
* this type of mailbox is associated with a channel.
*
* \param alias The alias of the mailbox to create.
* this type of mailbox is associated with a channel.
*
* \param alias The alias of the mailbox to create.
* \return The newly created mailbox.
*/
msg_mailbox_t
* \return The newly created mailbox.
*/
msg_mailbox_t
*
* \return The mailbox of the specified host associated the channel
* specified as parameter.
*
* \return The mailbox of the specified host associated the channel
* specified as parameter.
*/
XBT_PUBLIC(msg_mailbox_t)
MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
*/
XBT_PUBLIC(msg_mailbox_t)
MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
XBT_PUBLIC(int)
MSG_mailbox_is_empty(msg_mailbox_t mailbox);
XBT_PUBLIC(int)
MSG_mailbox_is_empty(msg_mailbox_t mailbox);
-/*! \brief MSG_mailbox_put - put a task in a mailbox.
- *
- * The MSG_mailbox_put puts a task in a specified mailbox.
- *
- * \param mailbox The mailbox where put the task.
- * \param task The task to put in the mailbox.
- */
-XBT_PUBLIC(void)
-MSG_mailbox_put(msg_mailbox_t mailbox, m_task_t task);
-
/*! \brief MSG_mailbox_remove - remove a task from a mailbox.
*
* The MSG_mailbox_remove removes a task from a specified mailbox.
/*! \brief MSG_mailbox_remove - remove a task from a mailbox.
*
* The MSG_mailbox_remove removes a task from a specified mailbox.
XBT_PUBLIC(m_task_t)
MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host);
XBT_PUBLIC(m_task_t)
MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host);
-/*! \brief MSG_mailbox_get_count_host_waiting_tasks - Return the number of tasks
+/*! \brief MSG_mailbox_get_count_host_waiting_tasks - Return the number of tasks
waiting to be received in a mailbox and sent by a host.
*
* \param mailbox The mailbox concerned by the operation.
waiting to be received in a mailbox and sent by a host.
*
* \param mailbox The mailbox concerned by the operation.
-void MSG_mailbox_put(msg_mailbox_t mailbox, m_task_t task)
-{
- xbt_fifo_push(mailbox->tasks, task);
-}
-
smx_cond_t MSG_mailbox_get_cond(msg_mailbox_t mailbox)
{
return mailbox->cond;
smx_cond_t MSG_mailbox_get_cond(msg_mailbox_t mailbox)
{
return mailbox->cond;
task_simdata->refcount ++;
local_host = ((simdata_process_t) process->simdata)->m_host;
task_simdata->refcount ++;
local_host = ((simdata_process_t) process->simdata)->m_host;
+ msg_global->sent_msg++;
/* get the host name containing the mailbox */
hostname = MSG_mailbox_get_hostname(mailbox);
/* get the host name containing the mailbox */
hostname = MSG_mailbox_get_hostname(mailbox);
SIMIX_mutex_lock(remote_host->simdata->mutex);
/* put the task in the mailbox */
SIMIX_mutex_lock(remote_host->simdata->mutex);
/* put the task in the mailbox */
- MSG_mailbox_put(mailbox, task);
+ xbt_fifo_push(mailbox->tasks, task);
if ((cond = MSG_mailbox_get_cond(mailbox))) {
DEBUG0("Somebody is listening. Let's wake him up!");
if ((cond = MSG_mailbox_get_cond(mailbox))) {
DEBUG0("Somebody is listening. Let's wake him up!");
/* Copyright (c) 2002-2007 Arnaud Legrand. */
/* Copyright (c) 2007 Bruno Donassolo. */
/* 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. */
/* Copyright (c) 2002-2007 Arnaud Legrand. */
/* Copyright (c) 2007 Bruno Donassolo. */
/* 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. */
#ifndef METASIMGRID_PRIVATE_H
#define METASIMGRID_PRIVATE_H
#ifndef METASIMGRID_PRIVATE_H
#define METASIMGRID_PRIVATE_H
char* hostname; /* the name of the host containing the mailbox */
}s_msg_mailbox_t;
char* hostname; /* the name of the host containing the mailbox */
}s_msg_mailbox_t;
-typedef struct simdata_host
+typedef struct simdata_host
{
smx_host_t smx_host; /* SURF modeling */
struct s_msg_mailbox** mailboxes; /* mailboxes to store msg tasks of of the host */
{
smx_host_t smx_host; /* SURF modeling */
struct s_msg_mailbox** mailboxes; /* mailboxes to store msg tasks of of the host */
smx_action_t comm; /* SURF modeling of communication */
double message_size; /* Data size */
double computation_amount; /* Computation size */
smx_action_t comm; /* SURF modeling of communication */
double message_size; /* Data size */
double computation_amount; /* Computation size */
smx_mutex_t mutex; /* Task mutex */
m_process_t sender;
m_process_t receiver;
smx_mutex_t mutex; /* Task mutex */
m_process_t sender;
m_process_t receiver;
int max_channel;
int PID;
int session;
int max_channel;
int PID;
int session;
+ unsigned long int sent_msg; /* Total amount of messages sent during the simulation */
} s_MSG_Global_t, *MSG_Global_t;
/*extern MSG_Global_t msg_global;*/
XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
} s_MSG_Global_t, *MSG_Global_t;
/*extern MSG_Global_t msg_global;*/
XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
/*************************************************************/
#define PROCESS_SET_ERRNO(val) (MSG_process_self()->simdata->last_errno=val)
/*************************************************************/
#define PROCESS_SET_ERRNO(val) (MSG_process_self()->simdata->last_errno=val)