Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move last functions in msg_host.cpp to the S4U C interface
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 20 Mar 2018 10:05:31 +0000 (11:05 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 20 Mar 2018 10:38:24 +0000 (11:38 +0100)
include/simgrid/host.h
include/simgrid/msg.h
src/msg/msg_host.cpp [deleted file]
src/simgrid/host.cpp
tools/cmake/DefinePackages.cmake

index 2350923..4c3ad83 100644 (file)
@@ -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_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);
 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 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_ */
 SG_END_DECL()
 
 #endif /* SIMGRID_HOST_H_ */
index c34a9f6..8744e26 100644 (file)
@@ -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 ***********************************/
 #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_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 *********************************/
 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 (file)
index 784265c..0000000
+++ /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 <em>location</em> (or <em>host</em>) is any possible place where  a process may run. Thus it may be represented
- *  as a <em>physical resource with computing capabilities</em>, some <em>mailboxes</em> to enable running process to
- *  communicate with remote ones, and some <em>private data</em> 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<simgrid::simix::Host>()->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);
-}
-
-}
index 0c38c67..9e24002 100644 (file)
@@ -129,6 +129,17 @@ double sg_host_speed(sg_host_t host)
   return host->getSpeed();
 }
 
   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.
  *
 /** \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<simgrid::simix::Host>()->process_list) {
+    s4u_Actor* p = actor.ciface();
+    xbt_dynar_push(whereto, &p);
+  }
+}
+
 } // extern "C"
 } // extern "C"
index 27d753e..0f7325b 100644 (file)
@@ -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_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
   src/msg/msg_mailbox.cpp
   src/msg/msg_process.cpp
   src/msg/msg_synchro.cpp