* Deprecate MSG_get_host_{table,number}
Implement MSG_hosts_as_dynar() instead.
* Implement MSG_processes_as_dynar() (Closes gforge #13642)
+ * Remove the public field msg_host_t->name. Use MSG_host_get_name()
Simix:
* Stabilize the parallel execution mode of user contexts
XBT_INFO("Got %d slave(s) :", slaves_count);
for (i = 0; i < slaves_count; i++)
- XBT_INFO("\t %s", slaves[i]->name);
+ XBT_INFO("\t %s", MSG_host_get_name(slaves[i]));
XBT_INFO("Got %d task to process :", number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
XBT_INFO("Sending \"%s\" to \"%s\"",
- todo[i]->name, slaves[i % slaves_count]->name);
+ todo[i]->name, MSG_host_get_name(slaves[i % slaves_count]));
if (MSG_host_self() == slaves[i % slaves_count]) {
XBT_INFO("Hey ! It's me ! :)");
}
XBT_INFO("Got %d slave(s) :", slaves_count);
for (i = 0; i < slaves_count; i++)
- XBT_INFO("\t %s", slaves[i]->name);
+ XBT_INFO("\t %s", MSG_host_get_name(slaves[i]));
XBT_INFO("Got %d task to process :", number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
XBT_INFO("Sending \"%s\" to \"%s\"",
- todo[i]->name, slaves[i % slaves_count]->name);
+ todo[i]->name, MSG_host_get_name(slaves[i % slaves_count]));
if (MSG_host_self() == slaves[i % slaves_count]) {
XBT_INFO("Hey ! It's me ! :)");
}
XBT_INFO("Got %d slave(s) :", slaves_count);
for (i = 0; i < slaves_count; i++)
- XBT_INFO("%s", slaves[i]->name);
+ XBT_INFO("%s", MSG_host_get_name(slaves[i]));
XBT_INFO("Got %d task to process :", number_of_tasks);
} else if (a == MSG_TRANSFER_FAILURE) {
XBT_INFO
("Mmh. Something went wrong with '%s'. Nevermind. Let's keep going!",
- slaves[i % slaves_count]->name);
+ MSG_host_get_name(slaves[i % slaves_count]));
free(task->data);
MSG_task_destroy(task);
} else if (a == MSG_TIMEOUT) {
XBT_INFO
("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
- slaves[i % slaves_count]->name);
+ MSG_host_get_name(slaves[i % slaves_count]));
free(task->data);
MSG_task_destroy(task);
} else {
return 0;
} else if (a == MSG_TRANSFER_FAILURE) {
XBT_INFO("Mmh. Can't reach '%s'! Nevermind. Let's keep going!",
- slaves[i]->name);
+ MSG_host_get_name(slaves[i]));
MSG_task_destroy(task);
} else if (a == MSG_TIMEOUT) {
XBT_INFO
("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
- slaves[i % slaves_count]->name);
+ MSG_host_get_name(slaves[i % slaves_count]));
MSG_task_destroy(task);
} else {
XBT_INFO("Hey ?! What's up ? ");
- xbt_die("Unexpected behavior with '%s': %d", slaves[i]->name, a);
+ xbt_die("Unexpected behavior with '%s': %d", MSG_host_get_name(slaves[i]), a);
}
}
XBT_INFO("Got %d slaves and %d tasks to process", slaves_count,
number_of_tasks);
for (i = 0; i < slaves_count; i++)
- XBT_DEBUG("%s", slaves[i]->name);
+ XBT_DEBUG("%s", MSG_host_get_name(slaves[i]));
for (i = 0; i < number_of_tasks; i++) {
XBT_INFO("Sending \"%s\" to \"%s\"",
- todo[i]->name, slaves[i % slaves_count]->name);
+ todo[i]->name, MSG_host_get_name(slaves[i % slaves_count]));
if (MSG_host_self() == slaves[i % slaves_count]) {
XBT_INFO("Hey ! It's me ! :)");
}
break;
}
XBT_INFO("Sending \"%s\" to \"%s\"",
- MSG_task_get_name(task), slaves[i % slaves_count]->name);
+ MSG_task_get_name(task), MSG_host_get_name(slaves[i % slaves_count]));
MSG_task_send(task, MSG_host_get_name(slaves[i % slaves_count]));
i++;
} else {
xbt_mutex_release(mutex);
MSG_process_suspend(MSG_process_self());
m_host_t h = MSG_process_get_host(MSG_process_self());
- XBT_INFO("I've been moved on this new host: %s", h->name);
+ XBT_INFO("I've been moved on this new host: %s", MSG_host_get_name(h));
XBT_INFO("Uh, nothing to do here. Stopping now");
return 0;
} /* end_of_emigrant */
long slaves_count = atol(argv[4]);
//setting the variable "is_master" (previously declared) to value 1
- TRACE_host_variable_set(MSG_host_self()->name, "is_master", 1);
+ TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "is_master", 1);
TRACE_mark("msmark", "start_send_tasks");
int i;
task = MSG_task_create("task", task_comp_size, task_comm_size, NULL);
//setting the variable "task_creation" to value i
- TRACE_host_variable_set(MSG_host_self()->name, "task_creation", i);
+ TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "task_creation", i);
//setting the category of task to "compute"
//the category of a task must be defined before it is sent or executed
{
m_task_t task = NULL;
- TRACE_host_variable_set(MSG_host_self()->name, "is_slave", 1);
+ TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "is_slave", 1);
while (1) {
MSG_task_receive(&(task), "master_mailbox");
}
//adding the value returned by MSG_task_get_compute_duration(task)
//to the variable "task_computation"
- TRACE_host_variable_add(MSG_host_self()->name,
+ TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()),
"task_computation",
MSG_task_get_compute_duration(task));
MSG_task_execute(task);
int master(int argc, char *argv[])
{
- char *hostname = MSG_host_self()->name;
+ const char *hostname = MSG_host_get_name(MSG_host_self());
int i;
//the hostname has an empty HDD with a capacity of 100000 (bytes)
/* ******************************** Host ************************************ */
typedef struct m_host {
- char *name; /**< @brief host name if any */
smx_host_t smx_host; /**< SIMIX representation of this host */
#ifdef MSG_USE_DEPRECATED
msg_mailbox_t *mailboxes; /**< the channels */
PJ_container_free(existing_container);
//create new container on the new_host location
- msg = PJ_container_new(instr_process_id(process, str, len), INSTR_MSG_PROCESS, PJ_container_get(new_host->name));
+ msg = PJ_container_new(instr_process_id(process, str, len), INSTR_MSG_PROCESS, PJ_container_get(SIMIX_host_get_name(new_host->smx_host)));
//end link
msg = PJ_container_get(instr_process_id(process, str, len));
int len = INSTR_DEFAULT_STR_SIZE;
char str[INSTR_DEFAULT_STR_SIZE];
- container_t host_container = PJ_container_get (host->name);
+ container_t host_container = PJ_container_get (SIMIX_host_get_name(host->smx_host));
PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container);
}
}
xbt_assert(simdata->host_nb,
"This is not a parallel task. Go to hell.");
- XBT_DEBUG("Parallel computing on %s", p_simdata->m_host->name);
+ XBT_DEBUG("Parallel computing on %s", SIMIX_host_get_name(p_simdata->m_host->smx_host));
simdata->isused=1;
/********************************* Host **************************************/
m_host_t __MSG_host_create(smx_host_t workstation)
{
- const char *name;
+ const char *name = SIMIX_host_get_name(workstation);
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->smx_host = workstation;
#ifdef MSG_USE_DEPRECATED
* This functions checks whether \a host is a valid pointer or not and return
its name.
*/
-const char *MSG_host_get_name(m_host_t host)
-{
-
- /* Return data */
- return (host->name);
+const char *MSG_host_get_name(m_host_t host) {
+ return SIMIX_host_get_name(host->smx_host);
}
/** \ingroup m_host_management
/** \ingroup m_host_management
*
- * \brief Destroys a host
+ * \brief Destroys a host (internal call only)
*/
-void __MSG_host_destroy(m_host_t host)
-{
-
- xbt_assert((host != NULL), "Invalid parameters");
-
- /* Clean simulator data */
+void __MSG_host_destroy(m_host_t host) {
#ifdef MSG_USE_DEPRECATED
if (msg_global->max_channel > 0)
free(host->mailboxes);
#endif
- /* Clean host structure */
- free(host->name);
free(host);
}
/* Let's create the process: SIMIX may decide to start it right now,
* even before returning the flow control to us */
- simcall_process_create(&process, name, code, simdata, host->name,
+ simcall_process_create(&process, name, code, simdata, SIMIX_host_get_name(host->smx_host),
argc, argv, properties);
if (!process) {