#include "xbt/sysdep.h"
#include "xbt/log.h"
#include "simgrid/simix.h"
+#include "simgrid/Host.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg);
*/
msg_host_t MSG_host_by_name(const char *name)
{
- return (msg_host_t) xbt_lib_get_elm_or_null(host_lib,name);
+ return simgrid::Host::by_name_or_null(name);
}
/** \ingroup m_host_management
*/
int MSG_get_host_number(void)
{
- return xbt_lib_length(host_lib);
+ return xbt_dict_length(host_list);
}
#ifdef MSG_USE_DEPRECATED
msg_host_t *MSG_get_host_table(void)
{
- void **array;
- int i = 0;
- xbt_lib_cursor_t cursor;
- char *key;
- void **data;
+ if (xbt_dict_is_empty(host_list))
+ return nullptr;
- if (xbt_lib_length(host_lib) == 0)
- return NULL;
- else
- array = xbt_new0(void *, xbt_lib_length(host_lib));
+ void **array = xbt_new0(void *, xbt_dict_length(host_list));
- xbt_lib_foreach(host_lib, cursor, key, data) {
+ xbt_lib_cursor_t cursor;
+ const char *id;
+ simgrid::Host* host;
+ xbt_dict_foreach(host_list, cursor, id, host)
if(routing_get_network_element_type(key) == SURF_NETWORK_ELEMENT_HOST)
- array[i++] = data[MSG_HOST_LEVEL];
- }
+ array[i++] = host->facet(MSG_HOST_LEVEL);
return (msg_host_t *)array;
}
return sg_hosts_as_dynar();
}
-/** \ingroup m_host_management
- * \brief Return the number of MSG tasks currently running on a
- * #msg_host_t. The external load is not taken in account.
- */
-int MSG_get_host_msgload(msg_host_t h)
-{
- xbt_assert((h != NULL), "Invalid parameters");
- xbt_die( "Not implemented yet");
-
- return (0);
-}
-
/** \ingroup m_host_management
* \brief Return the speed of the processor (in flop/s), regardless of
the current load on the machine.