Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 12 Apr 2019 11:01:51 +0000 (13:01 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 12 Apr 2019 11:01:51 +0000 (13:01 +0200)
18 files changed:
include/simgrid/forward.h
include/simgrid/s4u/Host.hpp
src/include/surf/surf.hpp
src/instr/instr_platform.cpp
src/plugins/host_energy.cpp
src/plugins/vm/VirtualMachineImpl.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/network_interface.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_parseplatf.cpp

index 723d15f..233d185 100644 (file)
@@ -133,8 +133,10 @@ class System;
 }
 namespace resource {
 class Action;
+class Cpu;
 class Model;
 class Resource;
+class CpuModel;
 class NetworkModel;
 class LinkImpl;
 class NetworkAction;
@@ -160,8 +162,6 @@ namespace simix {
   class Timer;
 }
 namespace surf {
-  class Cpu;
-  class CpuModel;
   class HostImpl;
   class HostModel;
 }
index f15116e..ea0afe0 100644 (file)
@@ -144,7 +144,7 @@ private:
 public:
 #ifndef DOXYGEN
   /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */
-  surf::Cpu* pimpl_cpu = nullptr;
+  kernel::resource::Cpu* pimpl_cpu = nullptr;
   // TODO, this could be a unique_ptr
   surf::HostImpl* pimpl_ = nullptr;
   /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */
index b5b027e..410508c 100644 (file)
 /** @ingroup SURF_models
  *  @brief The CPU model object for the physical machine layer
  */
-XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_pm;
+XBT_PUBLIC_DATA simgrid::kernel::resource::CpuModel* surf_cpu_model_pm;
 
 /** @ingroup SURF_models
  *  @brief The CPU model object for the virtual machine layer
  */
-XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_vm;
+XBT_PUBLIC_DATA simgrid::kernel::resource::CpuModel* surf_cpu_model_vm;
 
 /** @ingroup SURF_models
  *  @brief The host model
index e260779..a19c699 100644 (file)
@@ -249,7 +249,7 @@ static void instr_action_on_state_change(simgrid::kernel::resource::Action const
     /* Beware of composite actions: ptasks put links and cpus together. Extra pb: we cannot dynamic_cast from void* */
     simgrid::kernel::resource::Resource* resource =
         static_cast<simgrid::kernel::resource::Resource*>(action.get_variable()->get_constraint(i)->get_id());
-    simgrid::surf::Cpu* cpu = dynamic_cast<simgrid::surf::Cpu*>(resource);
+    simgrid::kernel::resource::Cpu* cpu = dynamic_cast<simgrid::kernel::resource::Cpu*>(resource);
 
     if (cpu != nullptr)
       TRACE_surf_resource_set_utilization("HOST", "speed_used", cpu->get_cname(), action.get_category(), value,
@@ -367,7 +367,7 @@ void instr_define_callbacks()
   }
   simgrid::s4u::NetZone::on_creation.connect(instr_netzone_on_creation);
 
-  simgrid::surf::CpuAction::on_state_change.connect(instr_action_on_state_change);
+  simgrid::kernel::resource::CpuAction::on_state_change.connect(instr_action_on_state_change);
   simgrid::s4u::Link::on_communication_state_change.connect(instr_action_on_state_change);
 
   if (TRACE_actor_is_enabled()) {
index 92a6b5c..f380c16 100644 (file)
@@ -411,10 +411,10 @@ static void on_creation(simgrid::s4u::Host& host)
   host.extension_set(new HostEnergy(&host));
 }
 
-static void on_action_state_change(simgrid::surf::CpuAction const& action,
+static void on_action_state_change(simgrid::kernel::resource::CpuAction const& action,
                                    simgrid::kernel::resource::Action::State /*previous*/)
 {
-  for (simgrid::surf::Cpu* const& cpu : action.cpus()) {
+  for (simgrid::kernel::resource::Cpu* const& cpu : action.cpus()) {
     simgrid::s4u::Host* host = cpu->get_host();
     if (host != nullptr) {
 
@@ -490,7 +490,7 @@ void sg_host_energy_plugin_init()
   simgrid::s4u::Host::on_speed_change.connect(&on_host_change);
   simgrid::s4u::Host::on_destruction.connect(&on_host_destruction);
   simgrid::s4u::on_simulation_end.connect(&on_simulation_end);
-  simgrid::surf::CpuAction::on_state_change.connect(&on_action_state_change);
+  simgrid::kernel::resource::CpuAction::on_state_change.connect(&on_action_state_change);
   // We may only have one actor on a node. If that actor executes something like
   //   compute -> recv -> compute
   // the recv operation will not trigger a "CpuAction::on_state_change". This means
index a461371..9e20699 100644 (file)
@@ -23,8 +23,8 @@ namespace vm {
 /*************
  * Callbacks *
  *************/
-simgrid::xbt::signal<void(VirtualMachineImpl&)> VirtualMachineImpl::on_creation;
-simgrid::xbt::signal<void(VirtualMachineImpl const&)> VirtualMachineImpl::on_destruction;
+xbt::signal<void(VirtualMachineImpl&)> VirtualMachineImpl::on_creation;
+xbt::signal<void(VirtualMachineImpl const&)> VirtualMachineImpl::on_destruction;
 
 /*********
  * Model *
@@ -115,7 +115,7 @@ double VMModel::next_occuring_event(double now)
 
   /* iterate for all virtual machines */
   for (s4u::VirtualMachine* const& ws_vm : VirtualMachineImpl::allVms_) {
-    surf::Cpu* cpu = ws_vm->pimpl_cpu;
+    kernel::resource::Cpu* cpu = ws_vm->pimpl_cpu;
 
     double solved_value =
         ws_vm->get_impl()->action_->get_variable()->get_value(); // this is X1 in comment above, what
@@ -266,8 +266,8 @@ void VirtualMachineImpl::set_physical_host(s4u::Host* destination)
 
   /* Update vcpu's action for the new pm */
   /* create a cpu action bound to the pm model at the destination. */
-  surf::CpuAction* new_cpu_action =
-      static_cast<surf::CpuAction*>(destination->pimpl_cpu->execution_start(0, this->core_amount_));
+  kernel::resource::CpuAction* new_cpu_action =
+      static_cast<kernel::resource::CpuAction*>(destination->pimpl_cpu->execution_start(0, this->core_amount_));
 
   if (action_->get_remains_no_update() > 0)
     XBT_CRITICAL("FIXME: need copy the state(?), %f", action_->get_remains_no_update());
index 1508df7..0301e45 100644 (file)
@@ -56,19 +56,19 @@ void surf_cpu_model_init_Cas01()
 namespace simgrid {
 namespace surf {
 
-CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid::surf::CpuModel(algo)
+CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : kernel::resource::CpuModel(algo)
 {
   all_existing_models.push_back(this);
 
-  bool select = simgrid::config::get_value<bool>("cpu/maxmin-selective-update");
+  bool select = config::get_value<bool>("cpu/maxmin-selective-update");
 
   if (algo == Model::UpdateAlgo::LAZY) {
-    xbt_assert(select || simgrid::config::is_default("cpu/maxmin-selective-update"),
+    xbt_assert(select || config::is_default("cpu/maxmin-selective-update"),
                "You cannot disable cpu selective update when using the lazy update mechanism");
     select = true;
   }
 
-  set_maxmin_system(new simgrid::kernel::lmm::System(select));
+  set_maxmin_system(new kernel::lmm::System(select));
 }
 
 CpuCas01Model::~CpuCas01Model()
@@ -76,7 +76,7 @@ CpuCas01Model::~CpuCas01Model()
   surf_cpu_model_pm = nullptr;
 }
 
-Cpu* CpuCas01Model::create_cpu(simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
+kernel::resource::Cpu* CpuCas01Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
 {
   return new CpuCas01(this, host, speed_per_pstate, core);
 }
@@ -84,8 +84,7 @@ Cpu* CpuCas01Model::create_cpu(simgrid::s4u::Host* host, const std::vector<doubl
 /************
  * Resource *
  ************/
-CpuCas01::CpuCas01(CpuCas01Model* model, simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate,
-                   int core)
+CpuCas01::CpuCas01(CpuCas01Model* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
     : Cpu(model, host, model->get_maxmin_system()->constraint_new(this, core * speed_per_pstate.front()),
           speed_per_pstate, core)
 {
@@ -162,18 +161,18 @@ void CpuCas01::apply_event(kernel::profile::Event* event, double value)
 }
 
 /** @brief Start a new execution on this CPU lasting @param size flops and using one core */
-CpuAction* CpuCas01::execution_start(double size)
+kernel::resource::CpuAction* CpuCas01::execution_start(double size)
 {
   return new CpuCas01Action(get_model(), size, not is_on(), speed_.scale * speed_.peak, get_constraint());
 }
 
-CpuAction* CpuCas01::execution_start(double size, int requested_cores)
+kernel::resource::CpuAction* CpuCas01::execution_start(double size, int requested_cores)
 {
   return new CpuCas01Action(get_model(), size, not is_on(), speed_.scale * speed_.peak, get_constraint(),
                             requested_cores);
 }
 
-CpuAction* CpuCas01::sleep(double duration)
+kernel::resource::CpuAction* CpuCas01::sleep(double duration)
 {
   if (duration > 0)
     duration = std::max(duration, sg_surf_precision);
index 67ed574..0656d22 100644 (file)
@@ -21,30 +21,30 @@ class XBT_PRIVATE CpuCas01Action;
  * Model *
  *********/
 
-class CpuCas01Model : public simgrid::surf::CpuModel {
+class CpuCas01Model : public kernel::resource::CpuModel {
 public:
   explicit CpuCas01Model(kernel::resource::Model::UpdateAlgo algo);
   CpuCas01Model(const CpuCas01Model&) = delete;
   CpuCas01Model& operator=(const CpuCas01Model&) = delete;
   ~CpuCas01Model() override;
 
-  Cpu* create_cpu(simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
+  kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
 };
 
 /************
  * Resource *
  ************/
 
-class CpuCas01 : public Cpu {
+class CpuCas01 : public kernel::resource::Cpu {
 public:
   CpuCas01(CpuCas01Model* model, simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core);
   CpuCas01(const CpuCas01&) = delete;
   CpuCas01& operator=(const CpuCas01&) = delete;
   ~CpuCas01() override;
   void apply_event(simgrid::kernel::profile::Event* event, double value) override;
-  CpuAction* execution_start(double size) override;
-  CpuAction* execution_start(double size, int requested_cores) override;
-  CpuAction* sleep(double duration) override;
+  kernel::resource::CpuAction* execution_start(double size) override;
+  kernel::resource::CpuAction* execution_start(double size, int requested_cores) override;
+  kernel::resource::CpuAction* sleep(double duration) override;
 
   bool is_used() override;
 
@@ -55,9 +55,10 @@ protected:
 /**********
  * Action *
  **********/
-class CpuCas01Action: public CpuAction {
-  friend CpuAction *CpuCas01::execution_start(double size);
-  friend CpuAction *CpuCas01::sleep(double duration);
+class CpuCas01Action : public kernel::resource::CpuAction {
+  friend kernel::resource::CpuAction* CpuCas01::execution_start(double size);
+  friend kernel::resource::CpuAction* CpuCas01::sleep(double duration);
+
 public:
   CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
                  kernel::lmm::Constraint* constraint, int core_count);
index 4452435..8325194 100644 (file)
 XBT_LOG_EXTERNAL_CATEGORY(surf_kernel);
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf, "Logging specific to the SURF cpu module");
 
-simgrid::surf::CpuModel *surf_cpu_model_pm;
-simgrid::surf::CpuModel *surf_cpu_model_vm;
+simgrid::kernel::resource::CpuModel* surf_cpu_model_pm;
+simgrid::kernel::resource::CpuModel* surf_cpu_model_vm;
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
 /*********
  * Model *
@@ -43,7 +44,7 @@ void CpuModel::update_actions_state_full(double /*now*/, double delta)
 
     if (((action.get_remains_no_update() <= 0) && (action.get_variable()->get_weight() > 0)) ||
         ((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
-      action.finish(kernel::resource::Action::State::FINISHED);
+      action.finish(Action::State::FINISHED);
     }
   }
 }
@@ -51,14 +52,13 @@ void CpuModel::update_actions_state_full(double /*now*/, double delta)
 /************
  * Resource *
  ************/
-Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate,
-         int core)
+Cpu::Cpu(Model* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
     : Cpu(model, host, nullptr /*constraint*/, speed_per_pstate, core)
 {
 }
 
-Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, kernel::lmm::Constraint* constraint,
-         const std::vector<double>& speed_per_pstate, int core)
+Cpu::Cpu(Model* model, s4u::Host* host, lmm::Constraint* constraint, const std::vector<double>& speed_per_pstate,
+         int core)
     : Resource(model, host->get_cname(), constraint)
     , core_count_(core)
     , host_(host)
@@ -157,7 +157,7 @@ void CpuAction::update_remains_lazy(double now)
   set_last_value(get_variable()->get_value());
 }
 
-simgrid::xbt::signal<void(simgrid::surf::CpuAction const&, kernel::resource::Action::State)> CpuAction::on_state_change;
+xbt::signal<void(CpuAction const&, Action::State)> CpuAction::on_state_change;
 
 void CpuAction::suspend(){
   Action::State previous = get_state();
@@ -187,8 +187,7 @@ std::list<Cpu*> CpuAction::cpus() const
   for (int i = 0; i < llen; i++) {
     /* Beware of composite actions: ptasks put links and cpus together */
     // extra pb: we cannot dynamic_cast from void*...
-    kernel::resource::Resource* resource =
-        static_cast<kernel::resource::Resource*>(get_variable()->get_constraint(i)->get_id());
+    Resource* resource = static_cast<Resource*>(get_variable()->get_constraint(i)->get_id());
     Cpu* cpu           = dynamic_cast<Cpu*>(resource);
     if (cpu != nullptr)
       retlist.push_back(cpu);
@@ -196,6 +195,6 @@ std::list<Cpu*> CpuAction::cpus() const
 
   return retlist;
 }
-
-}
-}
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
index 7ae6e58..4b273c7 100644 (file)
  ***********/
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
- /** @ingroup SURF_cpu_interface
+/** @ingroup SURF_cpu_interface
  * @brief SURF cpu model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
-class XBT_PUBLIC CpuModel : public kernel::resource::Model {
+class XBT_PUBLIC CpuModel : public Model {
 public:
-  explicit CpuModel(kernel::resource::Model::UpdateAlgo algo) : Model(algo) {}
+  explicit CpuModel(Model::UpdateAlgo algo) : Model(algo) {}
 
   /**
    * @brief Create a Cpu
@@ -37,7 +38,7 @@ public:
    *                         This ignores any potential external load coming from a trace.
    * @param core The number of core of this Cpu
    */
-  virtual Cpu* create_cpu(simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) = 0;
+  virtual Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) = 0;
 
   void update_actions_state_lazy(double now, double delta) override;
   void update_actions_state_full(double now, double delta) override;
@@ -51,7 +52,12 @@ public:
 * @brief SURF cpu resource interface class
 * @details A Cpu represent a cpu associated to a host
 */
-class XBT_PUBLIC Cpu : public simgrid::kernel::resource::Resource {
+class XBT_PUBLIC Cpu : public Resource {
+  int core_count_ = 1;
+  s4u::Host* host_;
+  int pstate_ = 0;                             /*< Current pstate (index in the speed_per_pstate_)*/
+  const std::vector<double> speed_per_pstate_; /*< List of supported CPU capacities (pstate related) */
+
 public:
   /**
    * @brief Cpu constructor
@@ -62,8 +68,8 @@ public:
    * @param speedPerPstate Processor speed (in flop per second) for each pstate
    * @param core The number of core of this Cpu
    */
-  Cpu(simgrid::kernel::resource::Model* model, simgrid::s4u::Host* host, kernel::lmm::Constraint* constraint,
-      const std::vector<double>& speed_per_pstate, int core);
+  Cpu(Model* model, s4u::Host* host, lmm::Constraint* constraint, const std::vector<double>& speed_per_pstate,
+      int core);
 
   /**
    * @brief Cpu constructor
@@ -73,8 +79,7 @@ public:
    * @param speedPerPstate Processor speed (in flop per second) for each pstate
    * @param core The number of core of this Cpu
    */
-  Cpu(simgrid::kernel::resource::Model* model, simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate,
-      int core);
+  Cpu(Model* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core);
 
   Cpu(const Cpu&) = delete;
   Cpu& operator=(const Cpu&) = delete;
@@ -85,7 +90,7 @@ public:
    * @param size The value of the processing amount (in flop) needed to process
    * @return The CpuAction corresponding to the processing
    */
-  virtual simgrid::kernel::resource::Action* execution_start(double size) = 0;
+  virtual Action* execution_start(double size) = 0;
 
   /**
    * @brief Execute some quantity of computation on more than one core
@@ -94,7 +99,7 @@ public:
    * @param requested_cores The desired amount of cores. Must be >= 1
    * @return The CpuAction corresponding to the processing
    */
-  virtual simgrid::kernel::resource::Action* execution_start(double size, int requested_cores) = 0;
+  virtual Action* execution_start(double size, int requested_cores) = 0;
 
   /**
    * @brief Make a process sleep for duration (in seconds)
@@ -102,7 +107,7 @@ public:
    * @param duration The number of seconds to sleep
    * @return The CpuAction corresponding to the sleeping
    */
-  virtual simgrid::kernel::resource::Action* sleep(double duration) = 0;
+  virtual Action* sleep(double duration) = 0;
 
   /** @brief Get the amount of cores */
   virtual int get_core_count();
@@ -136,20 +141,12 @@ public:
   virtual void set_pstate(int pstate_index);
   virtual int get_pstate() const;
 
-  simgrid::s4u::Host* get_host() { return host_; }
+  s4u::Host* get_host() { return host_; }
 
-private:
-  int core_count_ = 1;
-  simgrid::s4u::Host* host_;
-
-  int pstate_ = 0;                       /*< Current pstate (index in the speed_per_pstate_)*/
-  const std::vector<double> speed_per_pstate_; /*< List of supported CPU capacities (pstate related) */
-
-public:
   /*< @brief Setup the trace file with availability events (peak speed changes due to external load).
    * Trace must contain relative values (ratio between 0 and 1)
    */
-  virtual void set_speed_profile(kernel::profile::Profile* profile);
+  virtual void set_speed_profile(profile::Profile* profile);
 
 protected:
   Metric speed_                  = {1.0, 0, nullptr};
@@ -162,21 +159,17 @@ protected:
  /** @ingroup SURF_cpu_interface
  * @brief A CpuAction represents the execution of code on one or several Cpus
  */
-class XBT_PUBLIC CpuAction : public simgrid::kernel::resource::Action {
+class XBT_PUBLIC CpuAction : public Action {
 public:
   /** @brief Signal emitted when the action state changes (ready/running/done, etc)
    *  Signature: `void(CpuAction const& action, simgrid::kernel::resource::Action::State previous)`
    */
-  static simgrid::xbt::signal<void(simgrid::surf::CpuAction const&, simgrid::kernel::resource::Action::State)>
-      on_state_change;
+  static xbt::signal<void(CpuAction const&, Action::State)> on_state_change;
 
-  CpuAction(simgrid::kernel::resource::Model * model, double cost, bool failed) : Action(model, cost, failed) {}
-  CpuAction(simgrid::kernel::resource::Model * model, double cost, bool failed, kernel::lmm::Variable* var)
-      : Action(model, cost, failed, var)
-  {
-  }
+  CpuAction(Model* model, double cost, bool failed) : Action(model, cost, failed) {}
+  CpuAction(Model* model, double cost, bool failed, lmm::Variable* var) : Action(model, cost, failed, var) {}
 
-  void set_state(simgrid::kernel::resource::Action::State state) override;
+  void set_state(Action::State state) override;
 
   void update_remains_lazy(double now) override;
   std::list<Cpu*> cpus() const;
@@ -184,8 +177,8 @@ public:
   void suspend() override;
   void resume() override;
 };
-
-}
-}
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
 
 #endif /* SURF_CPU_INTERFACE_HPP_ */
index 05556af..fe41d41 100644 (file)
@@ -312,7 +312,7 @@ CpuTiModel::~CpuTiModel()
   surf_cpu_model_pm = nullptr;
 }
 
-Cpu* CpuTiModel::create_cpu(simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
+kernel::resource::Cpu* CpuTiModel::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
 {
   return new CpuTi(this, host, speed_per_pstate, core);
 }
@@ -535,7 +535,7 @@ void CpuTi::update_remaining_amount(double now)
   last_update_ = now;
 }
 
-CpuAction *CpuTi::execution_start(double size)
+kernel::resource::CpuAction* CpuTi::execution_start(double size)
 {
   XBT_IN("(%s,%g)", get_cname(), size);
   CpuTiAction* action = new CpuTiAction(this, size);
@@ -546,8 +546,7 @@ CpuAction *CpuTi::execution_start(double size)
   return action;
 }
 
-
-CpuAction *CpuTi::sleep(double duration)
+kernel::resource::CpuAction* CpuTi::sleep(double duration)
 {
   if (duration > 0)
     duration = std::max(duration, sg_surf_precision);
index f3cafa7..8451889 100644 (file)
@@ -73,7 +73,7 @@ private:
  * Action *
  **********/
 
-class XBT_PRIVATE CpuTiAction : public CpuAction {
+class XBT_PRIVATE CpuTiAction : public kernel::resource::CpuAction {
   friend class CpuTi;
 public:
   CpuTiAction(CpuTi* cpu, double cost);
@@ -100,9 +100,9 @@ typedef boost::intrusive::list<CpuTiAction, ActionTiListOptions > ActionTiList;
 /************
  * Resource *
  ************/
-class CpuTi : public Cpu {
+class CpuTi : public kernel::resource::Cpu {
 public:
-  CpuTi(CpuTiModel* model, simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core);
+  CpuTi(CpuTiModel* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core);
   CpuTi(const CpuTi&)            = delete;
   CpuTi& operator&(const CpuTi&) = delete;
   ~CpuTi() override;
@@ -114,13 +114,13 @@ public:
   void update_remaining_amount(double now);
 
   bool is_used() override;
-  CpuAction *execution_start(double size) override;
+  kernel::resource::CpuAction* execution_start(double size) override;
   kernel::resource::Action* execution_start(double, int) override
   {
     THROW_UNIMPLEMENTED;
     return nullptr;
   }
-  CpuAction *sleep(double duration) override;
+  kernel::resource::CpuAction* sleep(double duration) override;
   double get_speed_ratio() override;
 
   void set_modified(bool modified);
@@ -139,7 +139,7 @@ typedef boost::intrusive::list<CpuTi, CpuTiListOptions> CpuTiList;
 /*********
  * Model *
  *********/
-class CpuTiModel : public CpuModel {
+class CpuTiModel : public kernel::resource::CpuModel {
 public:
   static void create_pm_vm_models(); // Make both models be TI models
 
@@ -147,14 +147,14 @@ public:
   CpuTiModel(const CpuTiModel&) = delete;
   CpuTiModel& operator=(const CpuTiModel&) = delete;
   ~CpuTiModel() override;
-  Cpu* create_cpu(simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
+  kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
   double next_occuring_event(double now) override;
   void update_actions_state(double now, double delta) override;
 
   CpuTiList modified_cpus_;
 };
 
-}
-}
+} // namespace surf
+} // namespace simgrid
 
 #endif /* SURF_MODEL_CPUTI_H_ */
index c3dbfc0..a83d5e5 100644 (file)
@@ -33,8 +33,8 @@ namespace resource {
  */
 class NetworkModel : public Model {
 public:
-  static simgrid::config::Flag<double> cfg_tcp_gamma;
-  static simgrid::config::Flag<bool> cfg_crosstraffic;
+  static config::Flag<double> cfg_tcp_gamma;
+  static config::Flag<bool> cfg_crosstraffic;
 
   explicit NetworkModel(Model::UpdateAlgo algo) : Model(algo) {}
   NetworkModel(const NetworkModel&) = delete;
@@ -54,24 +54,21 @@ public:
 
   /**
    * @brief Create a communication between two hosts.
-   * @details It makes calls to the routing part, and execute the communication
-   *          between the two end points.
+   * @details It makes calls to the routing part, and execute the communication between the two end points.
    *
    * @param src The source of the communication
    * @param dst The destination of the communication
    * @param size The size of the communication in bytes
-   * @param rate Allows to limit the transfer rate. Negative value means
-   * unlimited.
+   * @param rate Allows to limit the transfer rate. Negative value means unlimited.
    * @return The action representing the communication
    */
   virtual Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) = 0;
 
   /**
    * @brief Get the right multiplicative factor for the latency.
-   * @details Depending on the model, the effective latency when sending
-   * a message might be different from the theoretical latency of the link,
-   * in function of the message size. In order to account for this, this
-   * function gets this factor.
+   * @details Depending on the model, the effective latency when sending a message might be different from the
+   * theoretical latency of the link, in function of the message size. In order to account for this, this function gets
+   * this factor.
    *
    * @param size The size of the message.
    * @return The latency factor.
@@ -80,10 +77,9 @@ public:
 
   /**
    * @brief Get the right multiplicative factor for the bandwidth.
-   * @details Depending on the model, the effective bandwidth when sending
-   * a message might be different from the theoretical bandwidth of the link,
-   * in function of the message size. In order to account for this, this
-   * function gets this factor.
+   * @details Depending on the model, the effective bandwidth when sending a message might be different from the
+   * theoretical bandwidth of the link, in function of the message size. In order to account for this, this function
+   * gets this factor.
    *
    * @param size The size of the message.
    * @return The bandwidth factor.
@@ -92,8 +88,8 @@ public:
 
   /**
    * @brief Get definitive bandwidth.
-   * @details It gives the minimum bandwidth between the one that would
-   * occur if no limitation was enforced, and the one arbitrary limited.
+   * @details It gives the minimum bandwidth between the one that would occur if no limitation was enforced, and the
+   * one arbitrary limited.
    * @param rate The desired maximum bandwidth.
    * @param bound The bandwidth with only the network taken into account.
    * @param size The size of the message.
@@ -112,7 +108,10 @@ public:
  * @brief SURF network link interface class
  * @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
  */
-class LinkImpl : public Resource, public simgrid::surf::PropertyHolder {
+class LinkImpl : public Resource, public surf::PropertyHolder {
+  bool currently_destroying_ = false;
+  void* userdata_            = nullptr;
+
 protected:
   LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint* constraint);
   LinkImpl(const LinkImpl&) = delete;
@@ -121,10 +120,9 @@ protected:
 
 public:
   void destroy(); // Must be called instead of the destructor
-private:
-  bool currently_destroying_ = false;
+  void* get_data() { return userdata_; }
+  void set_data(void* d) { userdata_ = d; }
 
-public:
   /** @brief Public interface */
   s4u::Link piface_;
 
@@ -163,11 +161,6 @@ public:
   Metric latency_                   = {1.0, 0, nullptr};
   Metric bandwidth_                 = {1.0, 0, nullptr};
 
-  /* User data */
-  void* get_data() { return userdata_; }
-  void set_data(void* d) { userdata_ = d; }
-private:
-  void* userdata_ = nullptr;
 };
 
 /**********
@@ -205,9 +198,10 @@ public:
   double weight_     = {};
   double rate_       = {};
 };
-}
-}
+} // namespace resource
+} // namespace kernel
 } // namespace simgrid
+
 /** @ingroup SURF_models
  *  @brief The network model
  */
index 2be272c..19e985e 100644 (file)
@@ -218,7 +218,7 @@ kernel::resource::Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host
   return res;
 }
 
-Cpu* CpuL07Model::create_cpu(simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
+kernel::resource::Cpu* CpuL07Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
 {
   return new CpuL07(this, host, speed_per_pstate, core);
 }
index edc2fb2..568618a 100644 (file)
@@ -46,14 +46,14 @@ public:
                                              const double* bytes_amount, double rate) override;
 };
 
-class CpuL07Model : public CpuModel {
+class CpuL07Model : public kernel::resource::CpuModel {
 public:
   CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
   CpuL07Model(const CpuL07Model&) = delete;
   CpuL07Model& operator=(const CpuL07Model&) = delete;
   ~CpuL07Model();
 
-  Cpu* create_cpu(simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
+  kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
   HostL07Model *hostModel_;
 };
 
@@ -75,7 +75,7 @@ public:
  * Resource *
  ************/
 
-class CpuL07 : public Cpu {
+class CpuL07 : public kernel::resource::Cpu {
 public:
   CpuL07(CpuL07Model* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core);
   CpuL07(const CpuL07&) = delete;
@@ -111,7 +111,7 @@ public:
 /**********
  * Action *
  **********/
-class L07Action : public CpuAction {
+class L07Action : public kernel::resource::CpuAction {
   friend Action *CpuL07::execution_start(double size);
   friend Action *CpuL07::sleep(double duration);
   friend Action* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
@@ -140,7 +140,7 @@ private:
                              // exec and regular comms
 };
 
-}
-}
+} // namespace surf
+} // namespace simgrid
 
 #endif /* HOST_L07_HPP_ */
index bbea348..e729a52 100644 (file)
@@ -86,7 +86,7 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args)
     host->pimpl_cpu->set_speed_profile(args->speed_trace);
   if (args->pstate != 0)
     host->pimpl_cpu->set_pstate(args->pstate);
-  if (args->coord && strcmp(args->coord, ""))
+  if (not args->coord.empty())
     new simgrid::kernel::routing::vivaldi::Coords(host->pimpl_netpoint, args->coord);
 }
 
index 0ab1fa2..e321afc 100644 (file)
@@ -39,7 +39,7 @@ struct HostCreationArgs {
   int core_amount          = 0;
   profile::Profile* speed_trace                            = nullptr;
   profile::Profile* state_trace                            = nullptr;
-  const char* coord        = nullptr;
+  std::string coord                                        = "";
   std::unordered_map<std::string, std::string>* properties = nullptr;
 };
 
index 8fb038a..f95634f 100644 (file)
@@ -107,7 +107,7 @@ void parse_platform_file(const std::string& file)
 
     simgrid::s4u::Host* host = simgrid::s4u::Host::by_name_or_null(elm.second);
     xbt_assert(host, "Host %s undefined", elm.second.c_str());
-    simgrid::surf::Cpu* cpu = host->pimpl_cpu;
+    simgrid::kernel::resource::Cpu* cpu = host->pimpl_cpu;
 
     cpu->set_state_profile(profile);
   }
@@ -118,7 +118,7 @@ void parse_platform_file(const std::string& file)
 
     simgrid::s4u::Host* host = simgrid::s4u::Host::by_name_or_null(elm.second);
     xbt_assert(host, "Host %s undefined", elm.second.c_str());
-    simgrid::surf::Cpu* cpu = host->pimpl_cpu;
+    simgrid::kernel::resource::Cpu* cpu = host->pimpl_cpu;
 
     cpu->set_speed_profile(profile);
   }