From: Frederic Suter Date: Tue, 20 Mar 2018 10:05:31 +0000 (+0100) Subject: Move last functions in msg_host.cpp to the S4U C interface X-Git-Tag: v3.19~14 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/220230a3d6da87b71f2e2d09ceaf166d75f3a6a8?hp=a24a7ff7e85c75bb850340c5a1230bfa951e97ae Move last functions in msg_host.cpp to the S4U C interface --- diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 2350923425..4c3ad8379a 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -93,6 +93,9 @@ XBT_PUBLIC xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host); */ XBT_PUBLIC double sg_host_speed(sg_host_t host); #define MSG_host_get_speed(host) sg_host_speed(host) +XBT_PUBLIC double sg_host_get_pstate_speed(sg_host_t host, int pstate_index); +#define MSG_host_get_power_peak_at(host, pstate_index) sg_host_get_pstate_speed(host, pstate_index) + XBT_PUBLIC double sg_host_get_available_speed(sg_host_t host); XBT_PUBLIC int sg_host_core_count(sg_host_t host); @@ -163,6 +166,9 @@ XBT_PUBLIC void sg_host_route(sg_host_t from, sg_host_t to, xbt_dynar_t links); XBT_PUBLIC double sg_host_route_latency(sg_host_t from, sg_host_t to); XBT_PUBLIC double sg_host_route_bandwidth(sg_host_t from, sg_host_t to); XBT_PUBLIC void sg_host_dump(sg_host_t ws); + +XBT_PUBLIC void sg_host_get_actor_list(sg_host_t host, xbt_dynar_t whereto); +#define MSG_host_get_process_list(host, whereto) sg_host_get_actor_list(host, whereto) SG_END_DECL() #endif /* SIMGRID_HOST_H_ */ diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index c34a9f617e..8744e26c9a 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -197,16 +197,12 @@ XBT_PUBLIC sg_size_t sg_storage_write(sg_storage_t storage, sg_size_t size); #define MSG_storage_write(storage, size) sg_storage_write(storage, size) /************************** Host handling ***********************************/ -XBT_PUBLIC void MSG_host_get_process_list(msg_host_t h, xbt_dynar_t whereto); - 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) { return MSG_host_get_speed(host); } -XBT_PUBLIC double MSG_host_get_power_peak_at(msg_host_t h, int pstate); - XBT_PUBLIC void MSG_create_environment(const char* file); /************************** Process handling *********************************/ diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp deleted file mode 100644 index 784265ce1a..0000000000 --- a/src/msg/msg_host.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "simgrid/s4u/Host.hpp" -#include "simgrid/s4u/Storage.hpp" -#include "src/msg/msg_private.hpp" -#include "src/simix/ActorImpl.hpp" -#include "src/simix/smx_host_private.hpp" - -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg); - -extern "C" { - -/** @addtogroup m_host_management - * (#msg_host_t) and the functions for managing it. - * - * A location (or host) is any possible place where a process may run. Thus it may be represented - * as a physical resource with computing capabilities, some mailboxes to enable running process to - * communicate with remote ones, and some private data that can be only accessed by local process. - * \see msg_host_t - */ - -/********************************* Host **************************************/ - -/** \ingroup m_host_management - * \brief Return the list of processes attached to an host. - * - * \param host a host - * \param whereto a dynar in which we should push processes living on that host - */ -void MSG_host_get_process_list(msg_host_t host, xbt_dynar_t whereto) -{ - xbt_assert((host != nullptr), "Invalid parameters"); - for (auto& actor : host->extension()->process_list) { - msg_process_t p = actor.ciface(); - xbt_dynar_push(whereto, &p); - } -} - -/** \ingroup m_host_management - * \brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy. - * - * \param host host to test - * \param pstate_index pstate to test - * \return Returns the processor speed associated with pstate_index - */ -double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) { - xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)"); - return host->getPstateSpeed(pstate_index); -} - -} diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 0c38c678c0..9e24002bf7 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -129,6 +129,17 @@ double sg_host_speed(sg_host_t host) return host->getSpeed(); } +/** \brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy. + * + * \param host host to test + * \param pstate_index pstate to test + * \return Returns the processor speed associated with pstate_index + */ +double sg_host_get_pstate_speed(sg_host_t host, int pstate_index) +{ + return host->getPstateSpeed(pstate_index); +} + /** \ingroup m_host_management * \brief Return the number of cores. * @@ -309,4 +320,17 @@ void sg_host_dump(sg_host_t host) } } +/** \brief Return the list of actors attached to an host. + * + * \param host a host + * \param whereto a dynar in which we should push actors living on that host + */ +void sg_host_get_actor_list(sg_host_t host, xbt_dynar_t whereto) +{ + for (auto& actor : host->extension()->process_list) { + s4u_Actor* p = actor.ciface(); + xbt_dynar_push(whereto, &p); + } +} + } // extern "C" diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 27d753edb2..0f7325bf5c 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -446,7 +446,6 @@ set(MSG_SRC src/msg/msg_environment.cpp src/msg/msg_global.cpp src/msg/msg_gos.cpp - src/msg/msg_host.cpp src/msg/msg_mailbox.cpp src/msg/msg_process.cpp src/msg/msg_synchro.cpp