Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
also change the namespace of kernel/resource/{Action,Model}
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 11 Mar 2018 20:30:33 +0000 (21:30 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 11 Mar 2018 20:30:33 +0000 (21:30 +0100)
56 files changed:
include/simgrid/forward.h
src/include/surf/surf.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/CommImpl.hpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/ExecImpl.hpp
src/kernel/activity/SleepImpl.cpp
src/kernel/activity/SleepImpl.hpp
src/kernel/activity/SynchroIo.cpp
src/kernel/activity/SynchroIo.hpp
src/kernel/activity/SynchroRaw.cpp
src/kernel/activity/SynchroRaw.hpp
src/kernel/lmm/maxmin.cpp
src/kernel/lmm/maxmin.hpp
src/kernel/resource/Action.cpp
src/kernel/resource/Action.hpp
src/kernel/resource/Model.cpp
src/kernel/resource/Model.hpp
src/kernel/resource/Resource.cpp
src/kernel/resource/Resource.hpp
src/plugins/vm/VirtualMachineImpl.hpp
src/simdag/sd_global.cpp
src/simdag/simdag_private.hpp
src/simix/ActorImpl.cpp
src/simix/smx_global.cpp
src/simix/smx_network.cpp
src/surf/HostImpl.cpp
src/surf/HostImpl.hpp
src/surf/StorageImpl.cpp
src/surf/StorageImpl.hpp
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_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/network_ib.cpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/plugins/host_energy.cpp
src/surf/plugins/host_load.cpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/storage_n11.cpp
src/surf/storage_n11.hpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
teshsuite/surf/surf_usage/surf_usage.cpp
teshsuite/surf/surf_usage2/surf_usage2.cpp

index b13224f..772a50a 100644 (file)
@@ -48,6 +48,8 @@ class ConstraintLight;
 class System;
 }
 namespace resource {
 class System;
 }
 namespace resource {
+class Action;
+class Model;
 class Resource;
 }
 namespace routing {
 class Resource;
 }
 namespace routing {
index 4cd73e2..84b8c16 100644 (file)
 
 namespace simgrid {
 namespace surf {
 
 namespace simgrid {
 namespace surf {
-class Model;
 class CpuModel;
 class HostModel;
 class NetworkModel;
 class StorageModel;
 class NetworkCm02Link;
 class CpuModel;
 class HostModel;
 class NetworkModel;
 class StorageModel;
 class NetworkCm02Link;
-class Action;
 }
 }
 
 }
 }
 
@@ -36,20 +34,10 @@ class Action;
  *  Generic data structure for a model. The hosts,
  *  the CPUs and the network links are examples of models.
  */
  *  Generic data structure for a model. The hosts,
  *  the CPUs and the network links are examples of models.
  */
-typedef simgrid::surf::Model* surf_model_t;
 typedef simgrid::surf::CpuModel* surf_cpu_model_t;
 typedef simgrid::surf::HostModel* surf_host_model_t;
 typedef simgrid::surf::NetworkModel* surf_network_model_t;
 typedef simgrid::surf::StorageModel* surf_storage_model_t;
 typedef simgrid::surf::CpuModel* surf_cpu_model_t;
 typedef simgrid::surf::HostModel* surf_host_model_t;
 typedef simgrid::surf::NetworkModel* surf_network_model_t;
 typedef simgrid::surf::StorageModel* surf_storage_model_t;
-/** @ingroup SURF_c_bindings
- *  \brief Action structure
- *
- *  Never create s_surf_action_t by yourself ! The actions are created
- *  on the fly when you call execute or communicate on a model.
- *
- *  \see e_surf_action_state_t
- */
-typedef simgrid::surf::Action* surf_action_t;
 
 SG_BEGIN_DECL()
 /* Actions and models are highly connected structures... */
 
 SG_BEGIN_DECL()
 /* Actions and models are highly connected structures... */
@@ -85,7 +73,8 @@ XBT_PUBLIC(void) model_help(const char* category, s_surf_model_description_t* ta
  * @param model The model from which the action is extracted
  * @return An action in done state
  */
  * @param model The model from which the action is extracted
  * @return An action in done state
  */
-XBT_PUBLIC(surf_action_t) surf_model_extract_done_action_set(surf_model_t model);
+XBT_PUBLIC(simgrid::kernel::resource::Action*)
+surf_model_extract_done_action_set(simgrid::kernel::resource::Model* model);
 
 /**
  * @brief Pop an action from the failed actions set
 
 /**
  * @brief Pop an action from the failed actions set
@@ -93,7 +82,8 @@ XBT_PUBLIC(surf_action_t) surf_model_extract_done_action_set(surf_model_t model)
  * @param model The model from which the action is extracted
  * @return An action in failed state
  */
  * @param model The model from which the action is extracted
  * @return An action in failed state
  */
-XBT_PUBLIC(surf_action_t) surf_model_extract_failed_action_set(surf_model_t model);
+XBT_PUBLIC(simgrid::kernel::resource::Action*)
+surf_model_extract_failed_action_set(simgrid::kernel::resource::Model* model);
 
 /**
  * @brief Get the size of the running action set of a model
 
 /**
  * @brief Get the size of the running action set of a model
@@ -101,7 +91,7 @@ XBT_PUBLIC(surf_action_t) surf_model_extract_failed_action_set(surf_model_t mode
  * @param model The model
  * @return The size of the running action set
  */
  * @param model The model
  * @return The size of the running action set
  */
-XBT_PUBLIC(int) surf_model_running_action_set_size(surf_model_t model);
+XBT_PUBLIC(int) surf_model_running_action_set_size(simgrid::kernel::resource::Model* model);
 
 /**
  * @brief [brief description]
 
 /**
  * @brief [brief description]
@@ -110,7 +100,7 @@ XBT_PUBLIC(int) surf_model_running_action_set_size(surf_model_t model);
  * @param action The surf cpu action
  * @param bound [description]
  */
  * @param action The surf cpu action
  * @param bound [description]
  */
-XBT_PUBLIC(void) surf_cpu_action_set_bound(surf_action_t action, double bound);
+XBT_PUBLIC(void) surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound);
 
 /** @} */
 
 
 /** @} */
 
index 98be474..e811dd1 100644 (file)
@@ -97,15 +97,15 @@ void simgrid::kernel::activity::CommImpl::cleanupSurf()
 void simgrid::kernel::activity::CommImpl::post()
 {
   /* Update synchro state */
 void simgrid::kernel::activity::CommImpl::post()
 {
   /* Update synchro state */
-  if (src_timeout && src_timeout->getState() == simgrid::surf::Action::State::done)
+  if (src_timeout && src_timeout->getState() == simgrid::kernel::resource::Action::State::done)
     state = SIMIX_SRC_TIMEOUT;
     state = SIMIX_SRC_TIMEOUT;
-  else if (dst_timeout && dst_timeout->getState() == simgrid::surf::Action::State::done)
+  else if (dst_timeout && dst_timeout->getState() == simgrid::kernel::resource::Action::State::done)
     state = SIMIX_DST_TIMEOUT;
     state = SIMIX_DST_TIMEOUT;
-  else if (src_timeout && src_timeout->getState() == simgrid::surf::Action::State::failed)
+  else if (src_timeout && src_timeout->getState() == simgrid::kernel::resource::Action::State::failed)
     state = SIMIX_SRC_HOST_FAILURE;
     state = SIMIX_SRC_HOST_FAILURE;
-  else if (dst_timeout && dst_timeout->getState() == simgrid::surf::Action::State::failed)
+  else if (dst_timeout && dst_timeout->getState() == simgrid::kernel::resource::Action::State::failed)
     state = SIMIX_DST_HOST_FAILURE;
     state = SIMIX_DST_HOST_FAILURE;
-  else if (surfAction_ && surfAction_->getState() == simgrid::surf::Action::State::failed) {
+  else if (surfAction_ && surfAction_->getState() == simgrid::kernel::resource::Action::State::failed) {
     state = SIMIX_LINK_FAILURE;
   } else
     state = SIMIX_DONE;
     state = SIMIX_LINK_FAILURE;
   } else
     state = SIMIX_DONE;
index 842d407..86e44d1 100644 (file)
@@ -46,9 +46,9 @@ expectations of the other side, too. See  */
   void (*copy_data_fun)(smx_activity_t, void*, size_t) = nullptr;
 
   /* Surf action data */
   void (*copy_data_fun)(smx_activity_t, void*, size_t) = nullptr;
 
   /* Surf action data */
-  surf_action_t surfAction_ = nullptr; /* The Surf communication action encapsulated */
-  surf_action_t src_timeout = nullptr; /* Surf's actions to instrument the timeouts */
-  surf_action_t dst_timeout = nullptr; /* Surf's actions to instrument the timeouts */
+  simgrid::kernel::resource::Action* surfAction_ = nullptr; /* The Surf communication action encapsulated */
+  simgrid::kernel::resource::Action* src_timeout = nullptr; /* Surf's actions to instrument the timeouts */
+  simgrid::kernel::resource::Action* dst_timeout = nullptr; /* Surf's actions to instrument the timeouts */
   smx_actor_t src_proc      = nullptr;
   smx_actor_t dst_proc      = nullptr;
   double rate               = 0.0;
   smx_actor_t src_proc      = nullptr;
   smx_actor_t dst_proc      = nullptr;
   double rate               = 0.0;
index 097947c..9f2c205 100644 (file)
@@ -75,10 +75,10 @@ void simgrid::kernel::activity::ExecImpl::post()
                                  /* If the host running the synchro failed, notice it. This way, the asking
                                   * process can be killed if it runs on that host itself */
     state = SIMIX_FAILED;
                                  /* If the host running the synchro failed, notice it. This way, the asking
                                   * process can be killed if it runs on that host itself */
     state = SIMIX_FAILED;
-  } else if (surfAction_->getState() == simgrid::surf::Action::State::failed) {
+  } else if (surfAction_->getState() == simgrid::kernel::resource::Action::State::failed) {
     /* If the host running the synchro didn't fail, then the synchro was canceled */
     state = SIMIX_CANCELED;
     /* If the host running the synchro didn't fail, then the synchro was canceled */
     state = SIMIX_CANCELED;
-  } else if (timeoutDetector && timeoutDetector->getState() == simgrid::surf::Action::State::done) {
+  } else if (timeoutDetector && timeoutDetector->getState() == simgrid::kernel::resource::Action::State::done) {
     state = SIMIX_TIMEOUT;
   } else {
     state = SIMIX_DONE;
     state = SIMIX_TIMEOUT;
   } else {
     state = SIMIX_DONE;
@@ -104,8 +104,8 @@ simgrid::kernel::activity::ExecImpl::migrate(simgrid::s4u::Host* to)
 {
 
   if (not MC_is_active() && not MC_record_replay_is_active()) {
 {
 
   if (not MC_is_active() && not MC_record_replay_is_active()) {
-    surf_action_t oldAction = this->surfAction_;
-    surf_action_t newAction = to->pimpl_cpu->execution_start(oldAction->getCost());
+    simgrid::kernel::resource::Action* oldAction = this->surfAction_;
+    simgrid::kernel::resource::Action* newAction = to->pimpl_cpu->execution_start(oldAction->getCost());
     newAction->setRemains(oldAction->getRemains());
     newAction->setData(this);
     newAction->setSharingWeight(oldAction->getPriority());
     newAction->setRemains(oldAction->getRemains());
     newAction->setData(this);
     newAction->setSharingWeight(oldAction->getPriority());
index 24f8467..4b11447 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
 
 /* 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. */
@@ -29,8 +29,8 @@ public:
 
   /* The host where the execution takes place. nullptr means this is a parallel exec (and only surf knows the hosts) */
   sg_host_t host_               = nullptr;
 
   /* The host where the execution takes place. nullptr means this is a parallel exec (and only surf knows the hosts) */
   sg_host_t host_               = nullptr;
-  surf_action_t surfAction_     = nullptr; /* The Surf execution action encapsulated */
-  surf::Action* timeoutDetector = nullptr;
+  kernel::resource::Action* surfAction_     = nullptr; /* The Surf execution action encapsulated */
+  kernel::resource::Action* timeoutDetector = nullptr;
   static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> onCreation;
   static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> onCompletion;
   static simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr, simgrid::s4u::Host*)> onMigration;
   static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> onCreation;
   static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> onCompletion;
   static simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr, simgrid::s4u::Host*)> onMigration;
index c4a452b..c8f76b3 100644 (file)
@@ -33,12 +33,12 @@ void simgrid::kernel::activity::SleepImpl::post()
 
     e_smx_state_t result;
     switch (surf_sleep->getState()) {
 
     e_smx_state_t result;
     switch (surf_sleep->getState()) {
-      case simgrid::surf::Action::State::failed:
+      case simgrid::kernel::resource::Action::State::failed:
         simcall->issuer->context->iwannadie = 1;
         result                              = SIMIX_SRC_HOST_FAILURE;
         break;
 
         simcall->issuer->context->iwannadie = 1;
         result                              = SIMIX_SRC_HOST_FAILURE;
         break;
 
-      case simgrid::surf::Action::State::done:
+      case simgrid::kernel::resource::Action::State::done:
         result = SIMIX_DONE;
         break;
 
         result = SIMIX_DONE;
         break;
 
index 5441f61..38c781f 100644 (file)
@@ -21,7 +21,7 @@ public:
   void post() override;
 
   sg_host_t host           = nullptr; /* The host that is sleeping */
   void post() override;
 
   sg_host_t host           = nullptr; /* The host that is sleeping */
-  surf_action_t surf_sleep = nullptr; /* The Surf sleeping action encapsulated */
+  simgrid::kernel::resource::Action* surf_sleep = nullptr; /* The Surf sleeping action encapsulated */
 };
 }
 }
 };
 }
 }
index abd8302..5d7c25d 100644 (file)
@@ -36,10 +36,10 @@ void simgrid::kernel::activity::IoImpl::post()
   }
 
   switch (surf_io->getState()) {
   }
 
   switch (surf_io->getState()) {
-    case simgrid::surf::Action::State::failed:
+    case simgrid::kernel::resource::Action::State::failed:
       state = SIMIX_FAILED;
       break;
       state = SIMIX_FAILED;
       break;
-    case simgrid::surf::Action::State::done:
+    case simgrid::kernel::resource::Action::State::done:
       state = SIMIX_DONE;
       break;
     default:
       state = SIMIX_DONE;
       break;
     default:
index f827ac6..b7f7e1b 100644 (file)
@@ -20,7 +20,7 @@ public:
   void resume() override;
   void post() override;
 
   void resume() override;
   void post() override;
 
-  surf_action_t surf_io = nullptr;
+  simgrid::kernel::resource::Action* surf_io = nullptr;
   };
 
 }}} // namespace simgrid::kernel::activity
   };
 
 }}} // namespace simgrid::kernel::activity
index e6db37c..3d60634 100644 (file)
@@ -27,9 +27,9 @@ void simgrid::kernel::activity::RawImpl::resume()
 void simgrid::kernel::activity::RawImpl::post()
 {
   XBT_IN("(%p)",this);
 void simgrid::kernel::activity::RawImpl::post()
 {
   XBT_IN("(%p)",this);
-  if (sleep->getState() == simgrid::surf::Action::State::failed)
+  if (sleep->getState() == simgrid::kernel::resource::Action::State::failed)
     state = SIMIX_FAILED;
     state = SIMIX_FAILED;
-  else if(sleep->getState() == simgrid::surf::Action::State::done)
+  else if (sleep->getState() == simgrid::kernel::resource::Action::State::done)
     state = SIMIX_SRC_TIMEOUT;
 
   SIMIX_synchro_finish(this);
     state = SIMIX_SRC_TIMEOUT;
 
   SIMIX_synchro_finish(this);
index d416f90..eaa8e9c 100644 (file)
@@ -22,7 +22,7 @@ public:
   void resume() override;
   void post() override;
 
   void resume() override;
   void post() override;
 
-  surf_action_t sleep = nullptr;
+  simgrid::kernel::resource::Action* sleep = nullptr;
   };
 
 }}} // namespace simgrid::kernel::activity
   };
 
 }}} // namespace simgrid::kernel::activity
index 876d72d..b9c5b41 100644 (file)
@@ -212,7 +212,7 @@ void System::variable_mallocator_free_f(void* var)
   delete static_cast<Variable*>(var);
 }
 
   delete static_cast<Variable*>(var);
 }
 
-Variable* System::variable_new(simgrid::surf::Action* id, double sharing_weight, double bound,
+Variable* System::variable_new(simgrid::kernel::resource::Action* id, double sharing_weight, double bound,
                                int number_of_constraints)
 {
   XBT_IN("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)", this, id, sharing_weight, bound, number_of_constraints);
                                int number_of_constraints)
 {
   XBT_IN("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)", this, id, sharing_weight, bound, number_of_constraints);
@@ -535,7 +535,7 @@ template <class CnstList> void System::solve(CnstList& cnst_list)
           cnst.usage = elem.consumption_weight / elem.variable->sharing_weight;
 
         elem.make_active();
           cnst.usage = elem.consumption_weight / elem.variable->sharing_weight;
 
         elem.make_active();
-        simgrid::surf::Action* action = static_cast<simgrid::surf::Action*>(elem.variable->id);
+        simgrid::kernel::resource::Action* action = static_cast<simgrid::kernel::resource::Action*>(elem.variable->id);
         if (keep_track && not action->isLinkedModifiedSet())
           keep_track->push_back(*action);
       }
         if (keep_track && not action->isLinkedModifiedSet())
           keep_track->push_back(*action);
       }
@@ -712,7 +712,7 @@ void System::update_variable_bound(Variable* var, double bound)
     update_modified_set(var->cnsts[0].constraint);
 }
 
     update_modified_set(var->cnsts[0].constraint);
 }
 
-void Variable::initialize(simgrid::surf::Action* id_value, double sharing_weight_value, double bound_value,
+void Variable::initialize(simgrid::kernel::resource::Action* id_value, double sharing_weight_value, double bound_value,
                           int number_of_constraints, unsigned visited_value)
 {
   id     = id_value;
                           int number_of_constraints, unsigned visited_value)
 {
   id     = id_value;
index 6c08ad0..d0930c0 100644 (file)
@@ -337,7 +337,7 @@ private:
 XBT_PUBLIC_CLASS Variable
 {
 public:
 XBT_PUBLIC_CLASS Variable
 {
 public:
-  void initialize(simgrid::surf::Action* id_value, double sharing_weight_value, double bound_value,
+  void initialize(simgrid::kernel::resource::Action * id_value, double sharing_weight_value, double bound_value,
                   int number_of_constraints, unsigned visited_value);
 
   /**
                   int number_of_constraints, unsigned visited_value);
 
   /**
@@ -382,7 +382,7 @@ public:
    * @brief Get the data associated to a variable
    * @return The data associated to the variable
    */
    * @brief Get the data associated to a variable
    * @return The data associated to the variable
    */
-  simgrid::surf::Action* get_id() const { return id; }
+  simgrid::kernel::resource::Action* get_id() const { return id; }
 
   /**
    * @brief Get the weight of a variable
 
   /**
    * @brief Get the weight of a variable
@@ -415,7 +415,7 @@ public:
   double bound;
   double value;
   short int concurrency_share; /* The maximum number of elements that variable will add to a constraint */
   double bound;
   double value;
   short int concurrency_share; /* The maximum number of elements that variable will add to a constraint */
-  simgrid::surf::Action* id;
+  simgrid::kernel::resource::Action* id;
   int id_int;
   unsigned visited; /* used by System::update_modified_set() */
   /* \begin{For Lagrange only} */
   int id_int;
   unsigned visited; /* used by System::update_modified_set() */
   /* \begin{For Lagrange only} */
@@ -468,7 +468,8 @@ public:
    * @param bound The maximum value of the variable (-1.0 if no maximum value)
    * @param number_of_constraints The maximum number of constraint to associate to the variable
    */
    * @param bound The maximum value of the variable (-1.0 if no maximum value)
    * @param number_of_constraints The maximum number of constraint to associate to the variable
    */
-  Variable* variable_new(simgrid::surf::Action * id, double weight_value, double bound, int number_of_constraints);
+  Variable* variable_new(simgrid::kernel::resource::Action * id, double weight_value, double bound,
+                         int number_of_constraints);
 
   /**
    * @brief Free a variable
 
   /**
    * @brief Free a variable
@@ -604,7 +605,7 @@ public:
                                                                    &Constraint::saturated_constraint_set_hook>>
       saturated_constraint_set;
 
                                                                    &Constraint::saturated_constraint_set_hook>>
       saturated_constraint_set;
 
-  simgrid::surf::ActionLmmListPtr keep_track;
+  simgrid::kernel::resource::ActionLmmListPtr keep_track;
 
   void (*solve_fun)(lmm_system_t self);
 
 
   void (*solve_fun)(lmm_system_t self);
 
index 69c3729..fac7b4a 100644 (file)
@@ -11,11 +11,14 @@ XBT_LOG_NEW_CATEGORY(kernel, "Logging specific to the internals of SimGrid");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(resource, kernel, "Logging specific to the resources");
 
 namespace simgrid {
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(resource, kernel, "Logging specific to the resources");
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
 
-Action::Action(simgrid::surf::Model* model, double cost, bool failed) : Action(model, cost, failed, nullptr) {}
+Action::Action(simgrid::kernel::resource::Model* model, double cost, bool failed) : Action(model, cost, failed, nullptr)
+{
+}
 
 
-Action::Action(simgrid::surf::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
+Action::Action(simgrid::kernel::resource::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
     : remains_(cost), start_(surf_get_clock()), cost_(cost), model_(model), variable_(var)
 {
   if (failed)
     : remains_(cost), start_(surf_get_clock()), cost_(cost), model_(model), variable_(var)
 {
   if (failed)
@@ -226,3 +229,4 @@ double Action::getRemains()
 
 } // namespace surf
 } // namespace simgrid
 
 } // namespace surf
 } // namespace simgrid
+} // namespace simgrid
index c5595b8..827fccf 100644 (file)
@@ -9,9 +9,10 @@
 #include "src/surf/surf_interface.hpp"
 
 namespace simgrid {
 #include "src/surf/surf_interface.hpp"
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
 
-typedef std::pair<double, simgrid::surf::Action*> heap_element_type;
+typedef std::pair<double, simgrid::kernel::resource::Action*> heap_element_type;
 typedef boost::heap::pairing_heap<heap_element_type, boost::heap::constant_time_size<false>, boost::heap::stable<true>,
                                   boost::heap::compare<simgrid::xbt::HeapComparator<heap_element_type>>>
     heap_type;
 typedef boost::heap::pairing_heap<heap_element_type, boost::heap::constant_time_size<false>, boost::heap::stable<true>,
                                   boost::heap::compare<simgrid::xbt::HeapComparator<heap_element_type>>>
     heap_type;
@@ -59,7 +60,7 @@ public:
    * @param cost The cost of the Action
    * @param failed If the action is impossible (e.g.: execute something on a switched off host)
    */
    * @param cost The cost of the Action
    * @param failed If the action is impossible (e.g.: execute something on a switched off host)
    */
-  Action(simgrid::surf::Model * model, double cost, bool failed);
+  Action(simgrid::kernel::resource::Model * model, double cost, bool failed);
 
   /**
    * @brief Action constructor
 
   /**
    * @brief Action constructor
@@ -69,20 +70,20 @@ public:
    * @param failed If the action is impossible (e.g.: execute something on a switched off host)
    * @param var The lmm variable associated to this Action if it is part of a LMM component
    */
    * @param failed If the action is impossible (e.g.: execute something on a switched off host)
    * @param var The lmm variable associated to this Action if it is part of a LMM component
    */
-  Action(simgrid::surf::Model * model, double cost, bool failed, kernel::lmm::Variable* var);
+  Action(simgrid::kernel::resource::Model * model, double cost, bool failed, kernel::lmm::Variable* var);
 
   virtual ~Action();
 
   /**
    * @brief Mark that the action is now finished
    *
 
   virtual ~Action();
 
   /**
    * @brief Mark that the action is now finished
    *
-   * @param state the new [state](\ref simgrid::surf::Action::State) of the current Action
+   * @param state the new [state](\ref simgrid::kernel::resource::Action::State) of the current Action
    */
   void finish(Action::State state);
 
    */
   void finish(Action::State state);
 
-  /** @brief Get the [state](\ref simgrid::surf::Action::State) of the current Action */
+  /** @brief Get the [state](\ref simgrid::kernel::resource::Action::State) of the current Action */
   Action::State getState() const; /**< get the state*/
   Action::State getState() const; /**< get the state*/
-  /** @brief Set the [state](\ref simgrid::surf::Action::State) of the current Action */
+  /** @brief Set the [state](\ref simgrid::kernel::resource::Action::State) of the current Action */
   virtual void setState(Action::State state);
 
   /** @brief Get the bound of the current Action */
   virtual void setState(Action::State state);
 
   /** @brief Get the bound of the current Action */
@@ -161,7 +162,7 @@ public:
   /** @brief Get the state set in which the action is */
   ActionList* getStateSet() const { return stateSet_; };
 
   /** @brief Get the state set in which the action is */
   ActionList* getStateSet() const { return stateSet_; };
 
-  simgrid::surf::Model* getModel() const { return model_; }
+  simgrid::kernel::resource::Model* getModel() const { return model_; }
 
 protected:
   ActionList* stateSet_;
 
 protected:
   ActionList* stateSet_;
@@ -177,7 +178,7 @@ private:
       -1; /**< finish time : this is modified during the run and fluctuates until the task is completed */
 
   double cost_;
       -1; /**< finish time : this is modified during the run and fluctuates until the task is completed */
 
   double cost_;
-  simgrid::surf::Model* model_;
+  simgrid::kernel::resource::Model* model_;
   void* data_ = nullptr; /**< for your convenience */
 
   /* LMM */
   void* data_ = nullptr; /**< for your convenience */
 
   /* LMM */
@@ -210,4 +211,5 @@ typedef Action::ActionLmmList ActionLmmList;
 typedef Action::ActionLmmList* ActionLmmListPtr;
 } // namespace surf
 } // namespace simgrid
 typedef Action::ActionLmmList* ActionLmmListPtr;
 } // namespace surf
 } // namespace simgrid
+} // namespace simgrid
 #endif
 #endif
index ac5f5ec..5d518ef 100644 (file)
@@ -9,7 +9,8 @@
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(resource);
 
 namespace simgrid {
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(resource);
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
 Model::Model() : maxminSystem_(nullptr)
 {
 
 Model::Model() : maxminSystem_(nullptr)
 {
@@ -165,3 +166,4 @@ void Model::updateActionsStateFull(double /*now*/, double /*delta*/)
 
 } // namespace surf
 } // namespace simgrid
 
 } // namespace surf
 } // namespace simgrid
+} // namespace simgrid
index 704febb..e947ad3 100644 (file)
@@ -9,7 +9,8 @@
 #include "src/kernel/resource/Action.hpp"
 
 namespace simgrid {
 #include "src/kernel/resource/Action.hpp"
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
 /** @ingroup SURF_interface
  * @brief SURF model interface class
 
 /** @ingroup SURF_interface
  * @brief SURF model interface class
@@ -96,5 +97,5 @@ private:
 
 } // namespace surf
 } // namespace simgrid
 
 } // namespace surf
 } // namespace simgrid
-
+} // namespace simgrid
 #endif
 #endif
index 6016ae4..dc46230 100644 (file)
@@ -11,7 +11,7 @@ namespace simgrid {
 namespace kernel {
 namespace resource {
 
 namespace kernel {
 namespace resource {
 
-Resource::Resource(surf::Model* model, const std::string& name, lmm::Constraint* constraint)
+Resource::Resource(Model* model, const std::string& name, lmm::Constraint* constraint)
     : name_(name), model_(model), constraint_(constraint)
 {
 }
     : name_(name), model_(model), constraint_(constraint)
 {
 }
@@ -42,7 +42,7 @@ double Resource::getLoad()
   return constraint_->get_usage();
 }
 
   return constraint_->get_usage();
 }
 
-surf::Model* Resource::model() const
+Model* Resource::model() const
 {
   return model_;
 }
 {
   return model_;
 }
index 80481fb..4c9e6db 100644 (file)
@@ -26,12 +26,12 @@ public:
    * @param name The name of the Resource
    * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
    */
    * @param name The name of the Resource
    * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
    */
-  Resource(surf::Model * model, const std::string& name, lmm::Constraint* constraint);
+  Resource(Model * model, const std::string& name, lmm::Constraint* constraint);
 
   virtual ~Resource();
 
   /** @brief Get the Model of the current Resource */
 
   virtual ~Resource();
 
   /** @brief Get the Model of the current Resource */
-  surf::Model* model() const;
+  Model* model() const;
 
   /** @brief Get the name of the current Resource */
   const std::string& getName() const;
 
   /** @brief Get the name of the current Resource */
   const std::string& getName() const;
@@ -65,7 +65,7 @@ public:
 
 private:
   std::string name_;
 
 private:
   std::string name_;
-  surf::Model* model_;
+  Model* model_;
   bool isOn_ = true;
 
 public: /* LMM */
   bool isOn_ = true;
 
 public: /* LMM */
index 709ff69..3ffbfde 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
 
 /* 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. */
@@ -56,7 +56,7 @@ public:
   virtual void setBound(double bound);
 
   /* The vm object of the lower layer */
   virtual void setBound(double bound);
 
   /* The vm object of the lower layer */
-  surf::Action* action_ = nullptr;
+  kernel::resource::Action* action_ = nullptr;
 
   e_surf_vm_state_t getState();
   void setState(e_surf_vm_state_t state);
 
   e_surf_vm_state_t getState();
   void setState(e_surf_vm_state_t state);
index f6eeabc..da60d2d 100644 (file)
@@ -57,7 +57,7 @@ std::set<SD_task_t>* simulate(double how_long){
 
     /* let's see which tasks are done */
     for (auto const& model : *all_existing_models) {
 
     /* let's see which tasks are done */
     for (auto const& model : *all_existing_models) {
-      surf_action_t action = surf_model_extract_done_action_set(model);
+      simgrid::kernel::resource::Action* action = surf_model_extract_done_action_set(model);
       while (action != nullptr && action->getData() != nullptr) {
         SD_task_t task = static_cast<SD_task_t>(action->getData());
         XBT_VERB("Task '%s' done", SD_task_get_name(task));
       while (action != nullptr && action->getData() != nullptr) {
         SD_task_t task = static_cast<SD_task_t>(action->getData());
         XBT_VERB("Task '%s' done", SD_task_get_name(task));
index 13d55f4..826b800 100644 (file)
@@ -47,7 +47,7 @@ struct s_SD_task_t {
   double alpha;          /* used by typed parallel tasks */
   double start_time;
   double finish_time;
   double alpha;          /* used by typed parallel tasks */
   double start_time;
   double finish_time;
-  surf_action_t surf_action;
+  simgrid::kernel::resource::Action* surf_action;
   unsigned short watch_points;  /* bit field xor()ed with masks */
 
   int marked;                   /* used to check if the task DAG has some cycle*/
   unsigned short watch_points;  /* bit field xor()ed with masks */
 
   int marked;                   /* used to check if the task DAG has some cycle*/
index a4a974f..d81ec61 100644 (file)
@@ -670,7 +670,7 @@ smx_activity_t SIMIX_process_join(smx_actor_t issuer, smx_actor_t process, doubl
                         [](void*, void* arg) {
                           auto sleep = static_cast<simgrid::kernel::activity::SleepImpl*>(arg);
                           if (sleep->surf_sleep)
                         [](void*, void* arg) {
                           auto sleep = static_cast<simgrid::kernel::activity::SleepImpl*>(arg);
                           if (sleep->surf_sleep)
-                            sleep->surf_sleep->finish(simgrid::surf::Action::State::done);
+                            sleep->surf_sleep->finish(simgrid::kernel::resource::Action::State::done);
                           intrusive_ptr_release(sleep);
                           return 0;
                         },
                           intrusive_ptr_release(sleep);
                           return 0;
                         },
index e71ae2e..adbd7e9 100644 (file)
@@ -339,7 +339,7 @@ double SIMIX_get_clock()
 /** Wake up all processes waiting for a Surf action to finish */
 static void SIMIX_wake_processes()
 {
 /** Wake up all processes waiting for a Surf action to finish */
 static void SIMIX_wake_processes()
 {
-  surf_action_t action;
+  simgrid::kernel::resource::Action* action;
 
   for (auto const& model : *all_existing_models) {
     XBT_DEBUG("Handling the processes whose action failed (if any)");
 
   for (auto const& model : *all_existing_models) {
     XBT_DEBUG("Handling the processes whose action failed (if any)");
index 8708df0..45ce0ca 100644 (file)
@@ -322,7 +322,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_activity_t synchro, do
     SIMIX_comm_finish(synchro);
   } else { /* we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host
               fails */
     SIMIX_comm_finish(synchro);
   } else { /* we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host
               fails */
-    surf_action_t sleep = simcall->issuer->host->pimpl_cpu->sleep(timeout);
+    simgrid::kernel::resource::Action* sleep = simcall->issuer->host->pimpl_cpu->sleep(timeout);
     sleep->setData(synchro.get());
 
     simgrid::kernel::activity::CommImplPtr comm =
     sleep->setData(synchro.get());
 
     simgrid::kernel::activity::CommImplPtr comm =
@@ -468,7 +468,7 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm)
               receiver->getCname(), comm->surfAction_);
 
     /* If a link is failed, detect it immediately */
               receiver->getCname(), comm->surfAction_);
 
     /* If a link is failed, detect it immediately */
-    if (comm->surfAction_->getState() == simgrid::surf::Action::State::failed) {
+    if (comm->surfAction_->getState() == simgrid::kernel::resource::Action::State::failed) {
       XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->getCname(),
                 receiver->getCname());
       comm->state = SIMIX_LINK_FAILURE;
       XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->getCname(),
                 receiver->getCname());
       comm->state = SIMIX_LINK_FAILURE;
index 36bff70..6edf250 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -51,10 +51,10 @@ static inline double has_cost(double* array, int pos)
     return -1.0;
 }
 
     return -1.0;
 }
 
-Action* HostModel::executeParallelTask(int host_nb, simgrid::s4u::Host** host_list, double* flops_amount,
-    double* bytes_amount, double rate)
+kernel::resource::Action* HostModel::executeParallelTask(int host_nb, s4u::Host** host_list, double* flops_amount,
+                                                         double* bytes_amount, double rate)
 {
 {
-  Action* action = nullptr;
+  kernel::resource::Action* action = nullptr;
   if ((host_nb == 1) && (has_cost(bytes_amount, 0) <= 0)) {
     action = host_list[0]->pimpl_cpu->execution_start(flops_amount[0]);
   } else if ((host_nb == 1) && (has_cost(flops_amount, 0) <= 0)) {
   if ((host_nb == 1) && (has_cost(bytes_amount, 0) <= 0)) {
     action = host_list[0]->pimpl_cpu->execution_start(flops_amount[0]);
   } else if ((host_nb == 1) && (has_cost(flops_amount, 0) <= 0)) {
index 7ef46c8..632ec37 100644 (file)
@@ -31,13 +31,13 @@ namespace surf {
  * @brief SURF Host model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
  * @brief SURF Host model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
-class XBT_PRIVATE HostModel : public Model {
+class XBT_PRIVATE HostModel : public kernel::resource::Model {
 public:
   HostModel() : Model() {}
 
   virtual void ignoreEmptyVmInPmLMM();
 public:
   HostModel() : Model() {}
 
   virtual void ignoreEmptyVmInPmLMM();
-  virtual Action* executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount,
-                                      double rate);
+  virtual kernel::resource::Action* executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount,
+                                                        double* bytes_amount, double rate);
 };
 
 /************
 };
 
 /************
index db277c6..fcfa534 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -22,7 +21,8 @@ namespace surf {
 simgrid::xbt::signal<void(StorageImpl*)> storageCreatedCallbacks;
 simgrid::xbt::signal<void(StorageImpl*)> storageDestructedCallbacks;
 simgrid::xbt::signal<void(StorageImpl*, int, int)> storageStateChangedCallbacks; // signature: wasOn, isOn
 simgrid::xbt::signal<void(StorageImpl*)> storageCreatedCallbacks;
 simgrid::xbt::signal<void(StorageImpl*)> storageDestructedCallbacks;
 simgrid::xbt::signal<void(StorageImpl*, int, int)> storageStateChangedCallbacks; // signature: wasOn, isOn
-simgrid::xbt::signal<void(StorageAction*, Action::State, Action::State)> storageActionStateChangedCallbacks;
+simgrid::xbt::signal<void(StorageAction*, kernel::resource::Action::State, kernel::resource::Action::State)>
+    storageActionStateChangedCallbacks;
 
 /* List of storages */
 std::unordered_map<std::string, StorageImpl*>* StorageImpl::storages =
 
 /* List of storages */
 std::unordered_map<std::string, StorageImpl*>* StorageImpl::storages =
@@ -53,8 +53,9 @@ StorageModel::~StorageModel()
  * Resource *
  ************/
 
  * Resource *
  ************/
 
-StorageImpl::StorageImpl(Model* model, std::string name, lmm_system_t maxminSystem, double bread, double bwrite,
-                         std::string type_id, std::string content_name, sg_size_t size, std::string attach)
+StorageImpl::StorageImpl(kernel::resource::Model* model, std::string name, lmm_system_t maxminSystem, double bread,
+                         double bwrite, std::string type_id, std::string content_name, sg_size_t size,
+                         std::string attach)
     : Resource(model, name.c_str(), maxminSystem->constraint_new(this, std::max(bread, bwrite)))
     , piface_(this)
     , typeId_(type_id)
     : Resource(model, name.c_str(), maxminSystem->constraint_new(this, std::max(bread, bwrite)))
     , piface_(this)
     , typeId_(type_id)
index a77c79b..ff0704a 100644 (file)
@@ -52,10 +52,11 @@ XBT_PUBLIC_DATA(simgrid::xbt::signal<void(StorageImpl*, int, int)>) storageState
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after StorageAction State changed *
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after StorageAction State changed *
- * @details Callback functions have the following signature: `void(StorageAction *action, simgrid::surf::Action::State
- * old, simgrid::surf::Action::State current)`
+ * @details Callback functions have the following signature: `void(StorageAction *action,
+ * simgrid::kernel::resource::Action::State old, simgrid::kernel::resource::Action::State current)`
  */
  */
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(StorageAction*, Action::State, Action::State)>)
+XBT_PUBLIC_DATA(
+    simgrid::xbt::signal<void(StorageAction*, kernel::resource::Action::State, kernel::resource::Action::State)>)
 storageActionStateChangedCallbacks;
 
 /*********
 storageActionStateChangedCallbacks;
 
 /*********
@@ -65,7 +66,7 @@ storageActionStateChangedCallbacks;
  * @brief SURF storage model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
  * @brief SURF storage model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
-class StorageModel : public Model {
+class StorageModel : public kernel::resource::Model {
 public:
   StorageModel();
   ~StorageModel();
 public:
   StorageModel();
   ~StorageModel();
@@ -86,7 +87,7 @@ public:
 class StorageImpl : public kernel::resource::Resource, public PropertyHolder {
 public:
   /** @brief Storage constructor */
 class StorageImpl : public kernel::resource::Resource, public PropertyHolder {
 public:
   /** @brief Storage constructor */
-  StorageImpl(Model* model, std::string name, lmm_system_t maxminSystem, double bread, double bwrite,
+  StorageImpl(kernel::resource::Model* model, std::string name, lmm_system_t maxminSystem, double bread, double bwrite,
               std::string type_id, std::string content_name, sg_size_t size, std::string attach);
 
   ~StorageImpl() override;
               std::string type_id, std::string content_name, sg_size_t size, std::string attach);
 
   ~StorageImpl() override;
@@ -151,7 +152,7 @@ enum e_surf_action_storage_type_t {
 /** @ingroup SURF_storage_interface
  * @brief SURF storage action interface class
  */
 /** @ingroup SURF_storage_interface
  * @brief SURF storage action interface class
  */
-class StorageAction : public Action {
+class StorageAction : public kernel::resource::Action {
 public:
   /**
    * @brief StorageAction constructor
 public:
   /**
    * @brief StorageAction constructor
@@ -162,7 +163,8 @@ public:
    * @param storage The Storage associated to this StorageAction
    * @param type [description]
    */
    * @param storage The Storage associated to this StorageAction
    * @param type [description]
    */
-  StorageAction(Model* model, double cost, bool failed, StorageImpl* storage, e_surf_action_storage_type_t type)
+  StorageAction(kernel::resource::Model* model, double cost, bool failed, StorageImpl* storage,
+                e_surf_action_storage_type_t type)
       : Action(model, cost, failed), type_(type), storage_(storage){};
 
   /**
       : Action(model, cost, failed), type_(type), storage_(storage){};
 
   /**
@@ -175,11 +177,11 @@ public:
  * @param storage The Storage associated to this StorageAction
  * @param type [description]
  */
  * @param storage The Storage associated to this StorageAction
  * @param type [description]
  */
-  StorageAction(Model* model, double cost, bool failed, kernel::lmm::Variable* var, StorageImpl* storage,
-                e_surf_action_storage_type_t type)
+  StorageAction(kernel::resource::Model* model, double cost, bool failed, kernel::lmm::Variable* var,
+                StorageImpl* storage, e_surf_action_storage_type_t type)
       : Action(model, cost, failed, var), type_(type), storage_(storage){};
 
       : Action(model, cost, failed, var), type_(type), storage_(storage){};
 
-  void setState(simgrid::surf::Action::State state) override;
+  void setState(simgrid::kernel::resource::Action::State state) override;
 
   e_surf_action_storage_type_t type_;
   StorageImpl* storage_;
 
   e_surf_action_storage_type_t type_;
   StorageImpl* storage_;
index c6bbc35..5c6f2dc 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2009-2011, 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2009-2018. 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. */
 
 /* 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. */
@@ -56,7 +55,7 @@ CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel()
   maxminSystem_ = new simgrid::kernel::lmm::System(selectiveUpdate_);
 
   if (getUpdateMechanism() == UM_LAZY) {
   maxminSystem_ = new simgrid::kernel::lmm::System(selectiveUpdate_);
 
   if (getUpdateMechanism() == UM_LAZY) {
-    modifiedSet_ = new ActionLmmList();
+    modifiedSet_              = new kernel::resource::ActionLmmList();
     maxminSystem_->keep_track = modifiedSet_;
   }
 }
     maxminSystem_->keep_track = modifiedSet_;
   }
 }
@@ -138,13 +137,13 @@ void CpuCas01::apply_event(tmgr_trace_event_t event, double value)
       turnOff();
 
       while ((var = cnst->get_variable(&elem))) {
       turnOff();
 
       while ((var = cnst->get_variable(&elem))) {
-        Action* action = static_cast<Action*>(var->get_id());
+        kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
 
-        if (action->getState() == Action::State::running ||
-            action->getState() == Action::State::ready ||
-            action->getState() == Action::State::not_in_the_system) {
+        if (action->getState() == kernel::resource::Action::State::running ||
+            action->getState() == kernel::resource::Action::State::ready ||
+            action->getState() == kernel::resource::Action::State::not_in_the_system) {
           action->setFinishTime(date);
           action->setFinishTime(date);
-          action->setState(Action::State::failed);
+          action->setState(kernel::resource::Action::State::failed);
         }
       }
     }
         }
       }
     }
@@ -176,7 +175,7 @@ CpuAction *CpuCas01::sleep(double duration)
 
   // FIXME: sleep variables should not consume 1.0 in System::expand()
   action->setMaxDuration(duration);
 
   // FIXME: sleep variables should not consume 1.0 in System::expand()
   action->setMaxDuration(duration);
-  action->suspended_ = Action::SuspendStates::sleeping;
+  action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
   if (duration < 0) { // NO_MAX_DURATION
     /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
     simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
   if (duration < 0) { // NO_MAX_DURATION
     /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
     simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
@@ -199,7 +198,7 @@ CpuAction *CpuCas01::sleep(double duration)
 /**********
  * Action *
  **********/
 /**********
  * Action *
  **********/
-CpuCas01Action::CpuCas01Action(Model* model, double cost, bool failed, double speed,
+CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
                                kernel::lmm::Constraint* constraint, int requestedCore)
     : CpuAction(model, cost, failed,
                 model->getMaxminSystem()->variable_new(this, 1.0 / requestedCore, requestedCore * speed, 1))
                                kernel::lmm::Constraint* constraint, int requestedCore)
     : CpuAction(model, cost, failed,
                 model->getMaxminSystem()->variable_new(this, 1.0 / requestedCore, requestedCore * speed, 1))
@@ -212,7 +211,7 @@ CpuCas01Action::CpuCas01Action(Model* model, double cost, bool failed, double sp
   model->getMaxminSystem()->expand(constraint, getVariable(), 1.0);
 }
 
   model->getMaxminSystem()->expand(constraint, getVariable(), 1.0);
 }
 
-CpuCas01Action::CpuCas01Action(Model* model, double cost, bool failed, double speed,
+CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
                                kernel::lmm::Constraint* constraint)
     : CpuCas01Action(model, cost, failed, speed, constraint, 1)
 {
                                kernel::lmm::Constraint* constraint)
     : CpuCas01Action(model, cost, failed, speed, constraint, 1)
 {
index b256781..cefa230 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -28,7 +28,7 @@ public:
   ~CpuCas01Model() override;
 
   Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
   ~CpuCas01Model() override;
 
   Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
-  ActionList p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
+  kernel::resource::ActionList p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
 };
 
 /************
 };
 
 /************
@@ -59,9 +59,10 @@ class CpuCas01Action: public CpuAction {
   friend CpuAction *CpuCas01::execution_start(double size);
   friend CpuAction *CpuCas01::sleep(double duration);
 public:
   friend CpuAction *CpuCas01::execution_start(double size);
   friend CpuAction *CpuCas01::sleep(double duration);
 public:
-  CpuCas01Action(Model* model, double cost, bool failed, double speed, kernel::lmm::Constraint* constraint,
-                 int coreAmount);
-  CpuCas01Action(Model* model, double cost, bool failed, double speed, kernel::lmm::Constraint* constraint);
+  CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
+                 kernel::lmm::Constraint* constraint, int coreAmount);
+  CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
+                 kernel::lmm::Constraint* constraint);
   ~CpuCas01Action() override;
   int requestedCore();
 
   ~CpuCas01Action() override;
   int requestedCore();
 
index 1fcf505..a223b68 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -33,7 +32,7 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
                                       action->getLastUpdate(), now - action->getLastUpdate());
     }
 
                                       action->getLastUpdate(), now - action->getLastUpdate());
     }
 
-    action->finish(Action::State::done);
+    action->finish(kernel::resource::Action::State::done);
     XBT_CDEBUG(surf_kernel, "Action %p finished", action);
 
     /* set the remains to 0 due to precision problems when updating the remaining amount */
     XBT_CDEBUG(surf_kernel, "Action %p finished", action);
 
     /* set the remains to 0 due to precision problems when updating the remaining amount */
@@ -43,7 +42,7 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
     //defining the last timestamp that we can safely dump to trace file
     //without losing the event ascending order (considering all CPU's)
     double smaller = -1;
     //defining the last timestamp that we can safely dump to trace file
     //without losing the event ascending order (considering all CPU's)
     double smaller = -1;
-    for (Action const& action : *getRunningActionSet()) {
+    for (kernel::resource::Action const& action : *getRunningActionSet()) {
       if (smaller < 0 || action.getLastUpdate() < smaller)
         smaller = action.getLastUpdate();
     }
       if (smaller < 0 || action.getLastUpdate() < smaller)
         smaller = action.getLastUpdate();
     }
@@ -72,7 +71,7 @@ void CpuModel::updateActionsStateFull(double now, double delta)
 
     if (((action.getRemainsNoUpdate() <= 0) && (action.getVariable()->get_weight() > 0)) ||
         ((action.getMaxDuration() != NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
 
     if (((action.getRemainsNoUpdate() <= 0) && (action.getVariable()->get_weight() > 0)) ||
         ((action.getMaxDuration() != NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
-      action.finish(Action::State::done);
+      action.finish(kernel::resource::Action::State::done);
     }
   }
 }
     }
   }
 }
@@ -80,12 +79,12 @@ void CpuModel::updateActionsStateFull(double now, double delta)
 /************
  * Resource *
  ************/
 /************
  * Resource *
  ************/
-Cpu::Cpu(Model *model, simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core)
: Cpu(model, host, nullptr/*constraint*/, speedPerPstate, core)
+Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, std::vector<double>* speedPerPstate, int core)
   : Cpu(model, host, nullptr /*constraint*/, speedPerPstate, core)
 {
 }
 
 {
 }
 
-Cpu::Cpu(Model* model, simgrid::s4u::Host* host, kernel::lmm::Constraint* constraint,
+Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, kernel::lmm::Constraint* constraint,
          std::vector<double>* speedPerPstate, int core)
     : Resource(model, host->getCname(), constraint), coresAmount_(core), host_(host)
 {
          std::vector<double>* speedPerPstate, int core)
     : Resource(model, host->getCname(), constraint), coresAmount_(core), host_(host)
 {
@@ -198,7 +197,7 @@ void CpuAction::updateRemainingLazy(double now)
   setLastValue(getVariable()->get_value());
 }
 
   setLastValue(getVariable()->get_value());
 }
 
-simgrid::xbt::signal<void(simgrid::surf::CpuAction*, Action::State)> CpuAction::onStateChange;
+simgrid::xbt::signal<void(simgrid::surf::CpuAction*, kernel::resource::Action::State)> CpuAction::onStateChange;
 
 void CpuAction::suspend(){
   Action::State previous = getState();
 
 void CpuAction::suspend(){
   Action::State previous = getState();
index 42e1a48..bc04a19 100644 (file)
@@ -24,7 +24,8 @@ namespace surf {
  * @brief SURF cpu model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
  * @brief SURF cpu model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
-XBT_PUBLIC_CLASS CpuModel : public Model {
+XBT_PUBLIC_CLASS CpuModel : public kernel::resource::Model
+{
 public:
   /**
    * @brief Create a Cpu
 public:
   /**
    * @brief Create a Cpu
@@ -59,7 +60,7 @@ public:
    * @param speedPerPstate Processor speed (in flop per second) for each pstate
    * @param core The number of core of this Cpu
    */
    * @param speedPerPstate Processor speed (in flop per second) for each pstate
    * @param core The number of core of this Cpu
    */
-  Cpu(simgrid::surf::Model * model, simgrid::s4u::Host * host, kernel::lmm::Constraint * constraint,
+  Cpu(simgrid::kernel::resource::Model * model, simgrid::s4u::Host * host, kernel::lmm::Constraint * constraint,
       std::vector<double> * speedPerPstate, int core);
 
   /**
       std::vector<double> * speedPerPstate, int core);
 
   /**
@@ -70,7 +71,8 @@ public:
    * @param speedPerPstate Processor speed (in flop per second) for each pstate
    * @param core The number of core of this Cpu
    */
    * @param speedPerPstate Processor speed (in flop per second) for each pstate
    * @param core The number of core of this Cpu
    */
-  Cpu(simgrid::surf::Model* model, simgrid::s4u::Host* host, std::vector<double>* speedPerPstate, int core);
+  Cpu(simgrid::kernel::resource::Model * model, simgrid::s4u::Host * host, std::vector<double> * speedPerPstate,
+      int core);
 
   ~Cpu();
 
 
   ~Cpu();
 
@@ -80,7 +82,7 @@ public:
    * @param size The value of the processing amount (in flop) needed to process
    * @return The CpuAction corresponding to the processing
    */
    * @param size The value of the processing amount (in flop) needed to process
    * @return The CpuAction corresponding to the processing
    */
-  virtual simgrid::surf::Action *execution_start(double size)=0;
+  virtual simgrid::kernel::resource::Action* execution_start(double size) = 0;
 
   /**
    * @brief Execute some quantity of computation on more than one core
 
   /**
    * @brief Execute some quantity of computation on more than one core
@@ -89,7 +91,7 @@ public:
    * @param requestedCores The desired amount of cores. Must be >= 1
    * @return The CpuAction corresponding to the processing
    */
    * @param requestedCores The desired amount of cores. Must be >= 1
    * @return The CpuAction corresponding to the processing
    */
-  virtual simgrid::surf::Action* execution_start(double size, int requestedCores)
+  virtual simgrid::kernel::resource::Action* execution_start(double size, int requestedCores)
   {
     THROW_UNIMPLEMENTED;
     return nullptr;
   {
     THROW_UNIMPLEMENTED;
     return nullptr;
@@ -101,7 +103,7 @@ public:
    * @param duration The number of seconds to sleep
    * @return The CpuAction corresponding to the sleeping
    */
    * @param duration The number of seconds to sleep
    * @return The CpuAction corresponding to the sleeping
    */
-  virtual simgrid::surf::Action *sleep(double duration)=0;
+  virtual simgrid::kernel::resource::Action* sleep(double duration) = 0;
 
   /** @brief Get the amount of cores */
   virtual int coreCount();
 
   /** @brief Get the amount of cores */
   virtual int coreCount();
@@ -146,26 +148,27 @@ public:
  /** @ingroup SURF_cpu_interface
  * @brief A CpuAction represents the execution of code on one or several Cpus
  */
  /** @ingroup SURF_cpu_interface
  * @brief A CpuAction represents the execution of code on one or several Cpus
  */
-XBT_PUBLIC_CLASS CpuAction : public simgrid::surf::Action {
+XBT_PUBLIC_CLASS CpuAction : public simgrid::kernel::resource::Action
+{
   friend XBT_PUBLIC(Cpu*) getActionCpu(CpuAction* action);
 
 public:
   /** @brief Signal emitted when the action state changes (ready/running/done, etc)
   friend XBT_PUBLIC(Cpu*) getActionCpu(CpuAction* action);
 
 public:
   /** @brief Signal emitted when the action state changes (ready/running/done, etc)
-   *  Signature: `void(CpuAction *action, simgrid::surf::Action::State previous)`
+   *  Signature: `void(CpuAction *action, simgrid::kernel::resource::Action::State previous)`
    */
    */
-  static simgrid::xbt::signal<void(simgrid::surf::CpuAction*, simgrid::surf::Action::State)> onStateChange;
+  static simgrid::xbt::signal<void(simgrid::surf::CpuAction*, simgrid::kernel::resource::Action::State)> onStateChange;
   /** @brief Signal emitted when the action share changes (amount of flops it gets)
    *  Signature: `void(CpuAction *action)`
    */
   static simgrid::xbt::signal<void(simgrid::surf::CpuAction*)> onShareChange;
 
   /** @brief Signal emitted when the action share changes (amount of flops it gets)
    *  Signature: `void(CpuAction *action)`
    */
   static simgrid::xbt::signal<void(simgrid::surf::CpuAction*)> onShareChange;
 
-  CpuAction(simgrid::surf::Model* model, double cost, bool failed) : Action(model, cost, failed) {}
-  CpuAction(simgrid::surf::Model * model, double cost, bool failed, kernel::lmm::Variable* var)
+  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)
   {
   }
 
       : Action(model, cost, failed, var)
   {
   }
 
-  void setState(simgrid::surf::Action::State state) override;
+  void setState(simgrid::kernel::resource::Action::State state) override;
 
   void updateRemainingLazy(double now) override;
   std::list<Cpu*> cpus();
 
   void updateRemainingLazy(double now) override;
   std::list<Cpu*> cpus();
index 2ad9288..10e8039 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -362,7 +361,7 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/)
   while (not actionHeapIsEmpty() && actionHeapTopDate() <= now) {
     CpuTiAction* action = static_cast<CpuTiAction*>(actionHeapPop());
     XBT_DEBUG("Action %p: finish", action);
   while (not actionHeapIsEmpty() && actionHeapTopDate() <= now) {
     CpuTiAction* action = static_cast<CpuTiAction*>(actionHeapPop());
     XBT_DEBUG("Action %p: finish", action);
-    action->finish(Action::State::done);
+    action->finish(kernel::resource::Action::State::done);
     /* set the remains to 0 due to precision problems when updating the remaining amount */
     action->setRemains(0);
     /* update remaining amount of all actions */
     /* set the remains to 0 due to precision problems when updating the remaining amount */
     action->setRemains(0);
     /* update remaining amount of all actions */
@@ -440,10 +439,11 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value)
 
       /* put all action running on cpu to failed */
       for (CpuTiAction& action : actionSet_) {
 
       /* put all action running on cpu to failed */
       for (CpuTiAction& action : actionSet_) {
-        if (action.getState() == Action::State::running || action.getState() == Action::State::ready ||
-            action.getState() == Action::State::not_in_the_system) {
+        if (action.getState() == kernel::resource::Action::State::running ||
+            action.getState() == kernel::resource::Action::State::ready ||
+            action.getState() == kernel::resource::Action::State::not_in_the_system) {
           action.setFinishTime(date);
           action.setFinishTime(date);
-          action.setState(Action::State::failed);
+          action.setState(kernel::resource::Action::State::failed);
           action.heapRemove(model()->getActionHeap());
         }
       }
           action.heapRemove(model()->getActionHeap());
         }
       }
@@ -473,7 +473,7 @@ void CpuTi::updateActionsFinishTime(double now)
       continue;
 
     /* action suspended, skip it */
       continue;
 
     /* action suspended, skip it */
-    if (action.suspended_ != Action::SuspendStates::not_suspended)
+    if (action.suspended_ != kernel::resource::Action::SuspendStates::not_suspended)
       continue;
 
     sum_priority += 1.0 / action.getPriority();
       continue;
 
     sum_priority += 1.0 / action.getPriority();
@@ -487,7 +487,7 @@ void CpuTi::updateActionsFinishTime(double now)
       continue;
 
     /* verify if the action is really running on cpu */
       continue;
 
     /* verify if the action is really running on cpu */
-    if (action.suspended_ == Action::SuspendStates::not_suspended && action.getPriority() > 0) {
+    if (action.suspended_ == kernel::resource::Action::SuspendStates::not_suspended && action.getPriority() > 0) {
       /* total area needed to finish the action. Used in trace integration */
       total_area = (action.getRemains()) * sum_priority * action.getPriority();
 
       /* total area needed to finish the action. Used in trace integration */
       total_area = (action.getRemains()) * sum_priority * action.getPriority();
 
@@ -507,7 +507,7 @@ void CpuTi::updateActionsFinishTime(double now)
     }
     /* add in action heap */
     if (min_finish > NO_MAX_DURATION)
     }
     /* add in action heap */
     if (min_finish > NO_MAX_DURATION)
-      action.heapUpdate(model()->getActionHeap(), min_finish, Action::Type::NOTSET);
+      action.heapUpdate(model()->getActionHeap(), min_finish, kernel::resource::Action::Type::NOTSET);
     else
       action.heapRemove(model()->getActionHeap());
 
     else
       action.heapRemove(model()->getActionHeap());
 
@@ -550,7 +550,7 @@ void CpuTi::updateRemainingAmount(double now)
       continue;
 
     /* action suspended, skip it */
       continue;
 
     /* action suspended, skip it */
-    if (action.suspended_ != Action::SuspendStates::not_suspended)
+    if (action.suspended_ != kernel::resource::Action::SuspendStates::not_suspended)
       continue;
 
     /* action don't need update */
       continue;
 
     /* action don't need update */
@@ -589,7 +589,7 @@ CpuAction *CpuTi::sleep(double duration)
   CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), 1.0, isOff(), this);
 
   action->setMaxDuration(duration);
   CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), 1.0, isOff(), this);
 
   action->setMaxDuration(duration);
-  action->suspended_ = Action::SuspendStates::sleeping;
+  action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
   if (duration == NO_MAX_DURATION) {
     /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
     simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
   if (duration == NO_MAX_DURATION) {
     /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
     simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
index 609cff9..2f29bda 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -85,7 +84,7 @@ class CpuTiAction: public CpuAction {
 public:
   CpuTiAction(CpuTiModel *model, double cost, bool failed, CpuTi *cpu);
 
 public:
   CpuTiAction(CpuTiModel *model, double cost, bool failed, CpuTi *cpu);
 
-  void setState(simgrid::surf::Action::State state) override;
+  void setState(simgrid::kernel::resource::Action::State state) override;
   int unref() override;
   void cancel() override;
   void suspend() override;
   int unref() override;
   void cancel() override;
   void suspend() override;
@@ -147,7 +146,7 @@ public:
   double nextOccuringEvent(double now) override;
   void updateActionsState(double now, double delta) override;
 
   double nextOccuringEvent(double now) override;
   void updateActionsState(double now, double delta) override;
 
-  ActionList runningActionSetThatDoesNotNeedBeingChecked_;
+  kernel::resource::ActionList runningActionSetThatDoesNotNeedBeingChecked_;
   CpuTiList modifiedCpu_;
 };
 
   CpuTiList modifiedCpu_;
 };
 
index 6c0ac6e..68051c7 100644 (file)
@@ -156,7 +156,7 @@ NetworkCm02Model::NetworkCm02Model()
   loopback_     = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
 
   if (getUpdateMechanism() == UM_LAZY) {
   loopback_     = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
 
   if (getUpdateMechanism() == UM_LAZY) {
-    modifiedSet_ = new ActionLmmList();
+    modifiedSet_              = new kernel::resource::ActionLmmList();
     maxminSystem_->keep_track = modifiedSet_;
   }
 }
     maxminSystem_->keep_track = modifiedSet_;
   }
 }
@@ -191,19 +191,20 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
     }
 
     // if I am wearing a latency hat
     }
 
     // if I am wearing a latency hat
-    if (action->getType() == Action::Type::LATENCY) {
+    if (action->getType() == kernel::resource::Action::Type::LATENCY) {
       XBT_DEBUG("Latency paid for action %p. Activating", action);
       maxminSystem_->update_variable_weight(action->getVariable(), action->weight_);
       action->heapRemove(getActionHeap());
       action->refreshLastUpdate();
 
         // if I am wearing a max_duration or normal hat
       XBT_DEBUG("Latency paid for action %p. Activating", action);
       maxminSystem_->update_variable_weight(action->getVariable(), action->weight_);
       action->heapRemove(getActionHeap());
       action->refreshLastUpdate();
 
         // if I am wearing a max_duration or normal hat
-    } else if (action->getType() == Action::Type::MAX_DURATION || action->getType() == Action::Type::NORMAL) {
+    } else if (action->getType() == kernel::resource::Action::Type::MAX_DURATION ||
+               action->getType() == kernel::resource::Action::Type::NORMAL) {
       // no need to communicate anymore
       // assume that flows that reached max_duration have remaining of 0
       XBT_DEBUG("Action %p finished", action);
       action->setRemains(0);
       // no need to communicate anymore
       // assume that flows that reached max_duration have remaining of 0
       XBT_DEBUG("Action %p finished", action);
       action->setRemains(0);
-      action->finish(Action::State::done);
+      action->finish(kernel::resource::Action::State::done);
       action->heapRemove(getActionHeap());
     }
   }
       action->heapRemove(getActionHeap());
     }
   }
@@ -252,12 +253,12 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
 
     if (((action.getRemains() <= 0) && (action.getVariable()->get_weight() > 0)) ||
         ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
 
     if (((action.getRemains() <= 0) && (action.getVariable()->get_weight() > 0)) ||
         ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
-      action.finish(Action::State::done);
+      action.finish(kernel::resource::Action::State::done);
     }
   }
 }
 
     }
   }
 }
 
-Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
+kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
 {
   int failed = 0;
   double latency = 0.0;
 {
   int failed = 0;
   double latency = 0.0;
@@ -313,7 +314,8 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
       // add to the heap the event when the latency is payed
       XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->getLastUpdate());
       action->heapInsert(getActionHeap(), action->latency_ + action->getLastUpdate(),
       // add to the heap the event when the latency is payed
       XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->getLastUpdate());
       action->heapInsert(getActionHeap(), action->latency_ + action->getLastUpdate(),
-                         route.empty() ? Action::Type::NORMAL : Action::Type::LATENCY);
+                         route.empty() ? kernel::resource::Action::Type::NORMAL
+                                       : kernel::resource::Action::Type::LATENCY);
     }
   } else
     action->setVariable(maxminSystem_->variable_new(action, 1.0, -1.0, constraints_per_variable));
     }
   } else
     action->setVariable(maxminSystem_->variable_new(action, 1.0, -1.0, constraints_per_variable));
@@ -386,12 +388,12 @@ void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
 
       turnOff();
       while ((var = constraint()->get_variable(&elem))) {
 
       turnOff();
       while ((var = constraint()->get_variable(&elem))) {
-        Action* action = static_cast<Action*>(var->get_id());
+        kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
 
-        if (action->getState() == Action::State::running ||
-            action->getState() == Action::State::ready) {
+        if (action->getState() == kernel::resource::Action::State::running ||
+            action->getState() == kernel::resource::Action::State::ready) {
           action->setFinishTime(now);
           action->setFinishTime(now);
-          action->setState(Action::State::failed);
+          action->setState(kernel::resource::Action::State::failed);
         }
       }
     }
         }
       }
     }
index 7fd4187..07486aa 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -42,7 +42,7 @@ public:
                        e_surf_link_sharing_policy_t policy) override;
   void updateActionsStateLazy(double now, double delta) override;
   void updateActionsStateFull(double now, double delta) override;
                        e_surf_link_sharing_policy_t policy) override;
   void updateActionsStateLazy(double now, double delta) override;
   void updateActionsStateFull(double now, double delta) override;
-  Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
+  kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
 };
 
 /************
 };
 
 /************
@@ -67,7 +67,7 @@ class NetworkCm02Action : public NetworkAction {
   friend NetworkSmpiModel;
 
 public:
   friend NetworkSmpiModel;
 
 public:
-  NetworkCm02Action(Model* model, double cost, bool failed) : NetworkAction(model, cost, failed){};
+  NetworkCm02Action(kernel::resource::Model* model, double cost, bool failed) : NetworkAction(model, cost, failed){};
   virtual ~NetworkCm02Action() = default;
   void updateRemainingLazy(double now) override;
 };
   virtual ~NetworkCm02Action() = default;
   void updateRemainingLazy(double now) override;
 };
index 166d70e..a2d9074 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -32,7 +32,7 @@ LinkImpl* NetworkConstantModel::createLink(const std::string& name, double bw, d
 double NetworkConstantModel::nextOccuringEvent(double /*now*/)
 {
   double min = -1.0;
 double NetworkConstantModel::nextOccuringEvent(double /*now*/)
 {
   double min = -1.0;
-  for (Action const& action : *getRunningActionSet()) {
+  for (kernel::resource::Action const& action : *getRunningActionSet()) {
     const NetworkConstantAction& net_action = static_cast<const NetworkConstantAction&>(action);
     if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min))
       min = net_action.latency_;
     const NetworkConstantAction& net_action = static_cast<const NetworkConstantAction&>(action);
     if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min))
       min = net_action.latency_;
@@ -58,12 +58,12 @@ void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
 
     if ((action.getRemainsNoUpdate() <= 0) ||
         ((action.getMaxDuration() != NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
 
     if ((action.getRemainsNoUpdate() <= 0) ||
         ((action.getMaxDuration() != NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
-      action.finish(Action::State::done);
+      action.finish(kernel::resource::Action::State::done);
     }
   }
 }
 
     }
   }
 }
 
-Action* NetworkConstantModel::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
+kernel::resource::Action* NetworkConstantModel::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
 {
   NetworkConstantAction* action = new NetworkConstantAction(this, size, sg_latency_factor);
 
 {
   NetworkConstantAction* action = new NetworkConstantAction(this, size, sg_latency_factor);
 
index 108941c..f12715b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -25,7 +25,8 @@ namespace simgrid {
      *********/
     class NetworkConstantModel : public NetworkModel {
     public:
      *********/
     class NetworkConstantModel : public NetworkModel {
     public:
-      Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size, double rate) override;
+      kernel::resource::Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size,
+                                            double rate) override;
       double nextOccuringEvent(double now) override;
       void updateActionsState(double now, double delta) override;
 
       double nextOccuringEvent(double now) override;
       void updateActionsState(double now, double delta) override;
 
index 1dc1b1e..edc4323 100644 (file)
@@ -34,7 +34,7 @@ static void IB_action_state_changed_callback(simgrid::surf::NetworkAction* actio
   using simgrid::surf::NetworkIBModel;
   using simgrid::surf::IBNode;
 
   using simgrid::surf::NetworkIBModel;
   using simgrid::surf::IBNode;
 
-  if (action->getState() != simgrid::surf::Action::State::done)
+  if (action->getState() != simgrid::kernel::resource::Action::State::done)
     return;
   std::pair<IBNode*,IBNode*> pair = ((NetworkIBModel*)surf_network_model)->active_comms[action];
   XBT_DEBUG("IB callback - action %p finished", action);
     return;
   std::pair<IBNode*,IBNode*> pair = ((NetworkIBModel*)surf_network_model)->active_comms[action];
   XBT_DEBUG("IB callback - action %p finished", action);
index c53c07d..0549d1d 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -85,7 +84,7 @@ namespace simgrid {
     {
       double minRes = Model::nextOccuringEventFull(now);
 
     {
       double minRes = Model::nextOccuringEventFull(now);
 
-      for (Action const& action : *getRunningActionSet()) {
+      for (kernel::resource::Action const& action : *getRunningActionSet()) {
         const NetworkAction& net_action = static_cast<const NetworkAction&>(action);
         if (net_action.latency_ > 0)
           minRes = (minRes < 0) ? net_action.latency_ : std::min(minRes, net_action.latency_);
         const NetworkAction& net_action = static_cast<const NetworkAction&>(action);
         if (net_action.latency_ > 0)
           minRes = (minRes < 0) ? net_action.latency_ : std::min(minRes, net_action.latency_);
index 0dd7dac..8863627 100644 (file)
@@ -30,7 +30,7 @@ namespace surf {
  * @brief SURF network model interface class
  * @details A model is an object which handles the interactions between its Resources and its Actions
  */
  * @brief SURF network model interface class
  * @details A model is an object which handles the interactions between its Resources and its Actions
  */
-class NetworkModel : public Model {
+class NetworkModel : public kernel::resource::Model {
 public:
   /** @brief Constructor */
   NetworkModel() : Model() {}
 public:
   /** @brief Constructor */
   NetworkModel() : Model() {}
@@ -61,7 +61,7 @@ public:
    * unlimited.
    * @return The action representing the communication
    */
    * unlimited.
    * @return The action representing the communication
    */
-  virtual Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size, double rate) = 0;
+  virtual kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) = 0;
 
   /** @brief Function pointer to the function to use to solve the lmm_system_t
    *
 
   /** @brief Function pointer to the function to use to solve the lmm_system_t
    *
@@ -188,7 +188,7 @@ public:
  * @brief SURF network action interface class
  * @details A NetworkAction represents a communication between two [hosts](\ref HostImpl)
  */
  * @brief SURF network action interface class
  * @details A NetworkAction represents a communication between two [hosts](\ref HostImpl)
  */
-class NetworkAction : public simgrid::surf::Action {
+class NetworkAction : public simgrid::kernel::resource::Action {
 public:
   /** @brief Constructor
    *
 public:
   /** @brief Constructor
    *
@@ -196,7 +196,10 @@ public:
    * @param cost The cost of this  NetworkAction in [TODO]
    * @param failed [description]
    */
    * @param cost The cost of this  NetworkAction in [TODO]
    * @param failed [description]
    */
-  NetworkAction(simgrid::surf::Model* model, double cost, bool failed) : simgrid::surf::Action(model, cost, failed) {}
+  NetworkAction(simgrid::kernel::resource::Model* model, double cost, bool failed)
+      : simgrid::kernel::resource::Action(model, cost, failed)
+  {
+  }
 
   /**
    * @brief NetworkAction constructor
 
   /**
    * @brief NetworkAction constructor
@@ -206,10 +209,10 @@ public:
    * @param failed [description]
    * @param var The lmm variable associated to this Action if it is part of a LMM component
    */
    * @param failed [description]
    * @param var The lmm variable associated to this Action if it is part of a LMM component
    */
-  NetworkAction(simgrid::surf::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
-      : simgrid::surf::Action(model, cost, failed, var){};
+  NetworkAction(simgrid::kernel::resource::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
+      : simgrid::kernel::resource::Action(model, cost, failed, var){};
 
 
-  void setState(simgrid::surf::Action::State state) override;
+  void setState(simgrid::kernel::resource::Action::State state) override;
   virtual std::list<LinkImpl*> links();
 
   double latency_    = {};
   virtual std::list<LinkImpl*> links();
 
   double latency_    = {};
index 273b564..05f1e9c 100644 (file)
@@ -175,7 +175,7 @@ LinkImpl* NetworkNS3Model::createLink(const std::string& name, double bandwidth,
   return new LinkNS3(this, name, bandwidth, latency);
 }
 
   return new LinkNS3(this, name, bandwidth, latency);
 }
 
-Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
+kernel::resource::Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
 {
   return new NetworkNS3Action(this, size, src, dst);
 }
 {
   return new NetworkNS3Action(this, size, src, dst);
 }
@@ -223,8 +223,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
     XBT_DEBUG("Processing socket %p (action %p)",sgFlow,action);
     action->setRemains(action->getCost() - sgFlow->sentBytes_);
 
     XBT_DEBUG("Processing socket %p (action %p)",sgFlow,action);
     action->setRemains(action->getCost() - sgFlow->sentBytes_);
 
-    if (TRACE_is_enabled() &&
-        action->getState() == Action::State::running){
+    if (TRACE_is_enabled() && action->getState() == kernel::resource::Action::State::running) {
       double data_delta_sent = sgFlow->sentBytes_ - action->lastSent_;
 
       std::vector<LinkImpl*> route = std::vector<LinkImpl*>();
       double data_delta_sent = sgFlow->sentBytes_ - action->lastSent_;
 
       std::vector<LinkImpl*> route = std::vector<LinkImpl*>();
@@ -240,7 +239,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
     if(sgFlow->finished_){
       socket_to_destroy.push_back(ns3Socket);
       XBT_DEBUG("Destroy socket %p of action %p", ns3Socket.c_str(), action);
     if(sgFlow->finished_){
       socket_to_destroy.push_back(ns3Socket);
       XBT_DEBUG("Destroy socket %p of action %p", ns3Socket.c_str(), action);
-      action->finish(Action::State::done);
+      action->finish(kernel::resource::Action::State::done);
     } else {
       XBT_DEBUG("Socket %p sent %u bytes out of %u (%u remaining)", ns3Socket.c_str(), sgFlow->sentBytes_,
                 sgFlow->totalBytes_, sgFlow->remaining_);
     } else {
       XBT_DEBUG("Socket %p sent %u bytes out of %u (%u remaining)", ns3Socket.c_str(), sgFlow->sentBytes_,
                 sgFlow->totalBytes_, sgFlow->remaining_);
@@ -289,7 +288,7 @@ void LinkNS3::setLatencyTrace(tmgr_trace_t trace) {
  * Action *
  **********/
 
  * Action *
  **********/
 
-NetworkNS3Action::NetworkNS3Action(Model* model, double totalBytes, s4u::Host* src, s4u::Host* dst)
+NetworkNS3Action::NetworkNS3Action(kernel::resource::Model* model, double totalBytes, s4u::Host* src, s4u::Host* dst)
     : NetworkAction(model, totalBytes, false)
 {
   XBT_DEBUG("Communicate from %s to %s", src->getCname(), dst->getCname());
     : NetworkAction(model, totalBytes, false)
 {
   XBT_DEBUG("Communicate from %s to %s", src->getCname(), dst->getCname());
index ae7f9bd..7ed353a 100644 (file)
@@ -19,7 +19,7 @@ public:
   ~NetworkNS3Model();
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
                        e_surf_link_sharing_policy_t policy) override;
   ~NetworkNS3Model();
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
                        e_surf_link_sharing_policy_t policy) override;
-  Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
+  kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   double nextOccuringEvent(double now) override;
   bool nextOccuringEventIsIdempotent() override { return false; }
   void updateActionsState(double now, double delta) override;
   double nextOccuringEvent(double now) override;
   bool nextOccuringEventIsIdempotent() override { return false; }
   void updateActionsState(double now, double delta) override;
@@ -45,7 +45,7 @@ public:
  **********/
 class XBT_PRIVATE NetworkNS3Action : public NetworkAction {
 public:
  **********/
 class XBT_PRIVATE NetworkNS3Action : public NetworkAction {
 public:
-  NetworkNS3Action(Model* model, double cost, s4u::Host* src, s4u::Host* dst);
+  NetworkNS3Action(kernel::resource::Model* model, double cost, s4u::Host* src, s4u::Host* dst);
 
   bool isSuspended() override;
   int unref() override;
 
   bool isSuspended() override;
   int unref() override;
index 5523636..81b4c9b 100644 (file)
@@ -389,7 +389,7 @@ static void onCreation(simgrid::s4u::Host& host)
   host.extension_set(new HostEnergy(&host));
 }
 
   host.extension_set(new HostEnergy(&host));
 }
 
-static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::surf::Action::State previous)
+static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::kernel::resource::Action::State previous)
 {
   for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
     simgrid::s4u::Host* host = cpu->getHost();
 {
   for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
     simgrid::s4u::Host* host = cpu->getHost();
index 31ea874..f30692e 100644 (file)
@@ -158,7 +158,7 @@ static void onHostChange(simgrid::s4u::Host& host)
 }
 
 /* This callback is called when an action (computation, idle, ...) terminates */
 }
 
 /* This callback is called when an action (computation, idle, ...) terminates */
-static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::surf::Action::State /*previous*/)
+static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::kernel::resource::Action::State /*previous*/)
 {
   for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
     simgrid::s4u::Host* host = cpu->getHost();
 {
   for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
     simgrid::s4u::Host* host = cpu->getHost();
index d4eb8a2..3707a56 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2007-2010, 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2018. 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. */
 
 /* 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. */
@@ -71,7 +70,7 @@ NetworkL07Model::~NetworkL07Model()
 double HostL07Model::nextOccuringEvent(double now)
 {
   double min = HostModel::nextOccuringEventFull(now);
 double HostL07Model::nextOccuringEvent(double now)
 {
   double min = HostModel::nextOccuringEventFull(now);
-  for (Action const& action : *getRunningActionSet()) {
+  for (kernel::resource::Action const& action : *getRunningActionSet()) {
     const L07Action& net_action = static_cast<const L07Action&>(action);
     if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min)) {
       min = net_action.latency_;
     const L07Action& net_action = static_cast<const L07Action&>(action);
     if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min)) {
       min = net_action.latency_;
@@ -116,7 +115,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
 
     if (((action.getRemains() <= 0) && (action.getVariable()->get_weight() > 0)) ||
         ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
 
     if (((action.getRemains() <= 0) && (action.getVariable()->get_weight() > 0)) ||
         ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
-      action.finish(Action::State::done);
+      action.finish(kernel::resource::Action::State::done);
     } else {
       /* Need to check that none of the model has failed */
       int i = 0;
     } else {
       /* Need to check that none of the model has failed */
       int i = 0;
@@ -126,7 +125,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
         void* constraint_id = cnst->get_id();
         if (static_cast<simgrid::kernel::resource::Resource*>(constraint_id)->isOff()) {
           XBT_DEBUG("Action (%p) Failed!!", &action);
         void* constraint_id = cnst->get_id();
         if (static_cast<simgrid::kernel::resource::Resource*>(constraint_id)->isOff()) {
           XBT_DEBUG("Action (%p) Failed!!", &action);
-          action.finish(Action::State::failed);
+          action.finish(kernel::resource::Action::State::failed);
           break;
         }
         cnst = action.getVariable()->get_constraint(i);
           break;
         }
         cnst = action.getVariable()->get_constraint(i);
@@ -135,17 +134,15 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
   }
 }
 
   }
 }
 
-Action *HostL07Model::executeParallelTask(int host_nb, sg_host_t *host_list,
-                                          double *flops_amount, double *bytes_amount,double rate) {
+kernel::resource::Action* HostL07Model::executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount,
+                                                            double* bytes_amount, double rate)
+{
   return new L07Action(this, host_nb, host_list, flops_amount, bytes_amount, rate);
 }
 
   return new L07Action(this, host_nb, host_list, flops_amount, bytes_amount, rate);
 }
 
-L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
-                     double *flops_amount, double *bytes_amount, double rate)
-  : CpuAction(model, 1, 0)
-  , computationAmount_(flops_amount)
-  , communicationAmount_(bytes_amount)
-  , rate_(rate)
+L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* host_list, double* flops_amount,
+                     double* bytes_amount, double rate)
+    : CpuAction(model, 1, 0), computationAmount_(flops_amount), communicationAmount_(bytes_amount), rate_(rate)
 {
   int nb_link = 0;
   int nb_used_host = 0; /* Only the hosts with something to compute (>0 flops) are counted) */
 {
   int nb_link = 0;
   int nb_used_host = 0; /* Only the hosts with something to compute (>0 flops) are counted) */
@@ -214,7 +211,7 @@ L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
   delete[] host_list;
 }
 
   delete[] host_list;
 }
 
-Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
+kernel::resource::Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
 {
   sg_host_t* host_list = new sg_host_t[2]();
   double* flops_amount = new double[2]();
 {
   sg_host_t* host_list = new sg_host_t[2]();
   double* flops_amount = new double[2]();
@@ -262,7 +259,7 @@ LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwid
   s4u::Link::onCreation(this->piface_);
 }
 
   s4u::Link::onCreation(this->piface_);
 }
 
-Action *CpuL07::execution_start(double size)
+kernel::resource::Action* CpuL07::execution_start(double size)
 {
   sg_host_t* host_list = new sg_host_t[1]();
   double* flops_amount = new double[1]();
 {
   sg_host_t* host_list = new sg_host_t[1]();
   double* flops_amount = new double[1]();
@@ -273,11 +270,11 @@ Action *CpuL07::execution_start(double size)
   return static_cast<CpuL07Model*>(model())->hostModel_->executeParallelTask(1, host_list, flops_amount, nullptr, -1);
 }
 
   return static_cast<CpuL07Model*>(model())->hostModel_->executeParallelTask(1, host_list, flops_amount, nullptr, -1);
 }
 
-Action *CpuL07::sleep(double duration)
+kernel::resource::Action* CpuL07::sleep(double duration)
 {
   L07Action *action = static_cast<L07Action*>(execution_start(1.0));
   action->setMaxDuration(duration);
 {
   L07Action *action = static_cast<L07Action*>(execution_start(1.0));
   action->setMaxDuration(duration);
-  action->suspended_ = Action::SuspendStates::sleeping;
+  action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
   model()->getMaxminSystem()->update_variable_weight(action->getVariable(), 0.0);
 
   return action;
   model()->getMaxminSystem()->update_variable_weight(action->getVariable(), 0.0);
 
   return action;
@@ -294,7 +291,7 @@ void CpuL07::onSpeedChange() {
 
   model()->getMaxminSystem()->update_constraint_bound(constraint(), speed_.peak * speed_.scale);
   while ((var = constraint()->get_variable(&elem))) {
 
   model()->getMaxminSystem()->update_constraint_bound(constraint(), speed_.peak * speed_.scale);
   while ((var = constraint()->get_variable(&elem))) {
-    Action* action = static_cast<Action*>(var->get_id());
+    kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
     model()->getMaxminSystem()->update_variable_bound(action->getVariable(), speed_.scale * speed_.peak);
   }
 
     model()->getMaxminSystem()->update_variable_bound(action->getVariable(), speed_.scale * speed_.peak);
   }
index 4ae5bb8..aff7964 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -41,8 +40,8 @@ public:
 
   double nextOccuringEvent(double now) override;
   void updateActionsState(double now, double delta) override;
 
   double nextOccuringEvent(double now) override;
   void updateActionsState(double now, double delta) override;
-  Action *executeParallelTask(int host_nb, sg_host_t *host_list,
-                              double *flops_amount, double *bytes_amount, double rate) override;
+  kernel::resource::Action* executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount,
+                                                double* bytes_amount, double rate) override;
 };
 
 class CpuL07Model : public CpuModel {
 };
 
 class CpuL07Model : public CpuModel {
@@ -61,7 +60,7 @@ public:
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
                        e_surf_link_sharing_policy_t policy) override;
 
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
                        e_surf_link_sharing_policy_t policy) override;
 
-  Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
+  kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
 
   HostL07Model *hostModel_;
 };
 
   HostL07Model *hostModel_;
 };
@@ -76,8 +75,8 @@ public:
   ~CpuL07() override;
   bool isUsed() override;
   void apply_event(tmgr_trace_event_t event, double value) override;
   ~CpuL07() override;
   bool isUsed() override;
   void apply_event(tmgr_trace_event_t event, double value) override;
-  Action* execution_start(double size) override;
-  Action* sleep(double duration) override;
+  kernel::resource::Action* execution_start(double size) override;
+  kernel::resource::Action* sleep(double duration) override;
 
 protected:
   void onSpeedChange() override;
 
 protected:
   void onSpeedChange() override;
@@ -103,8 +102,9 @@ class L07Action : public CpuAction {
   friend Action *HostL07Model::executeParallelTask(int host_nb, sg_host_t*host_list,
                                                    double *flops_amount, double *bytes_amount, double rate);
 public:
   friend Action *HostL07Model::executeParallelTask(int host_nb, sg_host_t*host_list,
                                                    double *flops_amount, double *bytes_amount, double rate);
 public:
-  L07Action(Model *model, int host_nb, sg_host_t *host_list, double *flops_amount, double *bytes_amount, double rate);
- ~L07Action();
+  L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* host_list, double* flops_amount,
+            double* bytes_amount, double rate);
+  ~L07Action();
 
   void updateBound();
 
 
   void updateBound();
 
index 9c95154..62e7d21 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -87,7 +87,7 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
 
     if (((action.getRemainsNoUpdate() <= 0) && (action.getVariable()->get_weight() > 0)) ||
         ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
 
     if (((action.getRemainsNoUpdate() <= 0) && (action.getVariable()->get_weight() > 0)) ||
         ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
-      action.finish(Action::State::done);
+      action.finish(kernel::resource::Action::State::done);
     }
   }
 }
     }
   }
 }
@@ -118,7 +118,7 @@ StorageAction* StorageN11::write(sg_size_t size)
  * Action *
  **********/
 
  * Action *
  **********/
 
-StorageN11Action::StorageN11Action(Model* model, double cost, bool failed, StorageImpl* storage,
+StorageN11Action::StorageN11Action(kernel::resource::Model* model, double cost, bool failed, StorageImpl* storage,
                                    e_surf_action_storage_type_t type)
     : StorageAction(model, cost, failed, model->getMaxminSystem()->variable_new(this, 1.0, -1.0, 3), storage, type)
 {
                                    e_surf_action_storage_type_t type)
     : StorageAction(model, cost, failed, model->getMaxminSystem()->variable_new(this, 1.0, -1.0, 3), storage, type)
 {
index b6d8c4f..9414ac6 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2018. 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. */
 
 /* 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. */
@@ -53,7 +52,8 @@ public:
 
 class StorageN11Action : public StorageAction {
 public:
 
 class StorageN11Action : public StorageAction {
 public:
-  StorageN11Action(Model* model, double cost, bool failed, StorageImpl* storage, e_surf_action_storage_type_t type);
+  StorageN11Action(kernel::resource::Model* model, double cost, bool failed, StorageImpl* storage,
+                   e_surf_action_storage_type_t type);
   void suspend();
   int unref();
   void cancel();
   void suspend();
   int unref();
   void cancel();
index 98b5dd9..659be87 100644 (file)
@@ -150,28 +150,31 @@ double surf_solve(double max_date)
 /*********
  * MODEL *
  *********/
 /*********
  * MODEL *
  *********/
-static surf_action_t ActionListExtract(simgrid::surf::ActionList* list)
+static simgrid::kernel::resource::Action* ActionListExtract(simgrid::kernel::resource::ActionList* list)
 {
   if (list->empty())
     return nullptr;
 {
   if (list->empty())
     return nullptr;
-  surf_action_t res = &list->front();
+  simgrid::kernel::resource::Action* res = &list->front();
   list->pop_front();
   return res;
 }
 
   list->pop_front();
   return res;
 }
 
-surf_action_t surf_model_extract_done_action_set(surf_model_t model)
+simgrid::kernel::resource::Action* surf_model_extract_done_action_set(simgrid::kernel::resource::Model* model)
 {
   return ActionListExtract(model->getDoneActionSet());
 }
 
 {
   return ActionListExtract(model->getDoneActionSet());
 }
 
-surf_action_t surf_model_extract_failed_action_set(surf_model_t model){
+simgrid::kernel::resource::Action* surf_model_extract_failed_action_set(simgrid::kernel::resource::Model* model)
+{
   return ActionListExtract(model->getFailedActionSet());
 }
 
   return ActionListExtract(model->getFailedActionSet());
 }
 
-int surf_model_running_action_set_size(surf_model_t model){
+int surf_model_running_action_set_size(simgrid::kernel::resource::Model* model)
+{
   return model->getRunningActionSet()->size();
 }
 
   return model->getRunningActionSet()->size();
 }
 
-void surf_cpu_action_set_bound(surf_action_t action, double bound) {
+void surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound)
+{
   static_cast<simgrid::surf::CpuAction*>(action)->setBound(bound);
 }
   static_cast<simgrid::surf::CpuAction*>(action)->setBound(bound);
 }
index 222720f..f45907e 100644 (file)
@@ -29,7 +29,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, "Logging specific to SURF (ke
  * Utils *
  *********/
 
  * Utils *
  *********/
 
-std::vector<surf_model_t> * all_existing_models = nullptr; /* to destroy models correctly */
+std::vector<simgrid::kernel::resource::Model*>* all_existing_models = nullptr; /* to destroy models correctly */
 
 simgrid::trace_mgr::future_evt_set *future_evt_set = nullptr;
 std::vector<std::string> surf_path;
 
 simgrid::trace_mgr::future_evt_set *future_evt_set = nullptr;
 std::vector<std::string> surf_path;
@@ -307,7 +307,7 @@ void surf_init(int *argc, char **argv)
 
   xbt_init(argc, argv);
   if (not all_existing_models)
 
   xbt_init(argc, argv);
   if (not all_existing_models)
-    all_existing_models = new std::vector<simgrid::surf::Model*>();
+    all_existing_models = new std::vector<simgrid::kernel::resource::Model*>();
   if (not future_evt_set)
     future_evt_set = new simgrid::trace_mgr::future_evt_set();
 
   if (not future_evt_set)
     future_evt_set = new simgrid::trace_mgr::future_evt_set();
 
index b8e41a1..385a234 100644 (file)
@@ -80,6 +80,6 @@ int XBT_PRIVATE __surf_is_absolute_file_path(const char *file_path);
 /** \ingroup SURF_models
  *  \brief List of initialized models
  */
 /** \ingroup SURF_models
  *  \brief List of initialized models
  */
-XBT_PUBLIC_DATA(std::vector<surf_model_t>*) all_existing_models;
+XBT_PUBLIC_DATA(std::vector<simgrid::kernel::resource::Model*>*) all_existing_models;
 
 #endif /* SURF_MODEL_H_ */
 
 #endif /* SURF_MODEL_H_ */
index 333ecff..e05c1f5 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
-static const char *string_action(simgrid::surf::Action::State state)
+static const char* string_action(simgrid::kernel::resource::Action::State state)
 {
   switch (state) {
 {
   switch (state) {
-    case simgrid::surf::Action::State::ready:
+    case simgrid::kernel::resource::Action::State::ready:
       return "SURF_ACTION_READY";
       return "SURF_ACTION_READY";
-    case simgrid::surf::Action::State::running:
+    case simgrid::kernel::resource::Action::State::running:
       return "SURF_ACTION_RUNNING";
       return "SURF_ACTION_RUNNING";
-    case simgrid::surf::Action::State::failed:
+    case simgrid::kernel::resource::Action::State::failed:
       return "SURF_ACTION_FAILED";
       return "SURF_ACTION_FAILED";
-    case simgrid::surf::Action::State::done:
+    case simgrid::kernel::resource::Action::State::done:
       return "SURF_ACTION_DONE";
       return "SURF_ACTION_DONE";
-    case simgrid::surf::Action::State::not_in_the_system:
+    case simgrid::kernel::resource::Action::State::not_in_the_system:
       return "SURF_ACTION_NOT_IN_THE_SYSTEM";
     default:
       return "INVALID STATE";
       return "SURF_ACTION_NOT_IN_THE_SYSTEM";
     default:
       return "INVALID STATE";
@@ -44,13 +44,13 @@ int main(int argc, char **argv)
   simgrid::s4u::Host* hostB = sg_host_by_name("Cpu B");
 
   /* Let's do something on it */
   simgrid::s4u::Host* hostB = sg_host_by_name("Cpu B");
 
   /* Let's do something on it */
-  simgrid::surf::Action* actionA = hostA->pimpl_cpu->execution_start(1000.0);
-  simgrid::surf::Action* actionB = hostB->pimpl_cpu->execution_start(1000.0);
-  simgrid::surf::Action* actionC = hostB->pimpl_cpu->sleep(7.32);
+  simgrid::kernel::resource::Action* actionA = hostA->pimpl_cpu->execution_start(1000.0);
+  simgrid::kernel::resource::Action* actionB = hostB->pimpl_cpu->execution_start(1000.0);
+  simgrid::kernel::resource::Action* actionC = hostB->pimpl_cpu->sleep(7.32);
 
 
-  simgrid::surf::Action::State stateActionA = actionA->getState();
-  simgrid::surf::Action::State stateActionB = actionB->getState();
-  simgrid::surf::Action::State stateActionC = actionC->getState();
+  simgrid::kernel::resource::Action::State stateActionA = actionA->getState();
+  simgrid::kernel::resource::Action::State stateActionB = actionB->getState();
+  simgrid::kernel::resource::Action::State stateActionC = actionC->getState();
 
   /* And just look at the state of these tasks */
   XBT_INFO("actionA state: %s", string_action(stateActionA));
 
   /* And just look at the state of these tasks */
   XBT_INFO("actionA state: %s", string_action(stateActionA));
@@ -66,9 +66,9 @@ int main(int argc, char **argv)
     XBT_INFO("Next Event : %g", surf_get_clock());
     XBT_DEBUG("\t CPU actions");
 
     XBT_INFO("Next Event : %g", surf_get_clock());
     XBT_DEBUG("\t CPU actions");
 
-    simgrid::surf::ActionList* action_list = surf_cpu_model_pm->getFailedActionSet();
+    simgrid::kernel::resource::ActionList* action_list = surf_cpu_model_pm->getFailedActionSet();
     while (not action_list->empty()) {
     while (not action_list->empty()) {
-      simgrid::surf::Action& action = action_list->front();
+      simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   CPU Failed action");
       XBT_DEBUG("\t * Failed : %p", &action);
       action.unref();
       XBT_INFO("   CPU Failed action");
       XBT_DEBUG("\t * Failed : %p", &action);
       action.unref();
@@ -76,7 +76,7 @@ int main(int argc, char **argv)
 
     action_list = surf_cpu_model_pm->getDoneActionSet();
     while (not action_list->empty()) {
 
     action_list = surf_cpu_model_pm->getDoneActionSet();
     while (not action_list->empty()) {
-      simgrid::surf::Action& action = action_list->front();
+      simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   CPU Done action");
       XBT_DEBUG("\t * Done : %p", &action);
       action.unref();
       XBT_INFO("   CPU Done action");
       XBT_DEBUG("\t * Done : %p", &action);
       action.unref();
@@ -84,7 +84,7 @@ int main(int argc, char **argv)
 
     action_list = surf_network_model->getFailedActionSet();
     while (not action_list->empty()) {
 
     action_list = surf_network_model->getFailedActionSet();
     while (not action_list->empty()) {
-      simgrid::surf::Action& action = action_list->front();
+      simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   Network Failed action");
       XBT_DEBUG("\t * Failed : %p", &action);
       action.unref();
       XBT_INFO("   Network Failed action");
       XBT_DEBUG("\t * Failed : %p", &action);
       action.unref();
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
 
     action_list = surf_network_model->getDoneActionSet();
     while (not action_list->empty()) {
 
     action_list = surf_network_model->getDoneActionSet();
     while (not action_list->empty()) {
-      simgrid::surf::Action& action = action_list->front();
+      simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   Network Done action");
       XBT_DEBUG("\t * Done : %p", &action);
       action.unref();
       XBT_INFO("   Network Done action");
       XBT_DEBUG("\t * Done : %p", &action);
       action.unref();
index 41e5c97..1637939 100644 (file)
@@ -1,6 +1,6 @@
 /* A few basic tests for the surf library                                   */
 
 /* A few basic tests for the surf library                                   */
 
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
 
 /* 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. */
@@ -36,7 +36,7 @@ int main(int argc, char **argv)
 
   surf_solve(-1.0);                 /* Takes traces into account. Returns 0.0 */
   do {
 
   surf_solve(-1.0);                 /* Takes traces into account. Returns 0.0 */
   do {
-    surf_action_t action = nullptr;
+    simgrid::kernel::resource::Action* action = nullptr;
     running = 0;
 
     double now = surf_get_clock();
     running = 0;
 
     double now = surf_get_clock();