2 #include "xbt/sysdep.h"
5 /** \defgroup m_host_management Management functions of Hosts
6 * \brief This section describes the host structure of MSG
8 * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Hosts" --> \endhtmlonly
9 * (#m_host_t) and the functions for managing it.
11 * A <em>location</em> (or <em>host</em>) is any possible place where
12 * a process may run. Thus it may be represented as a
13 * <em>physical resource with computing capabilities</em>, some
14 * <em>mailboxes</em> to enable running process to communicate with
15 * remote ones, and some <em>private data</em> that can be only
16 * accessed by local process.
20 /********************************* Host **************************************/
21 m_host_t __MSG_host_create(const char *name,
25 m_host_t host = xbt_new0(s_m_host_t,1);
30 /** \ingroup m_host_management
32 * \brief Set the user data of a #m_host_t.
34 * This functions checks whether some data has already been associated to \a host
35 or not and attach \a data to \a host if it is possible.
37 MSG_error_t MSG_host_set_data(m_host_t host, void *data)
39 xbt_assert0((host!=NULL), "Invalid parameters");
40 xbt_assert0((host->data == NULL), "Data already set");
48 /** \ingroup m_host_management
50 * \brief Return the user data of a #m_host_t.
52 * This functions checks whether \a host is a valid pointer or not and return
53 the user data associated to \a host if it is possible.
55 void *MSG_host_get_data(m_host_t host)
58 xbt_assert0((host != NULL), "Invalid parameters");
64 /** \ingroup m_host_management
66 * \brief Return the name of the #m_host_t.
68 * This functions checks whether \a host is a valid pointer or not and return
71 const char *MSG_host_get_name(m_host_t host)
74 xbt_assert0((host != NULL) && (host->simdata != NULL), "Invalid parameters");
80 /** \ingroup m_host_management
82 * \brief Return the location on which the current process is executed.
84 m_host_t MSG_host_self(void)
86 return MSG_process_get_host(MSG_process_self());
90 * Real function for destroy a host.
91 * MSG_host_destroy is just a front_end that also removes it from
94 void __MSG_host_destroy(m_host_t host)
99 /** \ingroup m_host_management
100 * \brief Return the current number of #m_host_t.
102 int MSG_get_host_number(void)
104 return (xbt_fifo_size(msg_global->host));
107 /** \ingroup m_host_management
108 * \brief Return a array of all the #m_host_t.
110 m_host_t *MSG_get_host_table(void)
112 return ((m_host_t *)xbt_fifo_to_array(msg_global->host));
115 /** \ingroup m_host_management
116 * \brief Return the number of MSG tasks currently running on a
117 * #m_host_t. The external load is not taken in account.
119 int MSG_get_host_msgload(m_host_t h)
121 xbt_assert0((h!= NULL), "Invalid parameters");
122 xbt_assert0(0, "Not implemented yet");
125 /* return(surf_workstation_resource->extension_public->get_load(h->simdata->host)); */
128 /** \ingroup m_host_management
129 * \brief Return the speed of the processor (in flop/s), regardless of
130 the current load on the machine.
132 double MSG_get_host_speed(m_host_t h)
137 /** \ingroup msg_gos_functions
138 * \brief Determine if a host is available.
140 * \param h host to test
142 int MSG_host_is_avail (m_host_t h)