#define MSG_host_by_name(name) sg_host_by_name(name)
#define MSG_get_host_by_name(n) sg_host_by_name(n) /* Rewrite the old name into the new one transparently */
+/** \ingroup m_host_management
+ *
+ * \brief Return the name of the #msg_host_t. */
XBT_PUBLIC(const char*) sg_host_get_name(sg_host_t host);
+#define MSG_host_get_name(host) sg_host_get_name(host)
// ========== User Data ==============
+/** \ingroup m_host_management
+ *
+ * \brief Return the user data of a #msg_host_t.
+ *
+ * This functions returns the user data associated to \a host if it is possible.
+ */
XBT_PUBLIC(void*) sg_host_user(sg_host_t host);
+#define MSG_host_get_data(host) sg_host_user(host)
+/** \ingroup m_host_management
+ *
+ * \brief Set the user data of a #msg_host_t.
+ *
+ * This functions attach \a data to \a host if it is possible.
+ */
XBT_PUBLIC(void) sg_host_user_set(sg_host_t host, void* userdata);
+#define MSG_host_set_data(host, data) sg_host_user_set(host, data)
XBT_PUBLIC(void) sg_host_user_destroy(sg_host_t host);
// ========= storage related functions ============
#define MSG_host_get_speed(host) sg_host_speed(host)
XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host);
+XBT_PUBLIC(int) sg_host_core_count(sg_host_t host);
+#define MSG_host_get_core_number(host) sg_host_core_count(host)
+
/** \ingroup m_process_management
* \brief Return the location on which a process is running.
* \param process a process (nullptr means the current one)
XBT_PUBLIC(void) sg_host_set_pstate(sg_host_t host,int pstate);
#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate) /* (same here) */
+XBT_PUBLIC(void) sg_host_turn_on(sg_host_t host);
+#define MSG_host_on(h) sg_host_turn_on(h)
+XBT_PUBLIC(void) sg_host_turn_off(sg_host_t host);
+#define MSG_host_off(h) sg_host_turn_off(h)
+XBT_PUBLIC(int) sg_host_is_on(sg_host_t host);
+#define MSG_host_is_on(h) sg_host_is_on(h)
+XBT_PUBLIC(int) sg_host_is_off(sg_host_t host);
+#define MSG_host_is_off(h) sg_host_is_off(h)
+
/** \ingroup m_host_management
* \brief Returns a xbt_dict_t consisting of the list of properties assigned to this host
*
XBT_PUBLIC(sg_size_t) MSG_storage_write(msg_storage_t storage, sg_size_t size);
/************************** Host handling ***********************************/
-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);
-/** \ingroup m_host_management
- *
- * \brief Return the name of the #msg_host_t. */
-#define MSG_host_get_name(host) sg_host_get_name(host)
-XBT_PUBLIC(void) MSG_host_on(msg_host_t host);
-XBT_PUBLIC(void) MSG_host_off(msg_host_t host);
-XBT_PUBLIC(int) MSG_host_get_core_number(msg_host_t h);
XBT_PUBLIC(void) MSG_host_get_process_list(msg_host_t h, xbt_dynar_t whereto);
-XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h);
-XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h);
XBT_ATTRIB_DEPRECATED_v320("Use MSG_host_get_speed(): v3.20 will drop MSG_host_get_current_power_peak() "
"completely.") static inline double MSG_host_get_current_power_peak(msg_host_t host)
*/
/********************************* Host **************************************/
-/** \ingroup m_host_management
- *
- * \brief Set the user data of a #msg_host_t.
- *
- * This functions attach \a data to \a host if it is possible.
- */
-msg_error_t MSG_host_set_data(msg_host_t host, void *data) {
- sg_host_user_set(host, data);
- return MSG_OK;
-}
-
-/** \ingroup m_host_management
- *
- * \brief Return the user data of a #msg_host_t.
- *
- * This functions returns the user data associated to \a host if it is possible.
- */
-void *MSG_host_get_data(msg_host_t host) {
- return sg_host_user(host);
-}
-
-/** \ingroup m_host_management
- *
- * \brief Start the host if it is off
- *
- * See also #MSG_host_is_on() and #MSG_host_is_off() to test the current state of the host and @ref plugin_energy
- * for more info on DVFS.
- */
-void MSG_host_on(msg_host_t host)
-{
- host->turnOn();
-}
-
-/** \ingroup m_host_management
- *
- * \brief Stop the host if it is on
- *
- * See also #MSG_host_is_on() and #MSG_host_is_off() to test the current state of the host and @ref plugin_energy
- * for more info on DVFS.
- */
-void MSG_host_off(msg_host_t host)
-{
- host->turnOff();
-}
-
-
-/** \ingroup m_host_management
- * \brief Return the number of cores.
- *
- * \param host a host
- * \return the number of cores
- */
-int MSG_host_get_core_number(msg_host_t host) {
- return host->getCoreCount();
-}
/** \ingroup m_host_management
* \brief Return the list of processes attached to an host.
}
}
-/** @ingroup m_host_management
- * @brief Determine if a host is up and running.
- *
- * See also #MSG_host_on() and #MSG_host_off() to switch the host ON and OFF and @ref plugin_energy for more info on
- * DVFS.
- *
- * @param host host to test
- * @return Returns true if the host is up and running, and false if it's currently down
- */
-int MSG_host_is_on(msg_host_t host)
-{
- return host->isOn();
-}
-
-/** @ingroup m_host_management
- * @brief Determine if a host is currently off.
- *
- * See also #MSG_host_on() and #MSG_host_off() to switch the host ON and OFF and @ref plugin_energy for more info on
- * DVFS.
- */
-int MSG_host_is_off(msg_host_t host)
-{
- return host->isOff();
-}
-
/** \ingroup m_host_management
* \brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy.
*
return host->getPstateSpeed(pstate_index);
}
-
-
}
return host->getSpeed();
}
+/** \ingroup m_host_management
+ * \brief Return the number of cores.
+ *
+ * \param host a host
+ * \return the number of cores
+ */
+int sg_host_core_count(sg_host_t host)
+{
+ return host->getCoreCount();
+}
+
double sg_host_get_available_speed(sg_host_t host)
{
return host->pimpl_cpu->getAvailableSpeed();
host->setPstate(pstate);
}
+/** \ingroup m_host_management
+ *
+ * \brief Start the host if it is off
+ *
+ * See also #sg_host_is_on() and #sg_host_is_off() to test the current state of the host and @ref plugin_energy
+ * for more info on DVFS.
+ */
+void sg_host_turn_on(sg_host_t host)
+{
+ host->turnOn();
+}
+
+/** \ingroup m_host_management
+ *
+ * \brief Stop the host if it is on
+ *
+ * See also #MSG_host_is_on() and #MSG_host_is_off() to test the current state of the host and @ref plugin_energy
+ * for more info on DVFS.
+ */
+void sg_host_turn_off(sg_host_t host)
+{
+ host->turnOff();
+}
+
+/** @ingroup m_host_management
+ * @brief Determine if a host is up and running.
+ *
+ * See also #sg_host_turn_on() and #sg_host_turn_off() to switch the host ON and OFF and @ref plugin_energy for more
+ * info on DVFS.
+ *
+ * @param host host to test
+ * @return Returns true if the host is up and running, and false if it's currently down
+ */
+int sg_host_is_on(sg_host_t host)
+{
+ return host->isOn();
+}
+
+/** @ingroup m_host_management
+ * @brief Determine if a host is currently off.
+ *
+ * See also #sg_host_turn_on() and #sg_host_turn_off() to switch the host ON and OFF and @ref plugin_energy for more
+ * info on DVFS.
+ */
+int sg_host_is_off(sg_host_t host)
+{
+ return host->isOff();
+}
+
/** @brief Get the properties of an host */
xbt_dict_t sg_host_get_properties(sg_host_t host) {
xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
MSG_create_environment(argv[1]); /* - Load the platform description */
xbt_dynar_t hosts = MSG_hosts_as_dynar();
- XBT_INFO("Number of hosts '%lu'", MSG_get_host_number());
+ XBT_INFO("Number of hosts '%zu'", MSG_get_host_number());
unsigned int i;
msg_host_t h;
xbt_dynar_foreach (hosts, i,
MSG_create_environment(argv[1]);
- XBT_INFO("There are %lu hosts in the environment", MSG_get_host_number());
+ XBT_INFO("There are %zu hosts in the environment", MSG_get_host_number());
xbt_dynar_t hosts = MSG_hosts_as_dynar();
xbt_dynar_foreach (hosts, i, host) {