#define MSG_DATATYPE_H
#include "xbt/misc.h"
#include "xbt/file_stat.h"
+#include "simgrid/simix.h"
#include "simgrid_config.h" // for HAVE_TRACING
SG_BEGIN_DECL()
-/* ******************************** Host ************************************ */
+/* ******************************** Mailbox ************************************ */
+
+/** @brief Mailbox datatype
+ * @ingroup msg_task_usage
+ *
+ * Object representing a communication rendez-vous point, on which
+ * the sender finds the receiver it wants to communicate with. As a
+ * MSG user, you will only rarely manipulate any of these objects
+ * directly, since most of the public interface (such as
+ * #MSG_task_send and friends) hide this object behind a string
+ * alias. That mean that you don't provide the mailbox on which you
+ * want to send your task, but only the name of this mailbox. */
+typedef struct s_smx_rvpoint *msg_mailbox_t;
+
-typedef struct simdata_host *simdata_host_t;
+/* ******************************** Host ************************************ */
typedef struct m_host {
char *name; /**< @brief host name if any */
- simdata_host_t simdata; /**< @brief simulator data */
+ smx_host_t smx_host; /**< SIMIX representation of this host */
+#ifdef MSG_USE_DEPRECATED
+ msg_mailbox_t *mailboxes; /**< the channels */
+#endif
} s_m_host_t;
/** @brief Host datatype
typedef int m_channel_t;
#endif
-/* ******************************** Mailbox ************************************ */
-
-/** @brief Mailbox datatype
- * @ingroup msg_task_usage
- *
- * Object representing a communication rendez-vous point, on which
- * the sender finds the receiver it wants to communicate with. As a
- * MSG user, you will only rarely manipulate any of these objects
- * directly, since most of the public interface (such as
- * #MSG_task_send and friends) hide this object behind a string
- * alias. That mean that you don't provide the mailbox on which you
- * want to send your task, but only the name of this mailbox. */
-typedef struct s_smx_rvpoint *msg_mailbox_t;
SG_END_DECL()
p_simdata = SIMIX_process_self_get_data(self);
simdata->isused=1;
simdata->compute =
- simcall_host_execute(task->name, p_simdata->m_host->simdata->smx_host,
+ simcall_host_execute(task->name, p_simdata->m_host->smx_host,
simdata->computation_amount,
simdata->priority);
#ifdef HAVE_TRACING
simdata->comm_amount = communication_amount;
for (i = 0; i < host_nb; i++)
- simdata->host_list[i] = host_list[i]->simdata->smx_host;
+ simdata->host_list[i] = host_list[i]->smx_host;
return task;
}
m_host_t __MSG_host_create(smx_host_t workstation)
{
const char *name;
- simdata_host_t simdata = xbt_new0(s_simdata_host_t, 1);
m_host_t host = xbt_new0(s_m_host_t, 1);
name = SIMIX_host_get_name(workstation);
/* Host structure */
host->name = xbt_strdup(name);
- host->simdata = simdata;
- simdata->smx_host = workstation;
+ host->smx_host = workstation;
#ifdef MSG_USE_DEPRECATED
int i;
char alias[MAX_ALIAS_NAME + 1] = { 0 }; /* buffer used to build the key of the mailbox */
if (msg_global->max_channel > 0)
- simdata->mailboxes = xbt_new0(msg_mailbox_t, msg_global->max_channel);
+ host->mailboxes = xbt_new0(msg_mailbox_t, msg_global->max_channel);
for (i = 0; i < msg_global->max_channel; i++) {
sprintf(alias, "%s:%d", name, i);
/* the key of the mailbox (in this case) is build from the name of the host and the channel number */
- simdata->mailboxes[i] = MSG_mailbox_new(alias);
+ host->mailboxes[i] = MSG_mailbox_new(alias);
memset(alias, 0, MAX_ALIAS_NAME + 1);
}
#endif
*/
MSG_error_t MSG_host_set_data(m_host_t host, void *data)
{
- SIMIX_host_set_data(host->simdata->smx_host,data);
+ SIMIX_host_set_data(host->smx_host,data);
return MSG_OK;
}
void *MSG_host_get_data(m_host_t host)
{
- return SIMIX_host_get_data(host->simdata->smx_host);
+ return SIMIX_host_get_data(host->smx_host);
}
/** \ingroup m_host_management
const char *MSG_host_get_name(m_host_t host)
{
- xbt_assert((host != NULL)
- && (host->simdata != NULL), "Invalid parameters");
-
/* Return data */
return (host->name);
}
*/
void __MSG_host_destroy(m_host_t host)
{
- simdata_host_t simdata = NULL;
xbt_assert((host != NULL), "Invalid parameters");
/* Clean simulator data */
- simdata = (host)->simdata;
#ifdef MSG_USE_DEPRECATED
if (msg_global->max_channel > 0)
- free(simdata->mailboxes);
+ free(host->mailboxes);
#endif
- free(simdata);
-
/* Clean host structure */
free(host->name);
free(host);
{
xbt_assert((h != NULL), "Invalid parameters");
- return (simcall_host_get_speed(h->simdata->smx_host));
+ return (simcall_host_get_speed(h->smx_host));
}
/** \ingroup m_host_management
{
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
- return (simcall_host_get_properties(host->simdata->smx_host));
+ return (simcall_host_get_properties(host->smx_host));
}
int MSG_host_is_avail(m_host_t host)
{
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
- return (simcall_host_get_state(host->simdata->smx_host));
+ return (simcall_host_get_state(host->smx_host));
}
m_host_t host)
{
return simcall_rdv_comm_count_by_host(mailbox,
- host->simdata->smx_host);
+ host->smx_host);
}
msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias)
SG_BEGIN_DECL()
/**************** datatypes **********************************/
-typedef struct simdata_host {
- smx_host_t smx_host; /* SURF modeling */
- msg_mailbox_t *mailboxes; /* mailboxes to store msg tasks of of the host */
-} s_simdata_host_t;
/********************************* Task **************************************/
m_host_t now = simdata->m_host;
TRACE_msg_process_change_host(process, now, host);
#endif
- simcall_process_change_host(process, host->simdata->smx_host);
+ simcall_process_change_host(process, host->smx_host);
return MSG_OK;
}