/********************************* Host **************************************/
-typedef struct sim_data_host *sim_data_host_t;
+typedef struct simdata_host *simdata_host_t;
typedef struct m_host {
char *name; /* host name if any */
- sim_data_host_t simdata; /* simulator data */
+ simdata_host_t simdata; /* simulator data */
void *data; /* user data */
} s_m_host_t;
/** \brief Host datatype
/********************************* Task **************************************/
-typedef struct sim_data_task *sim_data_task_t;
+typedef struct simdata_task *simdata_task_t;
typedef struct m_task {
char *name; /* host name if any */
- sim_data_task_t simdata; /* simulator data */
+ simdata_task_t simdata; /* simulator data */
void *data; /* user data */
} s_m_task_t;
#define MSG_TASK_UNINITIALIZED NULL
/******************************* Process *************************************/
-typedef struct sim_data_process *sim_data_process_t;
+typedef struct simdata_process *simdata_process_t;
typedef struct m_process {
char *name; /* process name if any */
- sim_data_process_t simdata; /* simulator data */
+ simdata_process_t simdata; /* simulator data */
void *data; /* user data */
} s_m_process_t;
/** \brief Agent datatype
void *workstation,
void *data)
{
- sim_data_host_t sim_data = xbt_new0(s_sim_data_host_t,1);
+ simdata_host_t simdata = xbt_new0(s_simdata_host_t,1);
m_host_t host = xbt_new0(s_m_host_t,1);
int i;
/* Host structure */
host->name = xbt_strdup(name);
- host->simdata = sim_data;
+ host->simdata = simdata;
host->data = data;
- sim_data->host = workstation;
+ simdata->host = workstation;
- sim_data->mbox = xbt_new0(xbt_fifo_t, msg_global->max_channel);
+ simdata->mbox = xbt_new0(xbt_fifo_t, msg_global->max_channel);
for (i = 0; i < msg_global->max_channel; i++)
- sim_data->mbox[i] = xbt_fifo_new();
- sim_data->sleeping = xbt_new0(m_process_t, msg_global->max_channel);
+ simdata->mbox[i] = xbt_fifo_new();
+ simdata->sleeping = xbt_new0(m_process_t, msg_global->max_channel);
+ simdata->process_list = xbt_fifo_new();
/* Update global variables */
xbt_fifo_push(msg_global->host, host);
*/
void __MSG_host_destroy(m_host_t host)
{
- sim_data_host_t sim_data = NULL;
+ simdata_host_t simdata = NULL;
int i = 0;
xbt_assert0((host != NULL), "Invalid parameters");
/* Clean Simulator data */
- sim_data = (host)->simdata;
+ simdata = (host)->simdata;
for (i = 0; i < msg_global->max_channel; i++)
- xbt_fifo_free(sim_data->mbox[i]);
- xbt_free(sim_data->mbox);
- xbt_free(sim_data->sleeping);
- xbt_assert0((xbt_swag_size(&(sim_data->process_list))==0),
+ xbt_fifo_free(simdata->mbox[i]);
+ xbt_free(simdata->mbox);
+ xbt_free(simdata->sleeping);
+ xbt_assert0((xbt_fifo_size(simdata->process_list)==0),
"Some process are still running on this host");
- xbt_free(sim_data);
+ xbt_free(simdata);
/* Clean host structure */
xbt_free(host->name);
HOST_ALIVE = 1
} m_host_state_t;
-typedef struct sim_data_host {
+typedef struct simdata_host {
void *host; /* SURF modeling */
xbt_fifo_t *mbox; /* array of FIFOs used as a mailboxes */
m_process_t *sleeping; /* array of process used to know whether a local process is
waiting for a communication on a channel */
m_host_state_t state;
- s_xbt_swag_t process_list;
-} s_sim_data_host_t;
+ xbt_fifo_t process_list;
+} s_simdata_host_t;
/********************************* Task **************************************/
-typedef struct sim_data_task {
+typedef struct simdata_task {
surf_action_t compute; /* SURF modeling of computation */
surf_action_t comm; /* SURF modeling of communication */
double message_size; /* Data size */
double computation_amount; /* Computation size */
xbt_dynar_t sleeping; /* process to wake-up */
-} s_sim_data_task_t;
+} s_simdata_task_t;
/******************************* Process *************************************/
-typedef struct sim_data_process {
- s_xbt_swag_hookup_t host_hookup; /* link to other process running on the same location */
+typedef struct simdata_process {
m_host_t host; /* the host on which the process is running */
xbt_context_t context; /* the context that executes the scheduler fonction */
int PID; /* used for debugging purposes */
int argc; /* arguments number if any */
char **argv; /* arguments table if any */
MSG_error_t last_errno; /* the last value returned by a MSG_function */
-} s_sim_data_process_t;
+} s_simdata_process_t;
/************************** Global variables ********************************/
typedef struct MSG_Global {
/*************************************************************/
-#define PROCESS_SET_ERRNO(val) (((sim_data_process_t)(MSG_process_self()->simdata))->last_errno=val)
-#define PROCESS_GET_ERRNO() (((sim_data_process_t)(MSG_process_self()->simdata))->last_errno)
+#define PROCESS_SET_ERRNO(val) (((simdata_process_t)(MSG_process_self()->simdata))->last_errno=val)
+#define PROCESS_GET_ERRNO() (((simdata_process_t)(MSG_process_self()->simdata))->last_errno)
#define MSG_RETURN(val) do {PROCESS_SET_ERRNO(val);return(val);} while(0)
/* #define CHECK_ERRNO() ASSERT((PROCESS_GET_ERRNO()!=MSG_HOST_FAILURE),"Host failed, you cannot call this function.") */
-#define CHECK_HOST() ASSERT((((sim_data_host_t) MSG_host_self()->simdata)->state==HOST_ALIVE),"Host failed, you cannot call this function.")
+#define CHECK_HOST() ASSERT((((simdata_host_t) MSG_host_self()->simdata)->state==HOST_ALIVE),"Host failed, you cannot call this function.")
m_host_t __MSG_host_create(const char *name, void *workstation,
void *data);
m_task_t MSG_task_create(const char *name, long double compute_duration,
long double message_size, void *data)
{
- sim_data_task_t sim_data = xbt_new0(s_sim_data_task_t,1);
+ simdata_task_t simdata = xbt_new0(s_simdata_task_t,1);
m_task_t task = xbt_new0(s_m_task_t,1);
/* Task structure */
task->name = xbt_strdup(name);
- task->simdata = sim_data;
+ task->simdata = simdata;
task->data = data;
/* Simulator Data */
- sim_data->sleeping = xbt_dynar_new(sizeof(m_process_t),NULL);
- sim_data->computation_amount = compute_duration;
- sim_data->message_size = message_size;
+ simdata->sleeping = xbt_dynar_new(sizeof(m_process_t),NULL);
+ simdata->computation_amount = compute_duration;
+ simdata->message_size = message_size;
return task;
}
*/
MSG_error_t MSG_task_destroy(m_task_t task)
{
- sim_data_task_t sim_data = NULL;
+ simdata_task_t simdata = NULL;
surf_action_t action = NULL;
int i;
/* static MSG_error_t __MSG_task_check(m_task_t task) */
/* { */
-/* sim_data_task_t sim_data = NULL; */
+/* simdata_task_t simdata = NULL; */
/* int warning = 0; */
/* if (task == NULL) { /\* Fatal *\/ */
/* WARNING("Task uninitialized"); */
/* return MSG_FATAL; */
/* } */
-/* sim_data = task->simdata; */
+/* simdata = task->simdata; */
-/* if (sim_data == NULL) { /\* Fatal *\/ */
+/* if (simdata == NULL) { /\* Fatal *\/ */
/* WARNING("Simulator Data uninitialized"); */
/* return MSG_FATAL; */
/* } */
-/* if (sim_data->compute == NULL) { /\* Fatal if execute ... *\/ */
+/* if (simdata->compute == NULL) { /\* Fatal if execute ... *\/ */
/* WARNING("No duration set for this task"); */
/* warning++; */
/* } */
-/* if (sim_data->message_size == 0) { /\* Fatal if transfered ... *\/ */
+/* if (simdata->message_size == 0) { /\* Fatal if transfered ... *\/ */
/* WARNING("No message_size set for this task"); */
/* warning++; */
/* } */
/* static m_task_t __MSG_task_copy(m_task_t src) */
/* { */
/* m_task_t copy = NULL; */
-/* sim_data_task_t sim_data = NULL; */
+/* simdata_task_t simdata = NULL; */
/* __MSG_task_check(src); */
-/* sim_data = src->simdata; */
-/* copy = MSG_task_create(src->name, SG_getTaskCost(sim_data->compute), */
-/* sim_data->message_size, MSG_task_get_data(src)); */
+/* simdata = src->simdata; */
+/* copy = MSG_task_create(src->name, SG_getTaskCost(simdata->compute), */
+/* simdata->message_size, MSG_task_get_data(src)); */
/* return (copy); */
/* } */