Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge simgrid::Host into simgrid::s4u::Host
authorGabriel Corona <gabriel.corona@loria.fr>
Wed, 13 Jan 2016 13:43:24 +0000 (14:43 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Wed, 13 Jan 2016 16:17:13 +0000 (17:17 +0100)
42 files changed:
examples/s4u/io/s4u_io_test.cpp
include/simgrid/Host.hpp [deleted file]
include/simgrid/forward.h
include/simgrid/host.h
include/simgrid/s4u/host.hpp
src/bindings/java/jmsg.cpp
src/mc/mc_smx.cpp
src/msg/msg_global.cpp
src/msg/msg_host.cpp
src/msg/msg_vm.cpp
src/s4u/s4u_actor.cpp
src/s4u/s4u_file.cpp
src/s4u/s4u_host.cpp
src/simdag/sd_workstation.cpp
src/simgrid/host.cpp
src/simix/smx_global.cpp
src/simix/smx_host.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_cas01.hpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/host_interface.cpp
src/surf/host_interface.hpp
src/surf/host_ptask_L07.cpp
src/surf/host_ptask_L07.hpp
src/surf/network_constant.cpp
src/surf/network_ib.cpp
src/surf/network_ns3.cpp
src/surf/ns3/ns3_interface.h
src/surf/plugins/energy.cpp
src/surf/plugins/energy.hpp
src/surf/sg_platf.cpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/surf_routing.cpp
src/surf/surf_routing_vivaldi.cpp
src/surf/virtual_machine.cpp
src/surf/virtual_machine.hpp
src/surf/vm_hl13.cpp
tools/cmake/DefinePackages.cmake

index eee4303..846ac4c 100644 (file)
@@ -17,7 +17,8 @@ public:
 : simgrid::s4u::Actor(procname,host,argc,argv){}
 
        void show_info(boost::unordered_map <std::string, simgrid::s4u::Storage &> &mounts) {
 : simgrid::s4u::Actor(procname,host,argc,argv){}
 
        void show_info(boost::unordered_map <std::string, simgrid::s4u::Storage &> &mounts) {
-               XBT_INFO("Storage info on %s:", simgrid::s4u::Host::current()->name());
+               XBT_INFO("Storage info on %s:",
+                       simgrid::s4u::Host::current()->name().c_str());
 
                for (const auto&kv : mounts) {
                        const char* mountpoint = kv.first.c_str();
 
                for (const auto&kv : mounts) {
                        const char* mountpoint = kv.first.c_str();
diff --git a/include/simgrid/Host.hpp b/include/simgrid/Host.hpp
deleted file mode 100644 (file)
index 50e1fa1..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (c) 2015. 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. */
-
-#ifndef SIMGRID_HOST_HPP
-#define SIMGRID_HOST_HPP
-
-#include <cstddef>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <xbt/base.h>
-#include <xbt/dict.h>
-#include <xbt/swag.h>
-#include <xbt/string.hpp>
-#include <xbt/signal.hpp>
-#include <xbt/Extendable.hpp>
-
-#include <simgrid/datatypes.h>
-
-namespace simgrid {
-
-XBT_PUBLIC_CLASS Host :
-public simgrid::xbt::Extendable<Host> {
-
-public:
-       double getSpeed();
-       int getCoreAmount();
-
-       /* FIXME: these should be protected, but it leads to many errors */
-       surf::Cpu     *pimpl_cpu = nullptr;
-       surf::NetCard *pimpl_netcard = nullptr;
-private:
-  simgrid::xbt::string name_ = "noname";
-public:
-  Host(std::string const& name);
-  ~Host();
-  simgrid::xbt::string const& getName() const { return name_; }
-  void turnOn();
-  void turnOff();
-  bool isOn();
-  bool isOff();
-  xbt_dict_t getProperties();
-  xbt_swag_t getProcessList();
-  double getCurrentPowerPeak();
-  double getPowerPeakAt(int pstate_index);
-  void setPState(int pstate_index);
-  int getPState();
-  void getParams(vm_params_t params);
-  void setParams(vm_params_t params);
-  xbt_dict_t getMountedStorageList();
-  xbt_dynar_t getAttachedStorageList();
-
-  static Host* by_name_or_null(const char* name);
-  static Host* by_name_or_create(const char* name);
-
-  /*** Called on each newly created object */
-  static simgrid::xbt::signal<void(Host&)> onCreation;
-  /*** Called just before destructing an object */
-  static simgrid::xbt::signal<void(Host&)> onDestruction;
-  /*** Called when the machine is turned on or off */
-  static simgrid::xbt::signal<void(Host&)> onStateChange;
-};
-
-}
-
-#endif
index 2961972..5f77905 100644 (file)
 #ifdef __cplusplus
 
 namespace simgrid {
 #ifdef __cplusplus
 
 namespace simgrid {
-class Host;
+  namespace s4u {
+    class Host;
+  }
+  namespace surf {
+    class Cpu;
+    class NetCard;
+    class As;
+    class Link;
+  }
 }
 
 namespace simgrid {
 }
 
 namespace simgrid {
-namespace surf {
 
 
-class Cpu;
-class NetCard;
-class As;
-class Link;
-
-}
 }
 
 }
 
-typedef simgrid::Host simgrid_Host;
+typedef simgrid::s4u::Host simgrid_Host;
 typedef simgrid::surf::Cpu surf_Cpu;
 typedef simgrid::surf::NetCard surf_NetCard;
 typedef simgrid::surf::As surf_As;
 typedef simgrid::surf::Cpu surf_Cpu;
 typedef simgrid::surf::NetCard surf_NetCard;
 typedef simgrid::surf::As surf_As;
index 3de3905..282fa76 100644 (file)
@@ -15,7 +15,7 @@
 #include <simgrid/forward.h>
 
 #ifdef __cplusplus
 #include <simgrid/forward.h>
 
 #ifdef __cplusplus
-#include <simgrid/Host.hpp>
+#include <simgrid/s4u/host.hpp>
 #endif
 
 SG_BEGIN_DECL()
 #endif
 
 SG_BEGIN_DECL()
index 8eab63d..0de509f 100644 (file)
@@ -9,8 +9,13 @@
 #include <boost/unordered_map.hpp>
 #include <vector>
 
 #include <boost/unordered_map.hpp>
 #include <vector>
 
-#include "xbt/base.h"
-#include "simgrid/simix.h"
+#include <xbt/base.h>
+#include <xbt/string.hpp>
+#include <xbt/signal.hpp>
+#include <xbt/Extendable.hpp>
+
+#include <simgrid/simix.h>
+#include <simgrid/datatypes.h>
 
 namespace simgrid {
 namespace s4u {
 
 namespace simgrid {
 namespace s4u {
@@ -30,12 +35,14 @@ class File;
  * You can retrieve a particular host using @link{simgrid::s4u::Host.byName()},
  * and actors can retrieve the host on which they run using @link{simgrid::s4u::Host.current()}.
  */
  * You can retrieve a particular host using @link{simgrid::s4u::Host.byName()},
  * and actors can retrieve the host on which they run using @link{simgrid::s4u::Host.current()}.
  */
-XBT_PUBLIC_CLASS Host {
-       friend Actor;
-       friend File;
+XBT_PUBLIC_CLASS Host :
+  public simgrid::xbt::Extendable<Host> {
+
+       // friend Actor;
+       // friend File;
 private:
        Host(const char *name);
 private:
        Host(const char *name);
-protected:
+public: // TODO, make me private
        ~Host();
 public:
        /** Retrieves an host from its name. */
        ~Host();
 public:
        /** Retrieves an host from its name. */
@@ -43,7 +50,10 @@ public:
        /** Retrieves the host on which the current actor is running */
        static s4u::Host *current();
 
        /** Retrieves the host on which the current actor is running */
        static s4u::Host *current();
 
-       const char* name();
+  static Host* by_name_or_null(const char* name);
+  static Host* by_name_or_create(const char* name);
+
+       simgrid::xbt::string const& name() const { return name_; }
 
        /** Turns that host on if it was previously off
         *
 
        /** Turns that host on if it was previously off
         *
@@ -55,9 +65,24 @@ public:
        void turnOff();
        /** Returns if that host is currently up and running */
        bool isOn();
        void turnOff();
        /** Returns if that host is currently up and running */
        bool isOn();
-
+       bool isOff() { return !isOn(); }
+
+       double getSpeed();
+       int getCoreAmount();
+  xbt_dict_t getProperties();
+  xbt_swag_t getProcessList();
+  double getCurrentPowerPeak();
+  double getPowerPeakAt(int pstate_index);
+  void setPState(int pstate_index);
+       int getNbPStates() const;
+  int getPState();
+  void getParams(vm_params_t params);
+  void setParams(vm_params_t params);
+  xbt_dict_t getMountedStorageList();
+  xbt_dynar_t getAttachedStorageList();
 
        /** Allows to store user data on that host */
 
        /** Allows to store user data on that host */
+       // TODO, use the extension stuff instead
        void set_userdata(void *data) {p_userdata = data;}
        /** Retrieves the previously stored data */
        void* userdata() {return p_userdata;}
        void set_userdata(void *data) {p_userdata = data;}
        /** Retrieves the previously stored data */
        void* userdata() {return p_userdata;}
@@ -68,20 +93,39 @@ public:
         *
         *      Do not change the returned value in any way.
         */
         *
         *      Do not change the returned value in any way.
         */
+       // TODO, do not use Storage&, this looks dangerous!
        boost::unordered_map<std::string, Storage&> &mountedStorages();
        boost::unordered_map<std::string, Storage&> &mountedStorages();
+
 private:
 private:
+       simgrid::xbt::string name_ = "noname";
        boost::unordered_map<std::string, Storage&> *mounts = NULL; // caching
        boost::unordered_map<std::string, Storage&> *mounts = NULL; // caching
+       void* p_userdata = NULL;
 
 
-protected:
-       sg_host_t inferior() {return p_inferior;}
-private:
-       void*p_userdata=NULL;
-       sg_host_t p_inferior;
+public:
+       // FIXME: these should be protected, but it leads to many errors
+       // Use the extensions stuff for this? Go through simgrid::surf::Host?
+       surf::Cpu     *pimpl_cpu = nullptr;
+       surf::NetCard *pimpl_netcard = nullptr;
+
+public:
        static boost::unordered_map<std::string, s4u::Host *> *hosts;
        static boost::unordered_map<std::string, s4u::Host *> *hosts;
+
+       /*** Called on each newly created object */
+       static simgrid::xbt::signal<void(Host&)> onCreation;
+       /*** Called just before destructing an object */
+       static simgrid::xbt::signal<void(Host&)> onDestruction;
+       /*** Called when the machine is turned on or off */
+       static simgrid::xbt::signal<void(Host&)> onStateChange;
 };
 
 }} // namespace simgrid::s4u
 
 };
 
 }} // namespace simgrid::s4u
 
+extern int MSG_HOST_LEVEL;
+extern int SD_HOST_LEVEL;
+extern int SIMIX_HOST_LEVEL;
+extern int ROUTING_HOST_LEVEL;
+extern int USER_HOST_LEVEL;
+
 #endif /* SIMGRID_S4U_HOST_HPP */
 
 #if 0
 #endif /* SIMGRID_S4U_HOST_HPP */
 
 #if 0
index 1b700b7..a3479b3 100644 (file)
@@ -134,7 +134,7 @@ Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs)
 
   MSG_init(&argc, argv);
 
 
   MSG_init(&argc, argv);
 
-  JAVA_HOST_LEVEL = simgrid::Host::extension_create(__JAVA_host_priv_free);
+  JAVA_HOST_LEVEL = simgrid::s4u::Host::extension_create(__JAVA_host_priv_free);
   JAVA_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, __JAVA_storage_priv_free);
 
   for (index = 0; index < argc; index++)
   JAVA_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, __JAVA_storage_priv_free);
 
   for (index = 0; index < argc; index++)
index 325ea15..0343dae 100644 (file)
@@ -180,7 +180,7 @@ const char* MC_smx_process_get_host_name(smx_process_t p)
 
   simgrid::mc::Process* process = &mc_model_checker->process();
 
 
   simgrid::mc::Process* process = &mc_model_checker->process();
 
-  /* Horrible hack to find the offset of the id in the simgrid::Host.
+  /* Horrible hack to find the offset of the id in the simgrid::s4u::Host.
 
      Offsetof is not supported for non-POD types but this should
      work in pratice for the targets currently supported by the MC
 
      Offsetof is not supported for non-POD types but this should
      work in pratice for the targets currently supported by the MC
@@ -188,10 +188,10 @@ const char* MC_smx_process_get_host_name(smx_process_t p)
      (such as virtual base).
 
      We are using a (C++11) unrestricted union in order to avoid
      (such as virtual base).
 
      We are using a (C++11) unrestricted union in order to avoid
-     any construction/destruction of the simgrid::Host.
+     any construction/destruction of the simgrid::s4u::Host.
   */
   union fake_host {
   */
   union fake_host {
-    simgrid::Host host;
+    simgrid::s4u::Host host;
     fake_host() {}
     ~fake_host() {}
   };
     fake_host() {}
     ~fake_host() {}
   };
index 922fb42..a025930 100644 (file)
@@ -68,7 +68,7 @@ void MSG_init_nocheck(int *argc, char **argv) {
     SIMIX_function_register_process_cleanup(MSG_process_cleanup_from_SIMIX);
 
     sg_platf_postparse_add_cb(MSG_post_create_environment);
     SIMIX_function_register_process_cleanup(MSG_process_cleanup_from_SIMIX);
 
     sg_platf_postparse_add_cb(MSG_post_create_environment);
-    simgrid::Host::onCreation.connect([](simgrid::Host& host) {
+    simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) {
       MSG_host_create_(&host);
     });
   }
       MSG_host_create_(&host);
     });
   }
index 8bf4125..1402539 100644 (file)
@@ -9,7 +9,7 @@
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "simgrid/simix.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "simgrid/simix.h"
-#include "simgrid/Host.hpp"
+#include <simgrid/s4u/host.hpp>
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg);
 
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg);
 
@@ -73,7 +73,7 @@ msg_host_t __MSG_host_create(sg_host_t host) // FIXME: don't return our paramete
  */
 msg_host_t MSG_host_by_name(const char *name)
 {
  */
 msg_host_t MSG_host_by_name(const char *name)
 {
-  return simgrid::Host::by_name_or_null(name);
+  return simgrid::s4u::Host::by_name_or_null(name);
 }
 
 /** \ingroup m_host_management
 }
 
 /** \ingroup m_host_management
@@ -181,7 +181,7 @@ msg_host_t *MSG_get_host_table(void)
 
     xbt_lib_cursor_t cursor;
     const char *id;
 
     xbt_lib_cursor_t cursor;
     const char *id;
-    simgrid::Host* host;
+    simgrid::s4u::Host* host;
     xbt_dict_foreach(host_list, cursor, id, host)
       if(routing_get_network_element_type(key) == SURF_NETWORK_ELEMENT_HOST)
         array[i++] = host->facet(MSG_HOST_LEVEL);
     xbt_dict_foreach(host_list, cursor, id, host)
       if(routing_get_network_element_type(key) == SURF_NETWORK_ELEMENT_HOST)
         array[i++] = host->facet(MSG_HOST_LEVEL);
index 905f3a9..6510b2a 100644 (file)
@@ -209,8 +209,8 @@ msg_vm_t MSG_vm_create_core(msg_host_t ind_pm, const char *name)
 {
   /* make sure the VM of the same name does not exit */
   {
 {
   /* make sure the VM of the same name does not exit */
   {
-    simgrid::Host* ind_host_tmp =
-      (simgrid::Host*) xbt_dict_get_or_null(host_list, name);
+    simgrid::s4u::Host* ind_host_tmp =
+      (simgrid::s4u::Host*) xbt_dict_get_or_null(host_list, name);
     if (ind_host_tmp != nullptr && sg_host_simix(ind_host_tmp) != nullptr) {
       XBT_ERROR("host %s already exits", name);
       return nullptr;
     if (ind_host_tmp != nullptr && sg_host_simix(ind_host_tmp) != nullptr) {
       XBT_ERROR("host %s already exits", name);
       return nullptr;
index 6176ef7..1753479 100644 (file)
@@ -35,7 +35,7 @@ s4u::Actor::Actor(const char *name, s4u::Host *host, int argc, char **argv)
     : s4u::Actor::Actor(name,host, argc,argv, -1) {
 }
 s4u::Actor::Actor(const char *name, s4u::Host *host, int argc, char **argv, double killTime) {
     : s4u::Actor::Actor(name,host, argc,argv, -1) {
 }
 s4u::Actor::Actor(const char *name, s4u::Host *host, int argc, char **argv, double killTime) {
-       p_smx_process = simcall_process_create(name, s4u_actor_runner, this, host->name(), killTime, argc, argv, NULL/*properties*/,0);
+       p_smx_process = simcall_process_create(name, s4u_actor_runner, this, host->name().c_str(), killTime, argc, argv, NULL/*properties*/,0);
 
        xbt_assert(p_smx_process,"Cannot create the actor");
 //     TRACE_msg_process_create(procname, simcall_process_get_PID(p_smx_process), host->getInferior());
 
        xbt_assert(p_smx_process,"Cannot create the actor");
 //     TRACE_msg_process_create(procname, simcall_process_get_PID(p_smx_process), host->getInferior());
index 94a5947..e68d191 100644 (file)
@@ -23,19 +23,19 @@ namespace s4u {
 
 File::File(const char*fullpath, void *userdata) {
        // this cannot fail because we get a xbt_die if the mountpoint does not exist
 
 File::File(const char*fullpath, void *userdata) {
        // this cannot fail because we get a xbt_die if the mountpoint does not exist
-       p_inferior = simcall_file_open(fullpath, Host::current()->inferior());
+       p_inferior = simcall_file_open(fullpath, Host::current());
        p_path = fullpath;
 }
 
 File::~File() {
        p_path = fullpath;
 }
 
 File::~File() {
-       simcall_file_close(p_inferior, Host::current()->inferior());
+       simcall_file_close(p_inferior, Host::current());
 }
 
 sg_size_t File::read(sg_size_t size) {
 }
 
 sg_size_t File::read(sg_size_t size) {
-       return simcall_file_read(p_inferior, size, Host::current()->inferior());
+       return simcall_file_read(p_inferior, size, Host::current());
 }
 sg_size_t File::write(sg_size_t size) {
 }
 sg_size_t File::write(sg_size_t size) {
-       return simcall_file_write(p_inferior,size, Host::current()->inferior());
+       return simcall_file_write(p_inferior,size, Host::current());
 }
 sg_size_t File::size() {
        return simcall_file_get_size(p_inferior);
 }
 sg_size_t File::size() {
        return simcall_file_get_size(p_inferior);
@@ -51,7 +51,7 @@ void File::move(const char*fullpath) {
        simcall_file_move(p_inferior,fullpath);
 }
 void File::unlink() {
        simcall_file_move(p_inferior,fullpath);
 }
 void File::unlink() {
-       sg_host_t attached = Host::current()->inferior(); // FIXME: we should check where this file is attached
+       sg_host_t attached = Host::current(); // FIXME: we should check where this file is attached
        simcall_file_unlink(p_inferior,attached);
 }
 
        simcall_file_unlink(p_inferior,attached);
 }
 
index f878ce8..9bab734 100644 (file)
@@ -4,69 +4,86 @@
 /* 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. */
 
 /* 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 <string>
+#include <functional>
+#include <stdexcept>
+
+#include <unordered_map>
+
+#include <simgrid/simix.hpp>
+
 #include "xbt/log.h"
 #include "src/msg/msg_private.h"
 #include "src/simix/smx_process_private.h"
 #include "xbt/log.h"
 #include "src/msg/msg_private.h"
 #include "src/simix/smx_process_private.h"
+#include "src/simix/smx_private.hpp"
+#include "src/surf/cpu_interface.hpp"
+#include "src/surf/host_interface.hpp"
 
 #include "simgrid/s4u/host.hpp"
 #include "simgrid/s4u/storage.hpp"
 
 
 #include "simgrid/s4u/host.hpp"
 #include "simgrid/s4u/storage.hpp"
 
+int MSG_HOST_LEVEL;
+int SD_HOST_LEVEL;
+int SIMIX_HOST_LEVEL;
+int ROUTING_HOST_LEVEL;
+int USER_HOST_LEVEL;
+
 namespace simgrid {
 namespace s4u {
 
 boost::unordered_map<std::string, Host*> *Host::hosts
                = new boost::unordered_map<std::string, Host*>();
 
 namespace simgrid {
 namespace s4u {
 
 boost::unordered_map<std::string, Host*> *Host::hosts
                = new boost::unordered_map<std::string, Host*>();
 
-Host::Host(const char*name)
+simgrid::xbt::signal<void(Host&)> Host::onCreation;
+simgrid::xbt::signal<void(Host&)> Host::onDestruction;
+simgrid::xbt::signal<void(Host&)> Host::onStateChange;
+
+Host::Host(const char* name)
+  : name_(name)
 {
 {
-       p_inferior = sg_host_by_name(name);
-       if (p_inferior==NULL)
-               xbt_die("No such host: %s",name); //FIXME: raise an exception
 }
 }
+
 Host::~Host() {
        if (mounts != NULL)
                delete mounts;
 }
 
 Host *Host::byName(std::string name) {
 Host::~Host() {
        if (mounts != NULL)
                delete mounts;
 }
 
 Host *Host::byName(std::string name) {
-       Host * res = NULL;
-       try {
-               res = hosts->at(name);
-       } catch (std::out_of_range& e) {}
-
-       if (res==NULL) {
-               res = new Host(name.c_str());
-               hosts->insert({name,res});
-       }
-       return res;
+       Host* host = Host::by_name_or_null(name.c_str());
+       // TODO, raise an exception instead?
+       if (host == nullptr)
+               xbt_die("No such host: %s", name.c_str());
+       return host;
 }
 }
+
 Host *Host::current(){
        smx_process_t smx_proc = SIMIX_process_self();
        if (smx_proc == NULL)
                xbt_die("Cannot call Host::current() from the maestro context");
 Host *Host::current(){
        smx_process_t smx_proc = SIMIX_process_self();
        if (smx_proc == NULL)
                xbt_die("Cannot call Host::current() from the maestro context");
-
-       return Host::byName(sg_host_get_name(SIMIX_process_get_host(smx_proc)));
-}
-
-const char* Host::name() {
-       return sg_host_get_name(p_inferior);
+       return SIMIX_process_get_host(smx_proc);
 }
 
 void Host::turnOn() {
 }
 
 void Host::turnOn() {
-       p_inferior->turnOn();
+       simgrid::simix::kernel(std::bind(SIMIX_host_on, this));
 }
 }
+
 void Host::turnOff() {
 void Host::turnOff() {
-       p_inferior->turnOff();
+       simgrid::simix::simcall<void>(SIMCALL_HOST_OFF, this);
 }
 }
+
 bool Host::isOn() {
 bool Host::isOn() {
-       return sg_host_is_on(p_inferior);
+       return this->pimpl_cpu->isOn();
+}
+
+int Host::getNbPStates() const {
+       return this->pimpl_cpu->getNbPStates();
 }
 
 boost::unordered_map<std::string, Storage&> &Host::mountedStorages() {
        if (mounts == NULL) {
                mounts = new boost::unordered_map<std::string, Storage&> ();
 
 }
 
 boost::unordered_map<std::string, Storage&> &Host::mountedStorages() {
        if (mounts == NULL) {
                mounts = new boost::unordered_map<std::string, Storage&> ();
 
-               xbt_dict_t dict = p_inferior->getMountedStorageList();
+               xbt_dict_t dict = this->getMountedStorageList();
 
                xbt_dict_cursor_t cursor;
                char *mountname;
 
                xbt_dict_cursor_t cursor;
                char *mountname;
@@ -80,6 +97,112 @@ boost::unordered_map<std::string, Storage&> &Host::mountedStorages() {
        return *mounts;
 }
 
        return *mounts;
 }
 
+/** Get the properties assigned to a host */
+xbt_dict_t Host::getProperties() {
+  return simgrid::simix::kernel([&] {
+               simgrid::surf::Host* surf_host = this->extension<simgrid::surf::Host>();
+               return surf_host->getProperties();
+       });
+}
+
+/** Get the processes attached to the host */
+xbt_swag_t Host::getProcessList()
+{
+  return simgrid::simix::kernel([&]() {
+    return ((smx_host_priv_t)this->extension(SIMIX_HOST_LEVEL))->process_list;
+  });
+}
+
+/** Get the peak power of a host */
+double Host::getCurrentPowerPeak()
+{
+  return simgrid::simix::kernel([&] {
+    return this->pimpl_cpu->getCurrentPowerPeak();
+  });
+}
+
+/** Get one power peak (in flops/s) of a host at a given pstate */
+double Host::getPowerPeakAt(int pstate_index)
+{
+  return simgrid::simix::kernel([&] {
+    return this->pimpl_cpu->getPowerPeakAt(pstate_index);
+  });
+}
+
+/** @brief Get the speed of the cpu associated to a host */
+double Host::getSpeed() {
+       return pimpl_cpu->getSpeed(1.0);
+}
+/** @brief Returns the number of core of the processor. */
+int Host::getCoreAmount() {
+       return pimpl_cpu->getCore();
+}
+
+Host* Host::by_name_or_null(const char* name)
+{
+  return (Host*) xbt_dict_get_or_null(host_list, name);
+}
+
+Host* Host::by_name_or_create(const char* name)
+{
+  Host* host = by_name_or_null(name);
+  if (host == nullptr) {
+    host = new Host(name);
+    xbt_dict_set(host_list, name, host, NULL);
+  }
+  return host;
+}
+
+/** @brief Set the pstate at which the host should run */
+void Host::setPState(int pstate_index)
+{
+  simgrid::simix::kernel(std::bind(
+      &simgrid::surf::Cpu::setPState, pimpl_cpu, pstate_index
+  ));
+}
+/** @brief Retrieve the pstate at which the host is currently running */
+int Host::getPState()
+{
+  return pimpl_cpu->getPState();
+}
+
+void Host::getParams(vm_params_t params)
+{
+  simgrid::simix::kernel([&]() {
+    this->extension<simgrid::surf::Host>()->getParams(params);
+  });
+}
+
+void Host::setParams(vm_params_t params)
+{
+  simgrid::simix::kernel([&]() {
+    this->extension<simgrid::surf::Host>()->setParams(params);
+  });
+}
+
+/**
+ * \ingroup simix_storage_management
+ * \brief Returns the list of storages mounted on an host.
+ * \return a dict containing all storages mounted on the host
+ */
+xbt_dict_t Host::getMountedStorageList()
+{
+  return simgrid::simix::kernel([&] {
+    return this->extension<simgrid::surf::Host>()->getMountedStorageList();
+  });
+}
+
+/**
+ * \ingroup simix_storage_management
+ * \brief Returns the list of storages attached to an host.
+ * \return a dict containing all storages attached to the host
+ */
+xbt_dynar_t Host::getAttachedStorageList()
+{
+  return simgrid::simix::kernel([&] {
+    return this->extension<simgrid::surf::Host>()->getAttachedStorageList();
+  });
+}
 
 } // namespace simgrid
 } // namespace s4u
 
 } // namespace simgrid
 } // namespace s4u
index afbb210..68bb80e 100644 (file)
@@ -7,7 +7,7 @@
 #include "src/surf/host_interface.hpp"
 #include "src/simdag/simdag_private.h"
 #include "simgrid/simdag.h"
 #include "src/surf/host_interface.hpp"
 #include "src/simdag/simdag_private.h"
 #include "simgrid/simdag.h"
-#include "simgrid/Host.hpp"
+#include <simgrid/s4u/host.hpp>
 #include "xbt/dict.h"
 #include "xbt/lib.h"
 #include "xbt/sysdep.h"
 #include "xbt/dict.h"
 #include "xbt/lib.h"
 #include "xbt/sysdep.h"
index 711c740..dcde167 100644 (file)
@@ -4,11 +4,10 @@
 /* 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. */
 
 /* 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/simix.hpp>
-
 #include "xbt/dict.h"
 #include "simgrid/host.h"
 #include "xbt/dict.h"
 #include "simgrid/host.h"
-#include "simgrid/Host.hpp"
+#include <xbt/Extendable.hpp>
+#include <simgrid/s4u/host.hpp>
 #include "surf/surf.h" // routing_get_network_element_type FIXME:killme
 
 #include "src/simix/smx_private.hpp"
 #include "surf/surf.h" // routing_get_network_element_type FIXME:killme
 
 #include "src/simix/smx_private.hpp"
@@ -21,7 +20,7 @@ size_t sg_host_count()
 
 const char *sg_host_get_name(sg_host_t host)
 {
 
 const char *sg_host_get_name(sg_host_t host)
 {
-       return host->getName().c_str();
+       return host->name().c_str();
 }
 
 void* sg_host_extension_get(sg_host_t host, size_t ext)
 }
 
 void* sg_host_extension_get(sg_host_t host, size_t ext)
@@ -31,17 +30,17 @@ void* sg_host_extension_get(sg_host_t host, size_t ext)
 
 size_t sg_host_extension_create(void(*deleter)(void*))
 {
 
 size_t sg_host_extension_create(void(*deleter)(void*))
 {
-  return simgrid::Host::extension_create(deleter);
+  return simgrid::s4u::Host::extension_create(deleter);
 }
 
 sg_host_t sg_host_by_name(const char *name)
 {
 }
 
 sg_host_t sg_host_by_name(const char *name)
 {
-  return simgrid::Host::by_name_or_null(name);
+  return simgrid::s4u::Host::by_name_or_null(name);
 }
 
 sg_host_t sg_host_by_name_or_create(const char *name)
 {
 }
 
 sg_host_t sg_host_by_name_or_create(const char *name)
 {
-  return simgrid::Host::by_name_or_create(name);
+  return simgrid::s4u::Host::by_name_or_create(name);
 }
 
 xbt_dynar_t sg_hosts_as_dynar(void)
 }
 
 xbt_dynar_t sg_hosts_as_dynar(void)
@@ -50,20 +49,14 @@ xbt_dynar_t sg_hosts_as_dynar(void)
 
   xbt_dict_cursor_t cursor = nullptr;
   const char* name = nullptr;
 
   xbt_dict_cursor_t cursor = nullptr;
   const char* name = nullptr;
-  simgrid::Host* host = nullptr;
+  simgrid::s4u::Host* host = nullptr;
        xbt_dict_foreach(host_list, cursor, name, host)
                if(routing_get_network_element_type(name) == SURF_NETWORK_ELEMENT_HOST)
                        xbt_dynar_push(res, &host);
        return res;
 }
 
        xbt_dict_foreach(host_list, cursor, name, host)
                if(routing_get_network_element_type(name) == SURF_NETWORK_ELEMENT_HOST)
                        xbt_dynar_push(res, &host);
        return res;
 }
 
-// ========= Layering madness ==============
-
-int MSG_HOST_LEVEL;
-int SD_HOST_LEVEL;
-int SIMIX_HOST_LEVEL;
-int ROUTING_HOST_LEVEL;
-int USER_HOST_LEVEL;
+// ========= Layering madness ==============*
 
 #include "src/msg/msg_private.h" // MSG_host_priv_free. FIXME: killme by initializing that level in msg when used
 #include "src/simdag/simdag_private.h" // __SD_workstation_destroy. FIXME: killme by initializing that level in simdag when used
 
 #include "src/msg/msg_private.h" // MSG_host_priv_free. FIXME: killme by initializing that level in msg when used
 #include "src/simdag/simdag_private.h" // __SD_workstation_destroy. FIXME: killme by initializing that level in simdag when used
@@ -73,17 +66,17 @@ int USER_HOST_LEVEL;
 
 void sg_host_init()
 {
 
 void sg_host_init()
 {
-  MSG_HOST_LEVEL = simgrid::Host::extension_create([](void *p) {
+  MSG_HOST_LEVEL = simgrid::s4u::Host::extension_create([](void *p) {
     __MSG_host_priv_free((msg_host_priv_t) p);
   });
 
     __MSG_host_priv_free((msg_host_priv_t) p);
   });
 
-  ROUTING_HOST_LEVEL = simgrid::Host::extension_create([](void *p) {
+  ROUTING_HOST_LEVEL = simgrid::s4u::Host::extension_create([](void *p) {
          delete static_cast<simgrid::surf::NetCard*>(p);
   });
 
          delete static_cast<simgrid::surf::NetCard*>(p);
   });
 
-  SD_HOST_LEVEL = simgrid::Host::extension_create(__SD_workstation_destroy);
-  SIMIX_HOST_LEVEL = simgrid::Host::extension_create(SIMIX_host_destroy);
-  USER_HOST_LEVEL = simgrid::Host::extension_create(NULL);
+  SD_HOST_LEVEL = simgrid::s4u::Host::extension_create(__SD_workstation_destroy);
+  SIMIX_HOST_LEVEL = simgrid::s4u::Host::extension_create(SIMIX_host_destroy);
+  USER_HOST_LEVEL = simgrid::s4u::Host::extension_create(NULL);
 }
 
 // ========== User data Layer ==========
 }
 
 // ========== User data Layer ==========
@@ -136,7 +129,7 @@ double sg_host_get_available_speed(sg_host_t host){
  *  @return 1 if the host is active or 0 if it has crashed.
  */
 int sg_host_is_on(sg_host_t host) {
  *  @return 1 if the host is active or 0 if it has crashed.
  */
 int sg_host_is_on(sg_host_t host) {
-       return host->pimpl_cpu->isOn();
+       return host->isOn();
 }
 
 /** @brief Returns the number of power states for a host.
 }
 
 /** @brief Returns the number of power states for a host.
@@ -144,7 +137,7 @@ int sg_host_is_on(sg_host_t host) {
  *  See also @ref SURF_plugin_energy.
  */
 int sg_host_get_nb_pstates(sg_host_t host) {
  *  See also @ref SURF_plugin_energy.
  */
 int sg_host_get_nb_pstates(sg_host_t host) {
-  return host->pimpl_cpu->getNbPStates();
+  return host->getNbPStates();
 }
 
 /** @brief Gets the pstate at which that host currently runs.
 }
 
 /** @brief Gets the pstate at which that host currently runs.
@@ -167,145 +160,3 @@ xbt_dict_t sg_host_get_properties(sg_host_t host) {
   return host->getProperties();
 }
 
   return host->getProperties();
 }
 
-
-namespace simgrid {
-
-simgrid::xbt::signal<void(Host&)> Host::onCreation;
-simgrid::xbt::signal<void(Host&)> Host::onDestruction;
-simgrid::xbt::signal<void(Host&)> Host::onStateChange;
-
-Host::Host(std::string const& id)
-  : name_(id)
-{
-}
-
-Host::~Host()
-{
-}
-
-/** Start the host if it is off */
-void Host::turnOn()
-{
-  simgrid::simix::kernel(std::bind(SIMIX_host_on, this));
-}
-
-/** Stop the host if it is on */
-void Host::turnOff()
-{
-  simgrid::simix::simcall<void>(SIMCALL_HOST_OFF, this);
-}
-
-bool Host::isOn() {
-  return pimpl_cpu->isOn();
-}
-bool Host::isOff() {
-  return ! pimpl_cpu->isOn();
-}
-
-
-/** Get the properties assigned to a host */
-xbt_dict_t Host::getProperties()
-{
-  return simgrid::simix::kernel(std::bind(&simgrid::surf::Host::getProperties, this->extension(simgrid::surf::Host::EXTENSION_ID)));
-}
-
-/** Get the processes attached to the host */
-xbt_swag_t Host::getProcessList()
-{
-  return simgrid::simix::kernel([&]() {
-    return ((smx_host_priv_t)this->extension(SIMIX_HOST_LEVEL))->process_list;
-  });
-}
-
-/** Get the peak power of a host */
-double Host::getCurrentPowerPeak()
-{
-  return simgrid::simix::kernel([&] {
-    return this->pimpl_cpu->getCurrentPowerPeak();
-  });
-}
-
-/** Get one power peak (in flops/s) of a host at a given pstate */
-double Host::getPowerPeakAt(int pstate_index)
-{
-  return simgrid::simix::kernel([&] {
-    return this->pimpl_cpu->getPowerPeakAt(pstate_index);
-  });
-}
-
-/** @brief Get the speed of the cpu associated to a host */
-double Host::getSpeed() {
-       return pimpl_cpu->getSpeed(1.0);
-}
-/** @brief Returns the number of core of the processor. */
-int Host::getCoreAmount() {
-       return pimpl_cpu->getCore();
-}
-
-Host* Host::by_name_or_null(const char* name)
-{
-  return (Host*) xbt_dict_get_or_null(host_list, name);
-}
-
-Host* Host::by_name_or_create(const char* name)
-{
-  Host* host = by_name_or_null(name);
-  if (host == nullptr) {
-    host = new Host(name);
-    xbt_dict_set(host_list, name, host, NULL);
-  }
-  return host;
-}
-
-/** @brief Set the pstate at which the host should run */
-void Host::setPState(int pstate_index)
-{
-  simgrid::simix::kernel(std::bind(
-      &simgrid::surf::Cpu::setPState, pimpl_cpu, pstate_index
-  ));
-}
-/** @brief Retrieve the pstate at which the host is currently running */
-int Host::getPState()
-{
-  return pimpl_cpu->getPState();
-}
-
-void Host::getParams(vm_params_t params)
-{
-  simgrid::simix::kernel([&]() {
-    this->extension<simgrid::surf::Host>()->getParams(params);
-  });
-}
-
-void Host::setParams(vm_params_t params)
-{
-  simgrid::simix::kernel([&]() {
-    this->extension<simgrid::surf::Host>()->setParams(params);
-  });
-}
-
-/**
- * \ingroup simix_storage_management
- * \brief Returns the list of storages mounted on an host.
- * \return a dict containing all storages mounted on the host
- */
-xbt_dict_t Host::getMountedStorageList()
-{
-  return simgrid::simix::kernel([&] {
-    return this->extension<simgrid::surf::Host>()->getMountedStorageList();
-  });
-}
-
-/**
- * \ingroup simix_storage_management
- * \brief Returns the list of storages attached to an host.
- * \return a dict containing all storages attached to the host
- */
-xbt_dynar_t Host::getAttachedStorageList()
-{
-  return simgrid::simix::kernel([&] {
-    return this->extension<simgrid::surf::Host>()->getAttachedStorageList();
-  });
-}
-
-}
index bc428ed..6acc54c 100644 (file)
@@ -231,7 +231,7 @@ void SIMIX_global_init(int *argc, char **argv)
     /* register a function to be called by SURF after the environment creation */
     sg_platf_init();
     sg_platf_postparse_add_cb(SIMIX_post_create_environment);
     /* register a function to be called by SURF after the environment creation */
     sg_platf_init();
     sg_platf_postparse_add_cb(SIMIX_post_create_environment);
-    simgrid::Host::onCreation.connect([](simgrid::Host& host) {
+    simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) {
       SIMIX_host_create(&host);
     });
     surf_on_storage_created(SIMIX_storage_create_);
       SIMIX_host_create(&host);
     });
     surf_on_storage_created(SIMIX_storage_create_);
index 6cb3ff1..111f9b3 100644 (file)
@@ -111,7 +111,7 @@ void SIMIX_host_off(sg_host_t h, smx_process_t issuer)
       }
     }
   } else {
       }
     }
   } else {
-    XBT_INFO("Host %s is already off",h->getName().c_str());
+    XBT_INFO("Host %s is already off",h->name().c_str());
   }
 }
 
   }
 }
 
index 9893b57..6050f16 100644 (file)
@@ -84,7 +84,7 @@ CpuCas01Model::~CpuCas01Model()
   delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
 }
 
   delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
 }
 
-Cpu *CpuCas01Model::createCpu(simgrid::Host *host, xbt_dynar_t speedPeak,
+Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
                                  int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
                                  int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
@@ -137,7 +137,7 @@ void CpuCas01Model::addTraces()
 /************
  * Resource *
  ************/
 /************
  * Resource *
  ************/
-CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::Host *host, xbt_dynar_t speedPeak,
+CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
                          int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
                          int initiallyOn, tmgr_trace_t stateTrace)
 : Cpu(model, host,
                          int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
                          int initiallyOn, tmgr_trace_t stateTrace)
 : Cpu(model, host,
index 30b2bea..b7564d7 100644 (file)
@@ -27,7 +27,7 @@ public:
   CpuCas01Model();
   ~CpuCas01Model();
 
   CpuCas01Model();
   ~CpuCas01Model();
 
-  Cpu *createCpu(simgrid::Host *host, xbt_dynar_t speedPeak, int pstate,
+  Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int pstate,
                    double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
                    double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
@@ -43,7 +43,7 @@ public:
 
 class CpuCas01 : public Cpu {
 public:
 
 class CpuCas01 : public Cpu {
 public:
-  CpuCas01(CpuCas01Model *model, simgrid::Host *host, xbt_dynar_t speedPeak,
+  CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
         int initiallyOn, tmgr_trace_t stateTrace) ;
   ~CpuCas01();
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
         int initiallyOn, tmgr_trace_t stateTrace) ;
   ~CpuCas01();
index d8fd429..c98acca 100644 (file)
@@ -131,7 +131,7 @@ void CpuModel::updateActionsStateFull(double now, double delta)
 /************
  * Resource *
  ************/
 /************
  * Resource *
  ************/
-Cpu::Cpu(Model *model, simgrid::Host *host,
+Cpu::Cpu(Model *model, simgrid::s4u::Host *host,
             xbt_dynar_t speedPeakList, int pstate,
                 int core, double speedPeak, double speedScale,
                 int initiallyOn)
             xbt_dynar_t speedPeakList, int pstate,
                 int core, double speedPeak, double speedScale,
                 int initiallyOn)
@@ -139,11 +139,11 @@ Cpu::Cpu(Model *model, simgrid::Host *host,
 {
 }
 
 {
 }
 
-Cpu::Cpu(Model *model, simgrid::Host *host, lmm_constraint_t constraint,
+Cpu::Cpu(Model *model, simgrid::s4u::Host *host, lmm_constraint_t constraint,
              xbt_dynar_t speedPeakList, int pstate,
                  int core, double speedPeak,
         double speedScale, int initiallyOn)
              xbt_dynar_t speedPeakList, int pstate,
                  int core, double speedPeak,
         double speedScale, int initiallyOn)
- : Resource(model, host->getName().c_str(), constraint, initiallyOn)
+ : Resource(model, host->name().c_str(), constraint, initiallyOn)
  , m_core(core)
  , m_speedPeak(speedPeak)
  , m_speedScale(speedScale)
  , m_core(core)
  , m_speedPeak(speedPeak)
  , m_speedScale(speedScale)
@@ -173,7 +173,7 @@ Cpu::Cpu(Model *model, simgrid::Host *host, lmm_constraint_t constraint,
     int i;
     for (i = 0; i < core; i++) {
       /* just for a unique id, never used as a string. */
     int i;
     for (i = 0; i < core; i++) {
       /* just for a unique id, never used as a string. */
-      p_constraintCoreId[i] = bprintf("%s:%i", host->getName().c_str(), i);
+      p_constraintCoreId[i] = bprintf("%s:%i", host->name().c_str(), i);
       p_constraintCore[i] = lmm_constraint_new(model->getMaxminSystem(), p_constraintCoreId[i], m_speedScale * m_speedPeak);
     }
   }
       p_constraintCore[i] = lmm_constraint_new(model->getMaxminSystem(), p_constraintCoreId[i], m_speedScale * m_speedPeak);
     }
   }
index 38c6c70..090d41a 100644 (file)
@@ -53,8 +53,8 @@ public:
    * @param state_initial [TODO]
    * @param state_trace [TODO]
    */
    * @param state_initial [TODO]
    * @param state_trace [TODO]
    */
-  virtual Cpu *createCpu(simgrid::Host *host, xbt_dynar_t speedPeak,
-                      int pstate, double speedScale,
+  virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
+                          int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
                           tmgr_trace_t state_trace)=0;
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
                           tmgr_trace_t state_trace)=0;
@@ -85,7 +85,8 @@ public:
    * @param speedScale The speed scale of this Cpu in [0;1] (available amount)
    * @param stateInitial whether it is created running or crashed
    */
    * @param speedScale The speed scale of this Cpu in [0;1] (available amount)
    * @param stateInitial whether it is created running or crashed
    */
-  Cpu(simgrid::surf::Model *model, simgrid::Host *host, lmm_constraint_t constraint,
+  Cpu(simgrid::surf::Model *model, simgrid::s4u::Host *host,
+    lmm_constraint_t constraint,
          xbt_dynar_t speedPeakList, int pstate,
          int core, double speedPeak, double speedScale,
          int initiallyOn);
          xbt_dynar_t speedPeakList, int pstate,
          int core, double speedPeak, double speedScale,
          int initiallyOn);
@@ -100,7 +101,7 @@ public:
    * @param speedScale The speed scale of this Cpu in [0;1] (available amount)
    * @param stateInitial whether it is created running or crashed
    */
    * @param speedScale The speed scale of this Cpu in [0;1] (available amount)
    * @param stateInitial whether it is created running or crashed
    */
-  Cpu(simgrid::surf::Model *model, simgrid::Host *host,
+  Cpu(simgrid::surf::Model *model, simgrid::s4u::Host *host,
       xbt_dynar_t speedPeakList, int pstate,
          int core, double speedPeak, double speedScale,
          int initiallyOn);
       xbt_dynar_t speedPeakList, int pstate,
          int core, double speedPeak, double speedScale,
          int initiallyOn);
@@ -147,13 +148,13 @@ public:
   virtual int  getPState();
 
   void addTraces(void);
   virtual int  getPState();
 
   void addTraces(void);
-  simgrid::Host* getHost() { return m_host; }
+  simgrid::s4u::Host* getHost() { return m_host; }
 
 public:
   int m_core = 1;                /* Amount of cores */
   double m_speedPeak;            /*< CPU speed peak, ie max value */
   double m_speedScale;           /*< Percentage of CPU available according to the trace, in [O,1] */
 
 public:
   int m_core = 1;                /* Amount of cores */
   double m_speedPeak;            /*< CPU speed peak, ie max value */
   double m_speedScale;           /*< Percentage of CPU available according to the trace, in [O,1] */
-  simgrid::Host* m_host;
+  simgrid::s4u::Host* m_host;
 
   xbt_dynar_t p_speedPeakList = NULL; /*< List of supported CPU capacities (pstate related) */
   int m_pstate = 0;                   /*< Current pstate (index in the speedPeakList)*/
 
   xbt_dynar_t p_speedPeakList = NULL; /*< List of supported CPU capacities (pstate related) */
   int m_pstate = 0;                   /*< Current pstate (index in the speedPeakList)*/
index f3feb36..306312d 100644 (file)
@@ -434,7 +434,7 @@ CpuTiModel::~CpuTiModel()
   xbt_heap_free(p_tiActionHeap);
 }
 
   xbt_heap_free(p_tiActionHeap);
 }
 
-Cpu *CpuTiModel::createCpu(simgrid::Host *host,
+Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host,
                               xbt_dynar_t speedPeak,
                               int pstate,
                            double speedScale,
                               xbt_dynar_t speedPeak,
                               int pstate,
                            double speedScale,
@@ -547,7 +547,7 @@ void CpuTiModel::addTraces()
 /************
  * Resource *
  ************/
 /************
  * Resource *
  ************/
-CpuTi::CpuTi(CpuTiModel *model, simgrid::Host *host, xbt_dynar_t speedPeak,
+CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
         int initiallyOn, tmgr_trace_t stateTrace)
   : Cpu(model, host, NULL, pstate, core, 0, speedScale, initiallyOn)
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
         int initiallyOn, tmgr_trace_t stateTrace)
   : Cpu(model, host, NULL, pstate, core, 0, speedScale, initiallyOn)
index d8df612..be3b561 100644 (file)
@@ -113,7 +113,7 @@ typedef boost::intrusive::list<
  ************/
 class CpuTi : public Cpu {
 public:
  ************/
 class CpuTi : public Cpu {
 public:
-  CpuTi(CpuTiModel *model, simgrid::Host *host, xbt_dynar_t speedPeak,
+  CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
         int initiallyOn, tmgr_trace_t stateTrace) ;
   ~CpuTi();
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
         int initiallyOn, tmgr_trace_t stateTrace) ;
   ~CpuTi();
@@ -152,7 +152,7 @@ class CpuTiModel : public CpuModel {
 public:
   CpuTiModel();
   ~CpuTiModel();
 public:
   CpuTiModel();
   ~CpuTiModel();
-  Cpu *createCpu(simgrid::Host *host,  xbt_dynar_t speedPeak,
+  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedPeak,
                           int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
                           int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
index 1696064..dcacf52 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "host_interface.hpp"
 
 
 #include "host_interface.hpp"
 
-#include <simgrid/Host.hpp>
+#include <simgrid/s4u/host.hpp>
 
 #include "src/simix/smx_private.h"
 #include "cpu_cas01.hpp"
 
 #include "src/simix/smx_private.h"
 #include "cpu_cas01.hpp"
@@ -31,7 +31,7 @@ void host_add_traces(){
 namespace simgrid {
 namespace surf {
 
 namespace simgrid {
 namespace surf {
 
-simgrid::xbt::Extension<simgrid::Host, Host> Host::EXTENSION_ID;
+simgrid::xbt::Extension<simgrid::s4u::Host, Host> Host::EXTENSION_ID;
 
 /*********
  * Model *
 
 /*********
  * Model *
@@ -87,7 +87,7 @@ void HostModel::adjustWeightOfDummyCpuActions()
 void Host::classInit()
 {
   if (!EXTENSION_ID.valid()) {
 void Host::classInit()
 {
   if (!EXTENSION_ID.valid()) {
-    EXTENSION_ID = simgrid::Host::extension_create<simgrid::surf::Host>();
+    EXTENSION_ID = simgrid::s4u::Host::extension_create<simgrid::surf::Host>();
   }
 }
 
   }
 }
 
@@ -114,10 +114,10 @@ Host::~Host()
 {
 }
 
 {
 }
 
-void Host::attach(simgrid::Host* host)
+void Host::attach(simgrid::s4u::Host* host)
 {
   if (p_host != nullptr)
 {
   if (p_host != nullptr)
-    xbt_die("Already attached to host %s", host->getName().c_str());
+    xbt_die("Already attached to host %s", host->name().c_str());
   host->extension_set(this);
   p_host = host;
 }
   host->extension_set(this);
   p_host = host;
 }
@@ -131,13 +131,13 @@ bool Host::isOff() {
 void Host::turnOn(){
   if (isOff()) {
     p_cpu->turnOn();
 void Host::turnOn(){
   if (isOff()) {
     p_cpu->turnOn();
-    simgrid::Host::onStateChange(*this->p_host);
+    simgrid::s4u::Host::onStateChange(*this->p_host);
   }
 }
 void Host::turnOff(){
   if (isOn()) {
     p_cpu->turnOff();
   }
 }
 void Host::turnOff(){
   if (isOn()) {
     p_cpu->turnOff();
-    simgrid::Host::onStateChange(*this->p_host);
+    simgrid::s4u::Host::onStateChange(*this->p_host);
   }
 }
 
   }
 }
 
index 0676724..ef36245 100644 (file)
@@ -77,7 +77,7 @@ class Host :
         public simgrid::surf::Resource,
         public simgrid::surf::PropertyHolder {
 public:
         public simgrid::surf::Resource,
         public simgrid::surf::PropertyHolder {
 public:
-  static simgrid::xbt::Extension<simgrid::Host, Host> EXTENSION_ID;
+  static simgrid::xbt::Extension<simgrid::s4u::Host, Host> EXTENSION_ID;
 
 public:
   static void classInit(); // must be called before the first use of that class
 
 public:
   static void classInit(); // must be called before the first use of that class
@@ -115,7 +115,7 @@ public:
   {
     return static_cast<HostModel*>(Resource::getModel());
   }
   {
     return static_cast<HostModel*>(Resource::getModel());
   }
-  void attach(simgrid::Host* host);
+  void attach(simgrid::s4u::Host* host);
 
   bool isOn() override;
   bool isOff() override;
 
   bool isOn() override;
   bool isOff() override;
@@ -236,7 +236,7 @@ public:
 public:
   xbt_dynar_t p_storage;
   Cpu *p_cpu;
 public:
   xbt_dynar_t p_storage;
   Cpu *p_cpu;
-  simgrid::Host* p_host = nullptr;
+  simgrid::s4u::Host* p_host = nullptr;
 
   /** @brief Get the list of virtual machines on the current Host */
   xbt_dynar_t getVms();
 
   /** @brief Get the list of virtual machines on the current Host */
   xbt_dynar_t getVms();
@@ -247,7 +247,7 @@ public:
   void getParams(vm_params_t params);
   /** @brief Sets the params of that VM/PM */
   void setParams(vm_params_t params);
   void getParams(vm_params_t params);
   /** @brief Sets the params of that VM/PM */
   void setParams(vm_params_t params);
-  simgrid::Host* getHost() { return p_host; }
+  simgrid::s4u::Host* getHost() { return p_host; }
 private:
   s_vm_params_t p_params;
 };
 private:
   s_vm_params_t p_params;
 };
index 72a1aef..255bfb3 100644 (file)
@@ -297,7 +297,7 @@ Action *NetworkL07Model::communicate(NetCard *src, NetCard *dst,
   return res;
 }
 
   return res;
 }
 
-Cpu *CpuL07Model::createCpu(simgrid::Host *host,  xbt_dynar_t powerPeakList,
+Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host,  xbt_dynar_t powerPeakList,
                           int pstate, double power_scale,
                           tmgr_trace_t power_trace, int core,
                           int initiallyOn,
                           int pstate, double power_scale,
                           tmgr_trace_t power_trace, int core,
                           int initiallyOn,
@@ -395,7 +395,7 @@ void HostL07Model::addTraces()
  * Resource *
  ************/
 
  * Resource *
  ************/
 
-CpuL07::CpuL07(CpuL07Model *model, simgrid::Host *host,
+CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host,
                     xbt_dynar_t speedPeakList, int pstate,
                                 double speedScale, tmgr_trace_t speedTrace,
                         int core, int initiallyOn, tmgr_trace_t state_trace)
                     xbt_dynar_t speedPeakList, int pstate,
                                 double speedScale, tmgr_trace_t speedTrace,
                         int core, int initiallyOn, tmgr_trace_t state_trace)
index 1de3995..0e69ef8 100644 (file)
@@ -57,7 +57,7 @@ public:
   CpuL07Model(HostL07Model *hmodel,lmm_system_t sys);
   ~CpuL07Model();
 
   CpuL07Model(HostL07Model *hmodel,lmm_system_t sys);
   ~CpuL07Model();
 
-  Cpu *createCpu(simgrid::Host *host,  xbt_dynar_t speedPeakList,
+  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedPeakList,
                           int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
                           int pstate, double speedScale,
                           tmgr_trace_t speedTrace, int core,
                           int initiallyOn,
@@ -97,7 +97,7 @@ class CpuL07 : public Cpu {
   tmgr_trace_event_t p_stateEvent;
   tmgr_trace_event_t p_speedEvent;
 public:
   tmgr_trace_event_t p_stateEvent;
   tmgr_trace_event_t p_speedEvent;
 public:
-  CpuL07(CpuL07Model *model, simgrid::Host *host, xbt_dynar_t speedPeakList, int pstate,
+  CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, int pstate,
                 double power_scale, tmgr_trace_t power_trace,
      int core, int initiallyOn, tmgr_trace_t state_trace);
   ~CpuL07();
                 double power_scale, tmgr_trace_t power_trace,
      int core, int initiallyOn, tmgr_trace_t state_trace);
   ~CpuL07();
index dfbba3b..e7a4195 100644 (file)
@@ -27,7 +27,7 @@ void surf_network_model_init_Constant()
 
   routing_model_create(NULL);
 
 
   routing_model_create(NULL);
 
-  simgrid::Host::onCreation.connect([](simgrid::Host&) {
+  simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host&) {
     host_number_int++;
   });
   sg_platf_link_add_cb(netcste_parse_nolink);
     host_number_int++;
   });
   sg_platf_link_add_cb(netcste_parse_nolink);
index cbeb8ae..8771a39 100644 (file)
@@ -14,7 +14,7 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
 
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
 
-static void IB_create_host_callback(simgrid::Host& host){
+static void IB_create_host_callback(simgrid::s4u::Host& host){
   using namespace simgrid::surf;
   
   static int id=0;
   using namespace simgrid::surf;
   
   static int id=0;
@@ -26,7 +26,7 @@ static void IB_create_host_callback(simgrid::Host& host){
 
   id++;
   xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes,
 
   id++;
   xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes,
-    host.getName().c_str(), act, NULL);
+    host.name().c_str(), act, NULL);
 
 }
 
 
 }
 
@@ -99,7 +99,7 @@ void surf_network_model_init_IB(void)
   xbt_dynar_push(all_existing_models, &surf_network_model);
   networkActionStateChangedCallbacks.connect(IB_action_state_changed_callback);
   networkCommunicateCallbacks.connect(IB_action_init_callback);
   xbt_dynar_push(all_existing_models, &surf_network_model);
   networkActionStateChangedCallbacks.connect(IB_action_state_changed_callback);
   networkCommunicateCallbacks.connect(IB_action_init_callback);
-  simgrid::Host::onCreation.connect(IB_create_host_callback);
+  simgrid::s4u::Host::onCreation.connect(IB_create_host_callback);
   xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775);
   
 }
   xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775);
   
 }
index f637494..28d43b1 100644 (file)
@@ -110,7 +110,7 @@ static void parse_ns3_add_cluster(sg_platf_cluster_cbarg_t cluster)
       start = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 0, char *));
       xbt_dynar_push_as(tab_elements_num, int, start);
       router_id = bprintf("ns3_%s%d%s", cluster_prefix, start, cluster_suffix);
       start = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 0, char *));
       xbt_dynar_push_as(tab_elements_num, int, start);
       router_id = bprintf("ns3_%s%d%s", cluster_prefix, start, cluster_suffix);
-      simgrid::Host::by_name_or_create(router_id)
+      simgrid::s4u::Host::by_name_or_create(router_id)
         ->extension_set(NS3_EXTENSION_ID, ns3_add_host_cluster(router_id));
       XBT_DEBUG("NS3_ADD_ROUTER '%s'",router_id);
       free(router_id);
         ->extension_set(NS3_EXTENSION_ID, ns3_add_host_cluster(router_id));
       XBT_DEBUG("NS3_ADD_ROUTER '%s'",router_id);
       free(router_id);
@@ -122,7 +122,7 @@ static void parse_ns3_add_cluster(sg_platf_cluster_cbarg_t cluster)
       for (i = start; i <= end; i++){
         xbt_dynar_push_as(tab_elements_num, int, i);
         router_id = bprintf("ns3_%s%d%s", cluster_prefix, i, cluster_suffix);
       for (i = start; i <= end; i++){
         xbt_dynar_push_as(tab_elements_num, int, i);
         router_id = bprintf("ns3_%s%d%s", cluster_prefix, i, cluster_suffix);
-        simgrid::Host::by_name_or_create(router_id)
+        simgrid::s4u::Host::by_name_or_create(router_id)
           ->extension_set(NS3_EXTENSION_ID, ns3_add_host_cluster(router_id));
         XBT_DEBUG("NS3_ADD_ROUTER '%s'",router_id);
         free(router_id);
           ->extension_set(NS3_EXTENSION_ID, ns3_add_host_cluster(router_id));
         XBT_DEBUG("NS3_ADD_ROUTER '%s'",router_id);
         free(router_id);
@@ -273,7 +273,7 @@ NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
   routing_model_create(NULL);
   define_callbacks_ns3();
 
   routing_model_create(NULL);
   define_callbacks_ns3();
 
-  NS3_EXTENSION_ID = simgrid::Host::extension_create(free_ns3_host);
+  NS3_EXTENSION_ID = simgrid::s4u::Host::extension_create(free_ns3_host);
   NS3_ASR_LEVEL  = xbt_lib_add_level(as_router_lib, free_ns3_host);
 }
 
   NS3_ASR_LEVEL  = xbt_lib_add_level(as_router_lib, free_ns3_host);
 }
 
index 480947e..d5c3a87 100644 (file)
@@ -13,7 +13,7 @@
 #include "xbt/sysdep.h"
 #include <xbt/Extendable.hpp>
 
 #include "xbt/sysdep.h"
 #include <xbt/Extendable.hpp>
 
-#include <simgrid/Host.hpp>
+#include <simgrid/s4u/host.hpp>
 #include <surf/surf_routing.h>
 
 typedef enum {
 #include <surf/surf_routing.h>
 
 typedef enum {
index 058ae23..079b244 100644 (file)
@@ -60,7 +60,7 @@ using simgrid::energy::HostEnergy;
 namespace simgrid {
 namespace energy {
 
 namespace simgrid {
 namespace energy {
 
-simgrid::xbt::Extension<simgrid::Host, HostEnergy> HostEnergy::EXTENSION_ID;
+simgrid::xbt::Extension<simgrid::s4u::Host, HostEnergy> HostEnergy::EXTENSION_ID;
 
 /* Computes the consumption so far.  Called lazily on need. */
 void HostEnergy::update()
 
 /* Computes the consumption so far.  Called lazily on need. */
 void HostEnergy::update()
@@ -97,7 +97,7 @@ void HostEnergy::update()
            surf_host->getName(), start_time, finish_time, surf_host->p_cpu->m_speedPeak, previous_energy, energy_this_step);
 }
 
            surf_host->getName(), start_time, finish_time, surf_host->p_cpu->m_speedPeak, previous_energy, energy_this_step);
 }
 
-HostEnergy::HostEnergy(simgrid::Host *ptr) :
+HostEnergy::HostEnergy(simgrid::s4u::Host *ptr) :
   host(ptr), last_updated(surf_get_clock())
 {
   initWattsRangeList();
   host(ptr), last_updated(surf_get_clock())
 {
   initWattsRangeList();
@@ -119,14 +119,14 @@ HostEnergy::~HostEnergy()
 double HostEnergy::getWattMinAt(int pstate)
 {
   xbt_assert(!power_range_watts_list.empty(),
 double HostEnergy::getWattMinAt(int pstate)
 {
   xbt_assert(!power_range_watts_list.empty(),
-    "No power range properties specified for host %s", host->getName().c_str());
+    "No power range properties specified for host %s", host->name().c_str());
   return power_range_watts_list[pstate].first;
 }
 
 double HostEnergy::getWattMaxAt(int pstate)
 {
   xbt_assert(!power_range_watts_list.empty(),
   return power_range_watts_list[pstate].first;
 }
 
 double HostEnergy::getWattMaxAt(int pstate)
 {
   xbt_assert(!power_range_watts_list.empty(),
-    "No power range properties specified for host %s", host->getName().c_str());
+    "No power range properties specified for host %s", host->name().c_str());
   return power_range_watts_list[pstate].second;
 }
 
   return power_range_watts_list[pstate].second;
 }
 
@@ -134,7 +134,7 @@ double HostEnergy::getWattMaxAt(int pstate)
 double HostEnergy::getCurrentWattsValue(double cpu_load)
 {
        xbt_assert(!power_range_watts_list.empty(),
 double HostEnergy::getCurrentWattsValue(double cpu_load)
 {
        xbt_assert(!power_range_watts_list.empty(),
-    "No power range properties specified for host %s", host->getName().c_str());
+    "No power range properties specified for host %s", host->name().c_str());
 
   /* min_power corresponds to the idle power (cpu load = 0) */
   /* max_power is the power consumed at 100% cpu load       */
 
   /* min_power corresponds to the idle power (cpu load = 0) */
   /* max_power is the power consumed at 100% cpu load       */
@@ -177,7 +177,7 @@ void HostEnergy::initWattsRangeList()
                xbt_assert(xbt_dynar_length(current_power_values) > 1,
                                "Power properties incorrectly defined - "
         "could not retrieve min and max power values for host %s",
                xbt_assert(xbt_dynar_length(current_power_values) > 1,
                                "Power properties incorrectly defined - "
         "could not retrieve min and max power values for host %s",
-                               host->getName().c_str());
+                               host->name().c_str());
 
                /* min_power corresponds to the idle power (cpu load = 0) */
                /* max_power is the power consumed at 100% cpu load       */
 
                /* min_power corresponds to the idle power (cpu load = 0) */
                /* max_power is the power consumed at 100% cpu load       */
@@ -193,7 +193,7 @@ void HostEnergy::initWattsRangeList()
 }
 
 /* **************************** events  callback *************************** */
 }
 
 /* **************************** events  callback *************************** */
-static void onCreation(simgrid::Host& host) {
+static void onCreation(simgrid::s4u::Host& host) {
   simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
   if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host)) // Ignore virtual machines
     return;
   simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
   if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host)) // Ignore virtual machines
     return;
@@ -214,7 +214,7 @@ static void onActionStateChange(simgrid::surf::CpuAction *action,
     host_energy->update();
 }
 
     host_energy->update();
 }
 
-static void onHostStateChange(simgrid::Host &host) {
+static void onHostStateChange(simgrid::s4u::Host &host) {
   simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
   if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host)) // Ignore virtual machines
     return;
   simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
   if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host)) // Ignore virtual machines
     return;
@@ -225,7 +225,7 @@ static void onHostStateChange(simgrid::Host &host) {
     host_energy->update();
 }
 
     host_energy->update();
 }
 
-static void onHostDestruction(simgrid::Host& host) {
+static void onHostDestruction(simgrid::s4u::Host& host) {
   // Ignore virtual machines
   simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
   if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host))
   // Ignore virtual machines
   simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
   if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host))
@@ -233,7 +233,7 @@ static void onHostDestruction(simgrid::Host& host) {
   HostEnergy *host_energy = host.extension<HostEnergy>();
   host_energy->update();
   XBT_INFO("Total energy of host %s: %f Joules",
   HostEnergy *host_energy = host.extension<HostEnergy>();
   host_energy->update();
   XBT_INFO("Total energy of host %s: %f Joules",
-    host.getName().c_str(), host_energy->getConsumedEnergy());
+    host.name().c_str(), host_energy->getConsumedEnergy());
 }
 
 /* **************************** Public interface *************************** */
 }
 
 /* **************************** Public interface *************************** */
@@ -246,11 +246,11 @@ void sg_energy_plugin_init(void)
   if (HostEnergy::EXTENSION_ID.valid())
     return;
 
   if (HostEnergy::EXTENSION_ID.valid())
     return;
 
-  HostEnergy::EXTENSION_ID = simgrid::Host::extension_create<HostEnergy>();
+  HostEnergy::EXTENSION_ID = simgrid::s4u::Host::extension_create<HostEnergy>();
 
 
-  simgrid::Host::onCreation.connect(&onCreation);
-  simgrid::Host::onStateChange.connect(&onHostStateChange);
-  simgrid::Host::onDestruction.connect(&onHostDestruction);
+  simgrid::s4u::Host::onCreation.connect(&onCreation);
+  simgrid::s4u::Host::onStateChange.connect(&onHostStateChange);
+  simgrid::s4u::Host::onDestruction.connect(&onHostDestruction);
   simgrid::surf::CpuAction::onStateChange.connect(&onActionStateChange);
 }
 
   simgrid::surf::CpuAction::onStateChange.connect(&onActionStateChange);
 }
 
index 1ac1444..e2610ac 100644 (file)
@@ -21,10 +21,10 @@ class XBT_PRIVATE HostEnergy;
 
 class HostEnergy {
 public:
 
 class HostEnergy {
 public:
-  static simgrid::xbt::Extension<simgrid::Host, HostEnergy> EXTENSION_ID;
+  static simgrid::xbt::Extension<simgrid::s4u::Host, HostEnergy> EXTENSION_ID;
   typedef std::pair<double,double> power_range;
 
   typedef std::pair<double,double> power_range;
 
-  HostEnergy(simgrid::Host *ptr);
+  HostEnergy(simgrid::s4u::Host *ptr);
   ~HostEnergy();
 
   double getCurrentWattsValue(double cpu_load);
   ~HostEnergy();
 
   double getCurrentWattsValue(double cpu_load);
@@ -35,7 +35,7 @@ public:
 
 private:
   void initWattsRangeList();
 
 private:
   void initWattsRangeList();
-  simgrid::Host *host = nullptr;
+  simgrid::s4u::Host *host = nullptr;
   std::vector<power_range> power_range_watts_list;   /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */
 public:
   double watts_off = 0.0; /*< Consumption when the machine is turned off (shutdown) */
   std::vector<power_range> power_range_watts_list;   /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */
 public:
   double watts_off = 0.0; /*< Consumption when the machine is turned off (shutdown) */
index 1fb5d32..09f9f45 100644 (file)
@@ -60,7 +60,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
   if (current_routing)
     net = routing_add_host(current_routing, host);
 
   if (current_routing)
     net = routing_add_host(current_routing, host);
 
-  sg_host_t h = simgrid::Host::by_name_or_create(host->id);
+  sg_host_t h = simgrid::s4u::Host::by_name_or_create(host->id);
   simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu(
                h,
         host->speed_peak,
   simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu(
                h,
         host->speed_peak,
@@ -71,7 +71,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
         host->initiallyOn,
         host->state_trace);
   surf_host_model->createHost(host->id, net, cpu, host->properties)->attach(h);
         host->initiallyOn,
         host->state_trace);
   surf_host_model->createHost(host->id, net, cpu, host->properties)->attach(h);
-  simgrid::Host::onCreation(*h);
+  simgrid::s4u::Host::onCreation(*h);
 
   if (TRACE_is_enabled() && TRACE_needs_platform())
     sg_instr_new_host(host);
 
   if (TRACE_is_enabled() && TRACE_needs_platform())
     sg_instr_new_host(host);
index 47970dd..8b71301 100644 (file)
@@ -284,7 +284,7 @@ xbt_dynar_t surf_host_get_vms(sg_host_t host){
   unsigned int cpt;
   simgrid::surf::VirtualMachine *vm;
   xbt_dynar_foreach(vms, cpt, vm) {
   unsigned int cpt;
   simgrid::surf::VirtualMachine *vm;
   xbt_dynar_foreach(vms, cpt, vm) {
-    // TODO, use a backlink from simgrid::surf::Host to simgrid::Host 
+    // TODO, use a backlink from simgrid::surf::Host to simgrid::s4u::Host 
     sg_host_t vm_ = (sg_host_t) xbt_dict_get_elm_or_null(host_list, vm->getName());
     xbt_dynar_push(vms_, &vm_);
   }
     sg_host_t vm_ = (sg_host_t) xbt_dict_get_elm_or_null(host_list, vm->getName());
     xbt_dynar_push(vms_, &vm_);
   }
index 5245a67..6497396 100644 (file)
@@ -304,8 +304,8 @@ void surf_init(int *argc, char **argv)
 {
   XBT_DEBUG("Create all Libs");
   host_list = xbt_dict_new_homogeneous([](void*p) {
 {
   XBT_DEBUG("Create all Libs");
   host_list = xbt_dict_new_homogeneous([](void*p) {
-    simgrid::Host* host = static_cast<simgrid::Host*>(p);
-    simgrid::Host::onDestruction(*host);
+    simgrid::s4u::Host* host = static_cast<simgrid::s4u::Host*>(p);
+    simgrid::s4u::Host::onDestruction(*host);
     delete host;
   });
   as_router_lib = xbt_lib_new();
     delete host;
   });
   as_router_lib = xbt_lib_new();
index af1ceee..71d2e46 100644 (file)
@@ -1326,7 +1326,7 @@ xbt_dynar_t surf_AS_get_hosts(simgrid::surf::As *as)
   for (int index = 0; index < count; index++) {
      sg_netcard_t relm =
       xbt_dynar_get_as(elms, index, simgrid::surf::NetCard*);
   for (int index = 0; index < count; index++) {
      sg_netcard_t relm =
       xbt_dynar_get_as(elms, index, simgrid::surf::NetCard*);
-     sg_host_t delm = simgrid::Host::by_name_or_null(relm->getName());
+     sg_host_t delm = simgrid::s4u::Host::by_name_or_null(relm->getName());
      if (delm!=NULL) {
        xbt_dynar_push(res, &delm);
      }
      if (delm!=NULL) {
        xbt_dynar_push(res, &delm);
      }
index 1601e9e..f5ae8aa 100644 (file)
@@ -57,9 +57,9 @@ void AsVivaldi::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb
           *lat += static_cast<Link*>(info.link_up)->getLatency();
       }
     }
           *lat += static_cast<Link*>(info.link_up)->getLatency();
       }
     }
-    src_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(tmp_src_name)->extension(COORD_HOST_LEVEL);
+    src_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(tmp_src_name)->extension(COORD_HOST_LEVEL);
     if (src_ctn == nullptr)
     if (src_ctn == nullptr)
-      src_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(src->getName())->extension(COORD_HOST_LEVEL);
+      src_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(src->getName())->extension(COORD_HOST_LEVEL);
   }
   else if(src->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || src->getRcType() == SURF_NETWORK_ELEMENT_AS){
     tmp_src_name = ROUTER_PEER(src->getName());
   }
   else if(src->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || src->getRcType() == SURF_NETWORK_ELEMENT_AS){
     tmp_src_name = ROUTER_PEER(src->getName());
@@ -80,10 +80,10 @@ void AsVivaldi::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cb
           *lat += static_cast<Link*>(info.link_down)->getLatency();
       }
     }
           *lat += static_cast<Link*>(info.link_down)->getLatency();
       }
     }
-    dst_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(tmp_dst_name)
+    dst_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(tmp_dst_name)
       ->extension(COORD_HOST_LEVEL);
     if (dst_ctn == nullptr)
       ->extension(COORD_HOST_LEVEL);
     if (dst_ctn == nullptr)
-      dst_ctn = (xbt_dynar_t) simgrid::Host::by_name_or_create(dst->getName())
+      dst_ctn = (xbt_dynar_t) simgrid::s4u::Host::by_name_or_create(dst->getName())
         ->extension(COORD_HOST_LEVEL);
   }
   else if(dst->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || dst->getRcType() == SURF_NETWORK_ELEMENT_AS){
         ->extension(COORD_HOST_LEVEL);
   }
   else if(dst->getRcType() == SURF_NETWORK_ELEMENT_ROUTER || dst->getRcType() == SURF_NETWORK_ELEMENT_AS){
index 4c25e53..96b5ecb 100644 (file)
@@ -33,12 +33,12 @@ VMModel::vm_list_t VMModel::ws_vms;
  * Resource *
  ************/
 
  * Resource *
  ************/
 
-VirtualMachine::VirtualMachine(HostModel *model, const char *name, xbt_dict_t props, simgrid::Host *hostPM)
+VirtualMachine::VirtualMachine(HostModel *model, const char *name, xbt_dict_t props, simgrid::s4u::Host *hostPM)
 : Host(model, name, props, NULL, NULL, NULL)
 , p_hostPM(hostPM)
 {
   VMModel::ws_vms.push_back(*this);
 : Host(model, name, props, NULL, NULL, NULL)
 , p_hostPM(hostPM)
 {
   VMModel::ws_vms.push_back(*this);
-  simgrid::Host::by_name_or_create(name)->extension_set<simgrid::surf::Host>(this);
+  simgrid::s4u::Host::by_name_or_create(name)->extension_set<simgrid::surf::Host>(this);
 }
 
 /*
 }
 
 /*
index 99f1e39..30e4938 100644 (file)
@@ -63,7 +63,7 @@ public:
    * @param cpu The Cpu associated to this VM
    */
   VirtualMachine(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props,
    * @param cpu The Cpu associated to this VM
    */
   VirtualMachine(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props,
-                       simgrid::Host *host);
+                       simgrid::s4u::Host *host);
 
   /** @brief Destructor */
   ~VirtualMachine();
 
   /** @brief Destructor */
   ~VirtualMachine();
@@ -91,7 +91,7 @@ public:
 
   /* The vm object of the lower layer */
   CpuAction *p_action;
 
   /* The vm object of the lower layer */
   CpuAction *p_action;
-  simgrid::Host *p_hostPM;
+  simgrid::s4u::Host *p_hostPM;
 
   void turnOn() override;
   void turnOff() override;
 
   void turnOn() override;
   void turnOff() override;
index b982795..2c25d80 100644 (file)
@@ -93,7 +93,7 @@ double VMHL13Model::shareResources(double now)
 
     double solved_value = get_solved_value(ws_vm->p_action);
     XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value,
 
     double solved_value = get_solved_value(ws_vm->p_action);
     XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value,
-        ws_vm->getName(), ws_vm->p_hostPM->getName().c_str());
+        ws_vm->getName(), ws_vm->p_hostPM->name().c_str());
 
     // TODO: check lmm_update_constraint_bound() works fine instead of the below manual substitution.
     // cpu_cas01->constraint->bound = solved_value;
 
     // TODO: check lmm_update_constraint_bound() works fine instead of the below manual substitution.
     // cpu_cas01->constraint->bound = solved_value;
@@ -199,7 +199,8 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props, sg_host_t hos
   // vm_ws->cpu_action = surf_cpu_model_pm->extension.cpu.execute(host_PM, GUESTOS_NOISE);
   p_action = sub_cpu->execute(0);
 
   // vm_ws->cpu_action = surf_cpu_model_pm->extension.cpu.execute(host_PM, GUESTOS_NOISE);
   p_action = sub_cpu->execute(0);
 
-  XBT_INFO("Create VM(%s)@PM(%s) with %ld mounted disks", name, p_hostPM->getName().c_str(), xbt_dynar_length(p_storage));
+  XBT_INFO("Create VM(%s)@PM(%s) with %ld mounted disks",
+    name, p_hostPM->name().c_str(), xbt_dynar_length(p_storage));
 }
 
 void VMHL13::suspend()
 }
 
 void VMHL13::suspend()
@@ -239,7 +240,7 @@ void VMHL13::migrate(sg_host_t host_dest)
 {
    Host *surfHost_dst = host_dest->extension<Host>();
    const char *vm_name = getName();
 {
    Host *surfHost_dst = host_dest->extension<Host>();
    const char *vm_name = getName();
-   const char *pm_name_src = p_hostPM->getName().c_str();
+   const char *pm_name_src = p_hostPM->name().c_str();
    const char *pm_name_dst = surfHost_dst->getName();
 
    /* update net_elm with that of the destination physical host */
    const char *pm_name_dst = surfHost_dst->getName();
 
    /* update net_elm with that of the destination physical host */
index 6035d65..6f1feb4 100644 (file)
@@ -684,7 +684,6 @@ set(headers_to_install
   include/simgrid/s4u/storage.hpp  
   include/simgrid/s4u.h
   include/simgrid/plugins/energy.h
   include/simgrid/s4u/storage.hpp  
   include/simgrid/s4u.h
   include/simgrid/plugins/energy.h
-  include/simgrid/Host.hpp
   include/smpi/mpi.h
   include/smpi/smpi.h
   include/smpi/smpi_cocci.h
   include/smpi/mpi.h
   include/smpi/smpi.h
   include/smpi/smpi_cocci.h