X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7ef49c428ab0209965a09a36ab28b59789aaa4b5..04d3d36e9e87d194bee4f88859f96d66975cce31:/src/msg/msg_host.cpp diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index 285d76a06e..5db2de1d5c 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -5,18 +5,13 @@ #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/Storage.hpp" -#include "src/msg/msg_private.h" +#include "src/msg/msg_private.hpp" #include "src/simix/ActorImpl.hpp" -#include "src/simix/smx_host_private.h" - +#include "src/simix/smx_host_private.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg); -simgrid::xbt::Extension simgrid::MsgHostExt::EXTENSION_ID; - -SG_BEGIN_DECL() - -int sg_storage_max_file_descriptors = 1024; +extern "C" { /** @addtogroup m_host_management * (#msg_host_t) and the functions for managing it. @@ -118,15 +113,6 @@ double MSG_host_get_speed(msg_host_t host) { return host->getSpeed(); } -/** \ingroup m_host_management - * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine. - * Deprecated: use MSG_host_get_speed - */ -double MSG_get_host_speed(msg_host_t host) { - XBT_WARN("MSG_get_host_speed is deprecated: use MSG_host_get_speed"); - return MSG_host_get_speed(host); -} - /** \ingroup m_host_management * \brief Return the number of cores. * @@ -162,7 +148,7 @@ void MSG_host_get_process_list(msg_host_t host, xbt_dynar_t whereto) */ const char *MSG_host_get_property_value(msg_host_t host, const char *name) { - return static_cast(xbt_dict_get_or_null(MSG_host_get_properties(host), name)); + return host->getProperty(name); } /** \ingroup m_host_management @@ -174,7 +160,14 @@ const char *MSG_host_get_property_value(msg_host_t host, const char *name) xbt_dict_t MSG_host_get_properties(msg_host_t host) { xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)"); - return host->getProperties(); + xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f); + std::map* props = host->getProperties(); + if (props == nullptr) + return nullptr; + for (auto const& elm : *props) { + xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr); + } + return as_dict; } /** \ingroup m_host_management @@ -186,7 +179,7 @@ xbt_dict_t MSG_host_get_properties(msg_host_t host) */ void MSG_host_set_property_value(msg_host_t host, const char* name, char* value) { - xbt_dict_set(MSG_host_get_properties(host), name, value, nullptr); + host->setProperty(name, value); } /** @ingroup m_host_management @@ -255,19 +248,4 @@ xbt_dynar_t MSG_host_get_attached_storage_list(msg_host_t host) return sg_host_get_attached_storage_list(host); } -/** \ingroup m_host_management - * \brief Return the content of mounted storages on an host. - * \param host a host - * \return a dict containing content (as a dict) of all storages mounted on the host - */ -xbt_dict_t MSG_host_get_storage_content(msg_host_t host) -{ - xbt_assert((host != nullptr), "Invalid parameters"); - xbt_dict_t contents = xbt_dict_new_homogeneous(nullptr); - for (auto elm : host->getMountedStorages()) - xbt_dict_set(contents, elm.first.c_str(), MSG_storage_get_content(elm.second), nullptr); - - return contents; } - -SG_END_DECL()