int master(int argc, char *argv[]) {
int slaves_count = 10;
- m_host_t *slaves = xbt_new(m_host_t,10);
+ msg_host_t *slaves = xbt_new(msg_host_t,10);
int i;
{
MSG_error_t res = MSG_OK;
xbt_dynar_t hosts_dynar;
- m_host_t*hosts= xbt_new(m_host_t,10);
+ msg_host_t*hosts= xbt_new(msg_host_t,10);
char**hostnames= xbt_new(char*,10);
char**masterargv=xbt_new(char*,12);
int i;
"I need at least 10 hosts in the platform file, but %s contains only %ld hosts_dynar.",
argv[1],xbt_dynar_length(hosts_dynar));
for (i=0;i<10;i++) {
- hosts[i] = xbt_dynar_get_as(hosts_dynar,i,m_host_t);
+ hosts[i] = xbt_dynar_get_as(hosts_dynar,i,msg_host_t);
hostnames[i] = xbt_strdup(MSG_host_get_name(hosts[i]));
}
masterargv[0]=xbt_strdup("master");
for(i = 0 ; i<nb_hosts; i++)
{
char* name_host = bprintf("%d",i);
- MSG_process_create( name_host, host, NULL, xbt_dynar_get_as(hosts,i,m_host_t) );
+ MSG_process_create( name_host, host, NULL, xbt_dynar_get_as(hosts,i,msg_host_t) );
free(name_host);
}
xbt_dynar_free(&hosts);
long number_max = xbt_dynar_length(host_dynar);
XBT_INFO("Got %ld slaves, %ld tasks to process, and %ld hosts", number_of_slaves, number_of_jobs,number_max);
- m_host_t *host_table = xbt_dynar_to_array(host_dynar);
+ msg_host_t *host_table = xbt_dynar_to_array(host_dynar);
//xbt_dynar_free(&host_dynar);
MSG_process_create( "master",
int master(int argc, char *argv[])
{
int slaves_count = 0;
- m_host_t *slaves = NULL;
+ msg_host_t *slaves = NULL;
m_task_t *todo = NULL;
int number_of_tasks = 0;
double task_comp_size = 0;
{ /* Process organisation */
slaves_count = argc - 4;
- slaves = xbt_new0(m_host_t, slaves_count);
+ slaves = xbt_new0(msg_host_t, slaves_count);
for (i = 4; i < argc; i++) {
slaves[i - 4] = MSG_get_host_by_name(argv[i]);
int master(int argc, char *argv[])
{
int slaves_count = 0;
- m_host_t *slaves = NULL;
+ msg_host_t *slaves = NULL;
m_task_t *todo = NULL;
int number_of_tasks = 0;
double task_comp_size = 0;
{ /* Process organisation */
slaves_count = argc - 4;
- slaves = xbt_new0(m_host_t, slaves_count);
+ slaves = xbt_new0(msg_host_t, slaves_count);
for (i = 4; i < argc; i++) {
slaves[i - 4] = MSG_get_host_by_name(argv[i]);
int master(int argc, char *argv[])
{
int slaves_count = 0;
- m_host_t *slaves = NULL;
+ msg_host_t *slaves = NULL;
int number_of_tasks = 0;
double task_comp_size = 0;
double task_comm_size = 0;
{ /* Process organisation */
slaves_count = argc - 4;
- slaves = xbt_new0(m_host_t, slaves_count);
+ slaves = xbt_new0(msg_host_t, slaves_count);
for (i = 4; i < argc; i++) {
slaves[i - 4] = MSG_get_host_by_name(argv[i]);
int master(int argc, char *argv[])
{
int slaves_count = 0;
- m_host_t *slaves = NULL;
+ msg_host_t *slaves = NULL;
m_task_t *todo = NULL;
int number_of_tasks = 0;
double task_comp_size = 0;
{ /* Process organisation */
slaves_count = argc - 4;
- slaves = xbt_new0(m_host_t, slaves_count);
+ slaves = xbt_new0(msg_host_t, slaves_count);
for (i = 4; i < argc; i++) {
slaves[i - 4] = MSG_get_host_by_name(argv[i]);
{
int i;
int slaves_count;
- m_host_t *slaves;
+ msg_host_t *slaves;
{ /* Process organisation */
slaves_count = argc - 1;
- slaves = xbt_new0(m_host_t, slaves_count);
+ slaves = xbt_new0(msg_host_t, slaves_count);
for (i = 1; i < argc; i++) {
slaves[i - 1] = MSG_get_host_by_name(argv[i]);
xbt_cond_broadcast(cond);
xbt_mutex_release(mutex);
MSG_process_suspend(MSG_process_self());
- m_host_t h = MSG_process_get_host(MSG_process_self());
+ msg_host_t h = MSG_process_get_host(MSG_process_self());
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;
{
xbt_dynar_t slaves_dynar;
int slaves_count = 0;
- m_host_t *slaves = NULL;
+ msg_host_t *slaves = NULL;
double task_comp_size = 100000;
double task_comm_size = 10000;
double *computation_amount = NULL;
{
MSG_error_t res = MSG_OK;
xbt_dynar_t all_hosts;
- m_host_t first_host;
+ msg_host_t first_host;
MSG_config("workstation/model", "ptask_L07");
MSG_create_environment(platform_file);
all_hosts = MSG_hosts_as_dynar();
- first_host = xbt_dynar_getfirst_as(all_hosts,m_host_t);
+ first_host = xbt_dynar_getfirst_as(all_hosts,msg_host_t);
MSG_process_create("test", test, NULL, first_host);
res = MSG_main();
xbt_dynar_free(&all_hosts);
{
char buffer[32];
int i, j;
- m_host_t *m_host_list = NULL;
+ msg_host_t *m_host_list = NULL;
m_task_t task = NULL;
int host_list_size;
double *computation_duration = NULL;
host_list_size = argc - 3;
XBT_DEBUG("host_list_size=%d", host_list_size);
- m_host_list = calloc(host_list_size, sizeof(m_host_t));
+ m_host_list = calloc(host_list_size, sizeof(msg_host_t));
for (i = 1; i <= host_list_size; i++) {
m_host_list[i - 1] = MSG_get_host_by_name(argv[i]);
xbt_assert(m_host_list[i - 1] != NULL,
{
char buffer[32];
int i, j;
- m_host_t *m_host_list = NULL;
+ msg_host_t *m_host_list = NULL;
m_task_t task = NULL;
int host_list_size;
double *computation_duration = NULL;
host_list_size = argc - 2;
XBT_DEBUG("host_list_size=%d", host_list_size);
- m_host_list = calloc(host_list_size, sizeof(m_host_t));
+ m_host_list = calloc(host_list_size, sizeof(msg_host_t));
for (i = 1; i <= host_list_size; i++) {
m_host_list[i - 1] = MSG_get_host_by_name(argv[i]);
xbt_assert(m_host_list[i - 1] != NULL,
static void test_host(const char*hostname)
{
- m_host_t thehost = MSG_get_host_by_name(hostname);
+ msg_host_t thehost = MSG_get_host_by_name(hostname);
xbt_dict_t props = MSG_host_get_properties(thehost);
xbt_dict_cursor_t cursor = NULL;
char *key, *data;
/** Emitter function */
int sender(int argc, char *argv[])
{
- m_host_t host = NULL;
+ msg_host_t host = NULL;
double time;
m_task_t task_la = NULL;
m_task_t task_bw = NULL;
XBT_INFO("sender");
- /*host = xbt_new0(m_host_t,1); */
+ /*host = xbt_new0(msg_host_t,1); */
XBT_INFO("host = %s", argv[1]);
for(i = 0 ; i<nb_hosts; i++)
{
char* name_host = bprintf("%d",i);
- MSG_process_create( name_host, host, NULL, xbt_dynar_get_as(hosts,i,m_host_t) );
+ MSG_process_create( name_host, host, NULL, xbt_dynar_get_as(hosts,i,msg_host_t) );
free(name_host);
}
xbt_dynar_free(&hosts);
/* ******************************** Host ************************************ */
-typedef struct m_host {
+typedef struct msg_host {
xbt_swag_t vms;
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;
+} s_msg_host_t;
/** @brief Host datatype.
@ingroup m_host_management
some <em>private data</em> that can be only accessed by local
process.
*/
-typedef struct m_host *m_host_t;
+typedef struct msg_host *msg_host_t;
/* ******************************** Task ************************************ */
/* Compatibility typedefs */
typedef msg_process_t m_process_t;
+typedef msg_host_t m_host_t;
#ifdef MSG_USE_DEPRECATED
typedef int m_channel_t;
/************************** Host handling ***********************************/
-XBT_PUBLIC(MSG_error_t) MSG_host_set_data(m_host_t host, void *data);
-XBT_PUBLIC(void *) MSG_host_get_data(m_host_t host);
-XBT_PUBLIC(const char *) MSG_host_get_name(m_host_t host);
-XBT_PUBLIC(m_host_t) MSG_host_self(void);
-XBT_PUBLIC(int) MSG_get_host_msgload(m_host_t host);
+XBT_PUBLIC(MSG_error_t) MSG_host_set_data(msg_host_t host, void *data);
+XBT_PUBLIC(void *) MSG_host_get_data(msg_host_t host);
+XBT_PUBLIC(const char *) MSG_host_get_name(msg_host_t host);
+XBT_PUBLIC(msg_host_t) MSG_host_self(void);
+XBT_PUBLIC(int) MSG_get_host_msgload(msg_host_t host);
/* int MSG_get_msgload(void); This function lacks specification; discard it */
-XBT_PUBLIC(double) MSG_get_host_speed(m_host_t h);
-XBT_PUBLIC(int) MSG_host_is_avail(m_host_t h);
-XBT_PUBLIC(void) __MSG_host_destroy(m_host_t host);
+XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h);
+XBT_PUBLIC(int) MSG_host_is_avail(msg_host_t h);
+XBT_PUBLIC(void) __MSG_host_destroy(msg_host_t host);
/*property handlers*/
-XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(m_host_t host);
-XBT_PUBLIC(const char *) MSG_host_get_property_value(m_host_t host,
+XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host);
+XBT_PUBLIC(const char *) MSG_host_get_property_value(msg_host_t host,
const char *name);
-XBT_PUBLIC(void) MSG_host_set_property_value(m_host_t host,
+XBT_PUBLIC(void) MSG_host_set_property_value(msg_host_t host,
const char *name, char *value,
void_f_pvoid_t free_ctn);
XBT_PUBLIC(void) MSG_create_environment(const char *file);
XBT_PUBLIC(void) MSG_load_platform_script(const char *script_file);
-XBT_PUBLIC(m_host_t) MSG_get_host_by_name(const char *name);
+XBT_PUBLIC(msg_host_t) MSG_get_host_by_name(const char *name);
XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
/************************** Process handling *********************************/
XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
xbt_main_func_t code,
- void *data, m_host_t host);
+ void *data, msg_host_t host);
XBT_PUBLIC(msg_process_t) MSG_process_create_with_arguments(const char *name,
xbt_main_func_t
code, void *data,
- m_host_t host,
+ msg_host_t host,
int argc,
char **argv);
XBT_PUBLIC(msg_process_t) MSG_process_create_with_environment(const char
xbt_main_func_t
code,
void *data,
- m_host_t host,
+ msg_host_t host,
int argc,
char **argv,
xbt_dict_t
XBT_PUBLIC(void) MSG_process_kill(msg_process_t process);
XBT_PUBLIC(int) MSG_process_killall(int reset_PIDs);
-XBT_PUBLIC(MSG_error_t) MSG_process_migrate(msg_process_t process, m_host_t host);
+XBT_PUBLIC(MSG_error_t) MSG_process_migrate(msg_process_t process, msg_host_t host);
XBT_PUBLIC(void *) MSG_process_get_data(msg_process_t process);
XBT_PUBLIC(MSG_error_t) MSG_process_set_data(msg_process_t process,
void *data);
XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup);
-XBT_PUBLIC(m_host_t) MSG_process_get_host(msg_process_t process);
+XBT_PUBLIC(msg_host_t) MSG_process_get_host(msg_process_t process);
XBT_PUBLIC(msg_process_t) MSG_process_from_PID(int PID);
XBT_PUBLIC(int) MSG_process_get_PID(msg_process_t process);
XBT_PUBLIC(int) MSG_process_get_PPID(msg_process_t process);
double collect_latency);
XBT_PUBLIC(m_task_t) MSG_parallel_task_create(const char *name,
int host_nb,
- const m_host_t * host_list,
+ const msg_host_t * host_list,
double *computation_amount,
double *communication_amount,
void *data);
XBT_PUBLIC(void) MSG_task_set_copy_callback(void (*callback) (
m_task_t task, msg_process_t src, msg_process_t dst));
XBT_PUBLIC(msg_process_t) MSG_task_get_sender(m_task_t task);
-XBT_PUBLIC(m_host_t) MSG_task_get_source(m_task_t task);
+XBT_PUBLIC(msg_host_t) MSG_task_get_source(m_task_t task);
XBT_PUBLIC(const char *) MSG_task_get_name(m_task_t task);
XBT_PUBLIC(void) MSG_task_set_name(m_task_t task, const char *name);
XBT_PUBLIC(MSG_error_t) MSG_task_cancel(m_task_t task);
XBT_PUBLIC(MSG_error_t) MSG_task_destroy(m_task_t task);
XBT_PUBLIC(MSG_error_t) MSG_task_receive_from_host(m_task_t * task, const char *alias,
- m_host_t host);
+ msg_host_t host);
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(MSG_error_t)
MSG_task_receive_ext(m_task_t * task, const char *alias, double timeout,
- m_host_t host);
+ msg_host_t host);
XBT_PUBLIC(MSG_error_t)
MSG_task_receive_with_timeout(m_task_t * task, const char *alias,
XBT_PUBLIC(int) MSG_task_listen(const char *alias);
XBT_PUBLIC(int) MSG_task_listen_from_host(const char *alias,
- m_host_t host);
+ msg_host_t host);
XBT_PUBLIC(MSG_error_t)
MSG_task_send_with_timeout(m_task_t task, const char *alias,
/************************** Task handling ************************************/
XBT_PUBLIC(MSG_error_t)
MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
- m_host_t host, double timeout);
+ msg_host_t host, double timeout);
XBT_PUBLIC(MSG_error_t)
MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
/* these are the functions which are deprecated. Do not use them, they may get removed in future releases */
XBT_PUBLIC(int) MSG_get_host_number(void);
-XBT_PUBLIC(m_host_t *) MSG_get_host_table(void);
+XBT_PUBLIC(msg_host_t *) MSG_get_host_table(void);
#define MSG_TIMEOUT_FAILURE MSG_TIMEOUT
#define MSG_TASK_CANCELLED MSG_TASK_CANCELED
m_channel_t channel,
double max_duration);
XBT_PUBLIC(MSG_error_t) MSG_task_get_from_host(m_task_t * task,
- int channel, m_host_t host);
+ int channel, msg_host_t host);
XBT_PUBLIC(MSG_error_t) MSG_task_get_ext(m_task_t * task, int channel,
double max_duration,
- m_host_t host);
-XBT_PUBLIC(MSG_error_t) MSG_task_put(m_task_t task, m_host_t dest,
+ msg_host_t host);
+XBT_PUBLIC(MSG_error_t) MSG_task_put(m_task_t task, msg_host_t dest,
m_channel_t channel);
XBT_PUBLIC(MSG_error_t) MSG_task_put_bounded(m_task_t task,
- m_host_t dest,
+ msg_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,
+ msg_host_t dest,
m_channel_t channel,
double max_duration);
XBT_PUBLIC(int) MSG_task_Iprobe(m_channel_t channel);
XBT_PUBLIC(int) MSG_task_probe_from(m_channel_t channel);
-XBT_PUBLIC(int) MSG_task_probe_from_host(int channel, m_host_t host);
+XBT_PUBLIC(int) MSG_task_probe_from_host(int channel, msg_host_t host);
XBT_PUBLIC(MSG_error_t) MSG_set_channel_number(int number);
XBT_PUBLIC(int) MSG_get_channel_number(void);
*/
typedef struct msg_vm *msg_vm_t;
/* This function should not be called directly, but rather from MSG_vm_start_from_template that does not exist yet*/
-XBT_PUBLIC(msg_vm_t) MSG_vm_start(m_host_t location, int coreAmount);
+XBT_PUBLIC(msg_vm_t) MSG_vm_start(msg_host_t location, int coreAmount);
XBT_PUBLIC(int) MSG_vm_is_suspended(msg_vm_t);
XBT_PUBLIC(int) MSG_vm_is_running(msg_vm_t);
XBT_PUBLIC(void) MSG_vm_bind(msg_vm_t vm, msg_process_t process);
XBT_PUBLIC(void) MSG_vm_unbind(msg_vm_t vm, msg_process_t process); // simple wrapper over process_kill
-XBT_PUBLIC(void) MSG_vm_migrate(msg_vm_t vm, m_host_t destination);
+XBT_PUBLIC(void) MSG_vm_migrate(msg_vm_t vm, msg_host_t destination);
XBT_PUBLIC(void) MSG_vm_suspend(msg_vm_t vm);
// \forall p in VM, MSG_process_suspend(p) // Freeze the processes
* \param index an index in the Lua stack
* \return the C host corresponding to this Lua host
*/
-m_host_t sglua_check_host(lua_State * L, int index)
+msg_host_t sglua_check_host(lua_State * L, int index)
{
- m_host_t *pi, ht;
+ msg_host_t *pi, ht;
luaL_checktype(L, index, LUA_TTABLE);
lua_getfield(L, index, "__simgrid_host");
- pi = (m_host_t *) luaL_checkudata(L, lua_gettop(L), HOST_MODULE_NAME);
+ pi = (msg_host_t *) luaL_checkudata(L, lua_gettop(L), HOST_MODULE_NAME);
if (pi == NULL)
luaL_typerror(L, index, HOST_MODULE_NAME);
ht = *pi;
{
const char *name = luaL_checkstring(L, 1);
XBT_DEBUG("Getting Host from name...");
- m_host_t msg_host = MSG_get_host_by_name(name);
+ msg_host_t msg_host = MSG_get_host_by_name(name);
if (!msg_host) {
luaL_error(L, "null Host : MSG_get_host_by_name failed");
}
lua_newtable(L); /* create a table, put the userdata on top of it */
- m_host_t *lua_host = (m_host_t *) lua_newuserdata(L, sizeof(m_host_t));
+ msg_host_t *lua_host = (msg_host_t *) lua_newuserdata(L, sizeof(msg_host_t));
*lua_host = msg_host;
luaL_getmetatable(L, HOST_MODULE_NAME);
lua_setmetatable(L, -2);
*/
static int l_host_get_name(lua_State * L)
{
- m_host_t ht = sglua_check_host(L, 1);
+ msg_host_t ht = sglua_check_host(L, 1);
lua_pushstring(L, MSG_host_get_name(ht));
return 1;
}
{
int index = luaL_checkinteger(L, 1);
xbt_dynar_t hosts = MSG_hosts_as_dynar();
- m_host_t host = xbt_dynar_get_as(hosts,index - 1,m_host_t);// lua indexing start by 1 (lua[1] <=> C[0])
+ msg_host_t host = xbt_dynar_get_as(hosts,index - 1,msg_host_t);// lua indexing start by 1 (lua[1] <=> C[0])
lua_newtable(L); /* create a table, put the userdata on top of it */
- m_host_t *lua_host = (m_host_t *) lua_newuserdata(L, sizeof(m_host_t));
+ msg_host_t *lua_host = (msg_host_t *) lua_newuserdata(L, sizeof(msg_host_t));
*lua_host = host;
luaL_getmetatable(L, HOST_MODULE_NAME);
lua_setmetatable(L, -2);
static int l_host_self(lua_State * L)
{
/* -- */
- m_host_t host = MSG_host_self();
+ msg_host_t host = MSG_host_self();
lua_newtable(L);
/* table */
- m_host_t* lua_host = (m_host_t*) lua_newuserdata(L, sizeof(m_host_t));
+ msg_host_t* lua_host = (msg_host_t*) lua_newuserdata(L, sizeof(msg_host_t));
/* table ud */
*lua_host = host;
luaL_getmetatable(L, HOST_MODULE_NAME);
*/
static int l_host_get_property_value(lua_State * L)
{
- m_host_t ht = sglua_check_host(L, 1);
+ msg_host_t ht = sglua_check_host(L, 1);
const char *prop = luaL_checkstring(L, 2);
lua_pushstring(L,MSG_host_get_property_value(ht,prop));
return 1;
*/
static int l_host_destroy(lua_State *L)
{
- m_host_t ht = sglua_check_host(L, 1);
+ msg_host_t ht = sglua_check_host(L, 1);
__MSG_host_destroy(ht);
return 0;
}
lua_pop(L, 1);
// FIXME: hackish to go under MSG that way
- m_host_t host = xbt_lib_get_or_null(host_lib,host_id,MSG_HOST_LEVEL);
+ msg_host_t host = xbt_lib_get_or_null(host_lib,host_id,MSG_HOST_LEVEL);
if (!host) {
XBT_ERROR("no host '%s' found",host_id);
return -1;
lua_pop(L, 1);
// FIXME: hackish to go under MSG that way
- m_host_t host = xbt_lib_get_or_null(host_lib,name,MSG_HOST_LEVEL);
+ msg_host_t host = xbt_lib_get_or_null(host_lib,name,MSG_HOST_LEVEL);
if (!host) {
XBT_ERROR("no host '%s' found",name);
return -1;
void sglua_push_comm(lua_State* L, msg_comm_t comm);
void sglua_register_host_functions(lua_State* L);
-m_host_t sglua_check_host(lua_State* L, int index);
+msg_host_t sglua_check_host(lua_State* L, int index);
void sglua_register_process_functions(lua_State* L);
/*
* Instrumentation functions to trace MSG processes (msg_process_t)
*/
-void TRACE_msg_process_change_host(msg_process_t process, m_host_t old_host, m_host_t new_host)
+void TRACE_msg_process_change_host(msg_process_t process, msg_host_t old_host, msg_host_t new_host)
{
if (TRACE_msg_process_is_enabled()){
static long long int counter = 0;
}
}
-void TRACE_msg_process_create (const char *process_name, int process_pid, m_host_t host)
+void TRACE_msg_process_create (const char *process_name, int process_pid, msg_host_t host)
{
if (TRACE_msg_process_is_enabled()){
int len = INSTR_DEFAULT_STR_SIZE;
/* declaration of instrumentation functions from msg_process_instr.c */
char *instr_process_id (msg_process_t proc, char *str, int len);
char *instr_process_id_2 (const char *process_name, int process_pid, char *str, int len);
-void TRACE_msg_process_change_host(msg_process_t process, m_host_t old_host,
- m_host_t new_host);
-void TRACE_msg_process_create (const char *process_name, int process_pid, m_host_t host);
+void TRACE_msg_process_change_host(msg_process_t process, msg_host_t old_host,
+ msg_host_t new_host);
+void TRACE_msg_process_create (const char *process_name, int process_pid, msg_host_t host);
void TRACE_msg_process_kill(msg_process_t process);
void TRACE_msg_process_suspend(msg_process_t process);
void TRACE_msg_process_resume(msg_process_t process);
*
* \param task a memory location for storing a #m_task_t.
* \param alias name of the mailbox to receive the task from
- * \param host a #m_host_t host from where the task was sent
+ * \param host a #msg_host_t host from where the task was sent
*
* \return Returns
* #MSG_OK if the task was successfully received,
*/
MSG_error_t
MSG_task_receive_from_host(m_task_t * task, const char *alias,
- m_host_t host)
+ msg_host_t host)
{
return MSG_task_receive_ext(task, alias, -1, host);
}
* \param task a memory location for storing a #m_task_t.
* \param alias name of the mailbox to receive the task from
* \param timeout is the maximum wait time for completion (provide -1 for no timeout)
- * \param host a #m_host_t host from where the task was sent
+ * \param host a #msg_host_t host from where the task was sent
*
* \return Returns
* #MSG_OK if the task was successfully received,
*/
MSG_error_t
MSG_task_receive_ext(m_task_t * task, const char *alias, double timeout,
- m_host_t host)
+ msg_host_t host)
{
XBT_DEBUG
("MSG_task_receive_ext: Trying to receive a message on mailbox '%s'",
* given mailbox, 0 if there is no pending communication actions.
*
*/
-int MSG_task_listen_from_host(const char *alias, m_host_t host)
+int MSG_task_listen_from_host(const char *alias, msg_host_t host)
{
return
MSG_mailbox_get_count_host_waiting_tasks(MSG_mailbox_get_by_alias
* #MSG_TRANSFER_FAILURE if the transfer could not be properly done
* (network failure, dest failure) or #MSG_OK if it succeeded.
*/
-MSG_error_t MSG_task_put(m_task_t task, m_host_t dest, m_channel_t channel)
+MSG_error_t MSG_task_put(m_task_t task, msg_host_t dest, m_channel_t channel)
{
XBT_WARN("DEPRECATED! Now use MSG_task_send");
return MSG_task_put_with_timeout(task, dest, channel, -1.0);
* \sa MSG_task_put
*/
MSG_error_t
-MSG_task_put_bounded(m_task_t task, m_host_t dest, m_channel_t channel,
+MSG_task_put_bounded(m_task_t task, msg_host_t dest, m_channel_t channel,
double maxrate)
{
XBT_WARN("DEPRECATED! Now use MSG_task_send_bounded");
(network failure, dest failure, timeout...) or #MSG_OK if the communication succeeded.
*/
MSG_error_t
-MSG_task_put_with_timeout(m_task_t task, m_host_t dest,
+MSG_task_put_with_timeout(m_task_t task, msg_host_t dest,
m_channel_t channel, double timeout)
{
XBT_WARN("DEPRECATED! Now use MSG_task_send_with_timeout");
* \return the number of tasks waiting to be received on \a channel
and sent by \a host.
*/
-int MSG_task_probe_from_host(int channel, m_host_t host)
+int MSG_task_probe_from_host(int channel, msg_host_t host)
{
XBT_WARN("DEPRECATED! Now use MSG_task_listen_from_host");
xbt_assert((channel >= 0)
* \return a #MSG_error_t indicating whether the operation was successful (#MSG_OK), or why it failed otherwise.
*/
MSG_error_t
-MSG_task_get_from_host(m_task_t * task, m_channel_t channel, m_host_t host)
+MSG_task_get_from_host(m_task_t * task, m_channel_t channel, msg_host_t host)
{
XBT_WARN("DEPRECATED! Now use MSG_task_receive_from_host");
return MSG_task_get_ext(task, channel, -1, host);
MSG_error_t
MSG_task_get_ext(m_task_t * task, m_channel_t channel, double timeout,
- m_host_t host)
+ msg_host_t host)
{
XBT_WARN("DEPRECATED! Now use MSG_task_receive_ext");
xbt_assert((channel >= 0)
/** @addtogroup m_host_management
* \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Hosts" --> \endhtmlonly
- * (#m_host_t) and the functions for managing it.
+ * (#msg_host_t) and the functions for managing it.
*
* A <em>location</em> (or <em>host</em>) is any possible place where
* a process may run. Thus it may be represented as a
* <em>mailboxes</em> to enable running process to communicate with
* remote ones, and some <em>private data</em> that can be only
* accessed by local process.
- * \see m_host_t
+ * \see msg_host_t
*/
/********************************* Host **************************************/
-m_host_t __MSG_host_create(smx_host_t workstation)
+msg_host_t __MSG_host_create(smx_host_t workstation)
{
const char *name = SIMIX_host_get_name(workstation);
- m_host_t host = xbt_new0(s_m_host_t, 1);
+ msg_host_t host = xbt_new0(s_msg_host_t, 1);
s_msg_vm_t vm; // simply to compute the offset
host->smx_host = workstation;
}
/** \ingroup msg_host_management
- * \brief Finds a m_host_t using its name.
+ * \brief Finds a msg_host_t using its name.
*
* This is a name directory service
* \param name the name of an host.
* \return the corresponding host
*/
-m_host_t MSG_get_host_by_name(const char *name)
+msg_host_t MSG_get_host_by_name(const char *name)
{
- return (m_host_t) xbt_lib_get_or_null(host_lib,name,MSG_HOST_LEVEL);
+ return (msg_host_t) xbt_lib_get_or_null(host_lib,name,MSG_HOST_LEVEL);
}
/** \ingroup m_host_management
*
- * \brief Set the user data of a #m_host_t.
+ * \brief Set the user data of a #msg_host_t.
*
* This functions checks whether some data has already been associated to \a host
or not and attach \a data to \a host if it is possible.
*/
-MSG_error_t MSG_host_set_data(m_host_t host, void *data)
+MSG_error_t MSG_host_set_data(msg_host_t host, void *data)
{
SIMIX_host_set_data(host->smx_host,data);
/** \ingroup m_host_management
*
- * \brief Return the user data of a #m_host_t.
+ * \brief Return the user data of a #msg_host_t.
*
* This functions checks whether \a host is a valid pointer or not and return
the user data associated to \a host if it is possible.
*/
-void *MSG_host_get_data(m_host_t host)
+void *MSG_host_get_data(msg_host_t host)
{
return SIMIX_host_get_data(host->smx_host);
}
/** \ingroup m_host_management
*
- * \brief Return the name of the #m_host_t.
+ * \brief Return the name of the #msg_host_t.
*
* 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) {
+const char *MSG_host_get_name(msg_host_t host) {
return SIMIX_host_get_name(host->smx_host);
}
*
* \brief Return the location on which the current process is executed.
*/
-m_host_t MSG_host_self(void)
+msg_host_t MSG_host_self(void)
{
return MSG_process_get_host(NULL);
}
/*
* \brief Destroys a host (internal call only)
*/
-void __MSG_host_destroy(m_host_t host) {
+void __MSG_host_destroy(msg_host_t host) {
#ifdef MSG_USE_DEPRECATED
if (msg_global->max_channel > 0)
return xbt_lib_length(host_lib);
}
-m_host_t *MSG_get_host_table(void)
+msg_host_t *MSG_get_host_table(void)
{
void **array;
int i = 0;
array[i++] = data[MSG_HOST_LEVEL];
}
- return (m_host_t *)array;
+ return (msg_host_t *)array;
}
#endif
xbt_lib_cursor_t cursor;
char *key;
void **data;
- xbt_dynar_t res = xbt_dynar_new(sizeof(m_host_t),NULL);
+ xbt_dynar_t res = xbt_dynar_new(sizeof(msg_host_t),NULL);
xbt_lib_foreach(host_lib, cursor, key, data) {
if(routing_get_network_element_type(key) == SURF_NETWORK_ELEMENT_HOST)
/** \ingroup m_host_management
* \brief Return the number of MSG tasks currently running on a
- * #m_host_t. The external load is not taken in account.
+ * #msg_host_t. The external load is not taken in account.
*/
-int MSG_get_host_msgload(m_host_t h)
+int MSG_get_host_msgload(msg_host_t h)
{
xbt_assert((h != NULL), "Invalid parameters");
xbt_die( "Not implemented yet");
* \brief Return the speed of the processor (in flop/s), regardless of
the current load on the machine.
*/
-double MSG_get_host_speed(m_host_t h)
+double MSG_get_host_speed(msg_host_t h)
{
xbt_assert((h != NULL), "Invalid parameters");
* \param name a property name
* \return value of a property (or NULL if property not set)
*/
-const char *MSG_host_get_property_value(m_host_t host, const char *name)
+const char *MSG_host_get_property_value(msg_host_t host, const char *name)
{
return xbt_dict_get_or_null(MSG_host_get_properties(host), name);
}
* \param host a host
* \return a dict containing the properties
*/
-xbt_dict_t MSG_host_get_properties(m_host_t host)
+xbt_dict_t MSG_host_get_properties(msg_host_t host)
{
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
* \param value what to change the property to
* \param free_ctn the freeing function to use to kill the value on need
*/
-void MSG_host_set_property_value(m_host_t host, const char *name, char *value,void_f_pvoid_t free_ctn) {
+void MSG_host_set_property_value(msg_host_t host, const char *name, char *value,void_f_pvoid_t free_ctn) {
xbt_dict_set(MSG_host_get_properties(host), name, value,free_ctn);
}
* \param host host to test
* \return Returns 1 if host is available, 0 otherwise
*/
-int MSG_host_is_avail(m_host_t host)
+int MSG_host_is_avail(msg_host_t host)
{
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
return (simcall_host_get_state(host->smx_host));
int
MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox,
- m_host_t host)
+ msg_host_t host)
{
return simcall_rdv_comm_count_by_host(mailbox,
host->smx_host);
MSG_error_t
MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
- m_host_t host, double timeout)
+ msg_host_t host, double timeout)
{
xbt_ex_t e;
MSG_error_t ret = MSG_OK;
}
#ifdef MSG_USE_DEPRECATED
-msg_mailbox_t MSG_mailbox_get_by_channel(m_host_t host,
+msg_mailbox_t MSG_mailbox_get_by_channel(msg_host_t host,
m_channel_t channel)
{
XBT_WARN("DEPRECATED! Now use MSG_mailbox_get_by_alias");
*/
XBT_PUBLIC(int)
MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox,
- m_host_t host);
+ msg_host_t host);
#ifdef MSG_USE_DEPRECATED
/* \brief MSG_mailbox_get_by_channel - get a mailbox of the specified host from its channel.
*
*/
XBT_PUBLIC(msg_mailbox_t)
- MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
+ MSG_mailbox_get_by_channel(msg_host_t host, m_channel_t channel);
#endif
SG_END_DECL()
double computation_amount; /* Computation size */
msg_process_t sender;
msg_process_t receiver;
- m_host_t source;
+ msg_host_t source;
double priority;
double rate;
int isused; /* Indicates whether the task is used in SIMIX currently */
/******************************* Process *************************************/
typedef struct simdata_process {
- m_host_t m_host; /* the host on which the process is running */
+ msg_host_t m_host; /* the host on which the process is running */
int PID; /* used for debugging purposes */
int PPID; /* The parent PID */
- m_host_t put_host; /* used for debugging purposes */
+ msg_host_t put_host; /* used for debugging purposes */
#ifdef MSG_USE_DEPRECATED
m_channel_t put_channel; /* used for debugging purposes */
#endif
const char *name;
xbt_main_func_t code;
void *data;
- m_host_t m_host;
+ msg_host_t m_host;
int argc;
char **argv;
double kill_time;
s_xbt_swag_hookup_t host_vms_hookup;
xbt_dynar_t processes;
e_msg_vm_state_t state;
- m_host_t location;
+ msg_host_t location;
int coreAmount;
} s_msg_vm_t;
# define MSG_RETURN(val) return(val)
#endif
-m_host_t __MSG_host_create(smx_host_t workstation);
-void __MSG_host_destroy(m_host_t host);
+msg_host_t __MSG_host_create(smx_host_t workstation);
+void __MSG_host_destroy(msg_host_t host);
void __MSG_display_process_status(void);
const char *hostname, double kill_time, int argc, char **argv,
xbt_dict_t properties, int auto_restart)
{
- m_host_t host = MSG_get_host_by_name(hostname);
+ msg_host_t host = MSG_get_host_by_name(hostname);
msg_process_t p = MSG_process_create_with_environment(name, code, data,
host, argc, argv,
properties);
*/
msg_process_t MSG_process_create(const char *name,
xbt_main_func_t code, void *data,
- m_host_t host)
+ msg_host_t host)
{
return MSG_process_create_with_environment(name, code, data, host, -1,
NULL, NULL);
msg_process_t MSG_process_create_with_arguments(const char *name,
xbt_main_func_t code,
- void *data, m_host_t host,
+ void *data, msg_host_t host,
int argc, char **argv)
{
return MSG_process_create_with_environment(name, code, data, host,
*/
msg_process_t MSG_process_create_with_environment(const char *name,
xbt_main_func_t code,
- void *data, m_host_t host,
+ void *data, msg_host_t host,
int argc, char **argv,
xbt_dict_t properties)
{
* \brief Migrates a process to another location.
*
* This function checks whether \a process and \a host are valid pointers
- and change the value of the #m_host_t on which \a process is running.
+ and change the value of the #msg_host_t on which \a process is running.
*/
-MSG_error_t MSG_process_migrate(msg_process_t process, m_host_t host)
+MSG_error_t MSG_process_migrate(msg_process_t process, msg_host_t host)
{
simdata_process_t simdata = simcall_process_get_data(process);
simdata->m_host = host;
#ifdef HAVE_TRACING
- m_host_t now = simdata->m_host;
+ msg_host_t now = simdata->m_host;
TRACE_msg_process_change_host(process, now, host);
#endif
simcall_process_change_host(process, host->smx_host);
/** \ingroup m_process_management
* \brief Return the location on which a process is running.
* \param process a process (NULL means the current one)
- * \return the m_host_t corresponding to the location on which \a
+ * \return the msg_host_t corresponding to the location on which \a
* process is running.
*/
-m_host_t MSG_process_get_host(msg_process_t process)
+msg_host_t MSG_process_get_host(msg_process_t process)
{
simdata_process_t simdata;
if (process == NULL) {
* \param name a name for the object. It is for user-level information
and can be NULL.
* \param host_nb the number of hosts implied in the parallel task.
- * \param host_list an array of \p host_nb m_host_t.
+ * \param host_list an array of \p host_nb msg_host_t.
* \param computation_amount an array of \p host_nb
doubles. computation_amount[i] is the total number of operations
that have to be performed on host_list[i].
*/
m_task_t
MSG_parallel_task_create(const char *name, int host_nb,
- const m_host_t * host_list,
+ const msg_host_t * host_list,
double *computation_amount,
double *communication_amount, void *data)
{
/** \ingroup m_task_management
* \brief Return the source of a #m_task_t.
*
- * This functions returns the #m_host_t from which this task was sent
+ * This functions returns the #msg_host_t from which this task was sent
*/
-m_host_t MSG_task_get_source(m_task_t task)
+msg_host_t MSG_task_get_source(m_task_t task)
{
xbt_assert(task, "Invalid parameters");
return ((simdata_task_t) task->simdata)->source;
* to add extra constraints on the execution, but the argument is ignored for now.
*/
-msg_vm_t MSG_vm_start(m_host_t location, int coreAmount) {
+msg_vm_t MSG_vm_start(msg_host_t location, int coreAmount) {
msg_vm_t res = xbt_new0(s_msg_vm_t,1);
res->all_vms_hookup.prev = NULL;
res->host_vms_hookup.prev = NULL;
* MSG_task_send() before or after, depending on whether you want to do cold or hot
* migration.
*/
-void MSG_vm_migrate(msg_vm_t vm, m_host_t destination) {
+void MSG_vm_migrate(msg_vm_t vm, msg_host_t destination) {
unsigned int cpt;
msg_process_t process;
xbt_dynar_foreach(vm->processes,cpt,process) {
{
int res;
xbt_dynar_t all_hosts;
- m_host_t first_host;
+ msg_host_t first_host;
MSG_init(&argc, argv);
MSG_create_environment(argv[1]);
MSG_function_register("host", host);
all_hosts = MSG_hosts_as_dynar();
- first_host = xbt_dynar_pop_as(all_hosts,m_host_t);
+ first_host = xbt_dynar_pop_as(all_hosts,msg_host_t);
MSG_process_create( "host", host, NULL, first_host);
xbt_dynar_free(&all_hosts);