Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
obey our naming conventions
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 10 Feb 2017 20:59:42 +0000 (21:59 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 10 Feb 2017 22:57:56 +0000 (23:57 +0100)
26 files changed:
include/simgrid/s4u/Actor.hpp
src/instr/instr_interface.cpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/RoutedZone.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/s4u/s4u_actor.cpp
src/s4u/s4u_host.cpp
src/s4u/s4u_link.cpp
src/simix/smx_global.cpp
src/surf/HostImpl.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_ti.cpp
src/surf/instr_routing.cpp
src/surf/network_cm02.cpp
src/surf/network_interface.cpp
src/surf/network_ns3.cpp
src/surf/network_smpi.cpp
src/surf/plugins/energy.cpp
src/surf/ptask_L07.cpp
src/surf/storage_n11.cpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
teshsuite/simdag/flatifier/flatifier.cpp
teshsuite/surf/trace_usage/trace_usage.cpp

index 1eb18d1..40db256 100644 (file)
@@ -212,39 +212,39 @@ public:
 
   // ***** Methods *****
 
-  /** Retrieves the actor that have the given PID (or NULL if not existing) */
-  //static Actor *byPid(int pid); not implemented
-
   /** Retrieves the name of that actor */
-  simgrid::xbt::string getName();
+  simgrid::xbt::string name();
   /** Retrieves the host on which that actor is running */
-  s4u::Host *getHost();
+  s4u::Host* host();
   /** Retrieves the PID of that actor */
-  int getPid();
+  int pid();
   /** Retrieves the PPID of that actor */
-  int getPpid();
+  int ppid();
 
   /** If set to true, the actor will automatically restart when its host reboots */
   void setAutoRestart(bool autorestart);
   /** Sets the time at which that actor should be killed */
   void setKillTime(double time);
   /** Retrieves the time at which that actor will be killed (or -1 if not set) */
-  double getKillTime();
+  double killTime();
 
   /** Ask the actor to die.
    *
    * It will only notice your request when doing a simcall next time (a communication or similar).
    * SimGrid sometimes have issues when you kill actors that are currently communicating and such.
-   * We are working on it to fix the issues.
+   * Still. Please report any bug that you may encounter with a minimal working example.
    */
   void kill();
 
   static void kill(int pid);
-  static ActorPtr forPid(int pid);
-  
-  /**
-   * Wait for the actor to finish.
-   */ 
+
+  /** Retrieves the actor that have the given PID (or nullptr if not existing) */
+  static ActorPtr byPid(int pid);
+
+  /** @brief Wait for the actor to finish.
+   *
+   * This blocks the calling actor until the actor on which we call join() is terminated
+   */
   void join();
   
   // Static methods on all actors:
@@ -254,7 +254,7 @@ public:
 
 protected:
   /** Returns the internal implementation of this actor */
-  smx_actor_t getImpl();
+  simix::ActorImpl* getImpl();
 };
 
 /** @ingroup s4u_api
@@ -298,17 +298,12 @@ namespace this_actor {
    * See \ref Comm for the full communication API (including non blocking communications).
   */
   XBT_PUBLIC(void) send(MailboxPtr chan, void*payload, size_t simulatedSize);
-  
-  /**
-   * Return the PID of the current actor.
-   */
-  XBT_PUBLIC(int) getPid();
-  
-  /**
-   * Return the PPID of the current actor.
-   */
-  int getPpid();
 
+  /** @brief Return the PID of the current actor. */
+  XBT_PUBLIC(int) pid();
+
+  /** @brief Return the PPID of the current actor. */
+  int ppid();
 };
 
 /** @} */
index 2a7abcb..2952e59 100644 (file)
@@ -319,7 +319,7 @@ static void instr_user_srcdst_variable(double time, const char *src, const char
   std::vector<simgrid::surf::LinkImpl*> route;
   simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(src_elm, dst_elm, &route, nullptr);
   for (auto link : route)
-    instr_user_variable (time, link->getName(), variable, father_type, value, what, nullptr, user_link_variables);
+    instr_user_variable(time, link->cname(), variable, father_type, value, what, nullptr, user_link_variables);
 }
 
 /** \ingroup TRACE_API
index 6cc36f1..97edfcc 100644 (file)
@@ -84,7 +84,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges
 
   xbt_node_t backboneNode = nullptr;
   if (backbone_) {
-    backboneNode = new_xbt_graph_node(graph, backbone_->getName(), nodes);
+    backboneNode = new_xbt_graph_node(graph, backbone_->cname(), nodes);
     new_xbt_graph_edge(graph, routerNode, backboneNode, edges);
   }
 
@@ -95,7 +95,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges
       std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id());
 
       if (info.first) { // link up
-        xbt_node_t current = new_xbt_graph_node(graph, info.first->getName(), nodes);
+        xbt_node_t current = new_xbt_graph_node(graph, info.first->cname(), nodes);
         new_xbt_graph_edge(graph, previous, current, edges);
 
         if (backbone_) {
@@ -106,7 +106,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges
       }
 
       if (info.second) { // link down
-        xbt_node_t current = new_xbt_graph_node(graph, info.second->getName(), nodes);
+        xbt_node_t current = new_xbt_graph_node(graph, info.second->cname(), nodes);
         new_xbt_graph_edge(graph, previous, current, edges);
 
         if (backbone_) {
index 61e80c4..1d0207b 100644 (file)
@@ -100,7 +100,7 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
       }
 
       for (auto link : *route->link_list) {
-        const char* link_name = link->getName();
+        const char* link_name = link->cname();
         current               = new_xbt_graph_node(graph, link_name, nodes);
         current_name          = link_name;
         new_xbt_graph_edge(graph, previous, current, edges);
index 5bd81fd..785ef94 100644 (file)
@@ -78,9 +78,9 @@ double VMModel::nextOccuringEvent(double now)
 
     // TODO: check lmm_update_constraint_bound() works fine instead of the below manual substitution.
     // cpu_cas01->constraint->bound = solved_value;
-    xbt_assert(cpu->getModel() == surf_cpu_model_vm);
-    lmm_system_t vcpu_system = cpu->getModel()->getMaxminSystem();
-    lmm_update_constraint_bound(vcpu_system, cpu->getConstraint(), virt_overhead * solved_value);
+    xbt_assert(cpu->model() == surf_cpu_model_vm);
+    lmm_system_t vcpu_system = cpu->model()->getMaxminSystem();
+    lmm_update_constraint_bound(vcpu_system, cpu->constraint(), virt_overhead * solved_value);
   }
 
   /* 2. Calculate resource share at the virtual machine layer. */
index 6b6f990..58de67d 100644 (file)
@@ -51,34 +51,39 @@ ActorPtr Actor::createActor(const char* name, s4u::Host *host, double killTime,
 // ***** Actor methods *****
 
 void Actor::join() {
-  simcall_process_join(pimpl_, -1);
+  simcall_process_join(this->pimpl_, -1);
 }
 
 void Actor::setAutoRestart(bool autorestart) {
   simcall_process_auto_restart_set(pimpl_,autorestart);
 }
 
-s4u::Host *Actor::getHost() {
-  return pimpl_->host;
+s4u::Host* Actor::host()
+{
+  return this->pimpl_->host;
 }
 
-simgrid::xbt::string Actor::getName() {
-  return pimpl_->name;
+simgrid::xbt::string Actor::name()
+{
+  return this->pimpl_->name;
 }
 
-int Actor::getPid(){
-  return pimpl_->pid;
+int Actor::pid()
+{
+  return this->pimpl_->pid;
 }
 
-int Actor::getPpid() {
-  return pimpl_->ppid;
+int Actor::ppid()
+{
+  return this->pimpl_->ppid;
 }
 
 void Actor::setKillTime(double time) {
   simcall_process_set_kill_time(pimpl_,time);
 }
 
-double Actor::getKillTime() {
+double Actor::killTime()
+{
   return simcall_process_get_kill_time(pimpl_);
 }
 
@@ -103,7 +108,7 @@ void Actor::kill() {
 
 // ***** Static functions *****
 
-ActorPtr Actor::forPid(int pid)
+ActorPtr Actor::byPid(int pid)
 {
   smx_actor_t process = SIMIX_process_from_PID(pid);
   if (process != nullptr)
@@ -154,11 +159,13 @@ void send(MailboxPtr chan, void *payload, size_t simulatedSize) {
   c.wait();
 }
 
-int getPid() {
+int pid()
+{
   return SIMIX_process_self()->pid;
 }
 
-int getPpid() {
+int ppid()
+{
   return SIMIX_process_self()->ppid;
 }
 
index 2bf9491..ebf3823 100644 (file)
@@ -155,7 +155,7 @@ void Host::routeTo(Host* dest, std::vector<surf::LinkImpl*>* links, double* late
     XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", cname(), dest->cname(),
                (latency == nullptr ? -1 : *latency));
     for (auto link : *links)
-      XBT_CDEBUG(surf_route, "Link %s", link->getName());
+      XBT_CDEBUG(surf_route, "Link %s", link->cname());
   }
 }
 
index b1ce7b1..2f359e0 100644 (file)
@@ -85,7 +85,7 @@ Link* Link::byName(const char* name)
 }
 const char* Link::name()
 {
-  return this->pimpl_->getName();
+  return this->pimpl_->cname();
 }
 bool Link::isUsed()
 {
index f8e26e0..a3623c1 100644 (file)
@@ -235,7 +235,7 @@ void SIMIX_global_init(int *argc, char **argv)
     });
 
     simgrid::surf::storageCreatedCallbacks.connect([](simgrid::surf::Storage* storage) {
-      const char* name = storage->getName();
+      const char* name = storage->cname();
       // TODO, create sg_storage_by_name
       sg_storage_t s = xbt_lib_get_elm_or_null(storage_lib, name);
       xbt_assert(s != nullptr, "Storage not found for name %s", name);
index cd491cc..50b33f6 100644 (file)
@@ -32,7 +32,7 @@ void HostModel::adjustWeightOfDummyCpuActions()
 
     Cpu* cpu = ws_vm->pimpl_cpu;
 
-    int is_active = lmm_constraint_used(cpu->getModel()->getMaxminSystem(), cpu->getConstraint());
+    int is_active = lmm_constraint_used(cpu->model()->getMaxminSystem(), cpu->constraint());
 
     if (is_active) {
       /* some tasks exist on this VM */
@@ -128,7 +128,7 @@ xbt_dict_t HostImpl::getMountedStorageList()
   char* storage_name      = nullptr;
 
   xbt_dynar_foreach (storage_, i, mnt) {
-    storage_name = (char*)static_cast<simgrid::surf::Storage*>(mnt.storage)->getName();
+    storage_name = (char*)static_cast<simgrid::surf::Storage*>(mnt.storage)->cname();
     xbt_dict_set(storage_list, mnt.name, storage_name, nullptr);
   }
   return storage_list;
@@ -146,7 +146,7 @@ xbt_dynar_t HostImpl::getAttachedStorageList()
       simgrid::surf::Storage* storage = static_cast<simgrid::surf::Storage*>(
           xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
       if (!strcmp((const char*)storage->attach_, piface_->cname())) {
-        xbt_dynar_push_as(result, void*, (void*)storage->getName());
+        xbt_dynar_push_as(result, void*, (void*)storage->cname());
       }
     }
   }
@@ -189,7 +189,7 @@ xbt_dynar_t HostImpl::getAttachedStorageList()
       } else
         xbt_die("Can't find mount point for '%s' on '%s'", fullpath, piface_->cname());
 
-      XBT_DEBUG("OPEN %s on disk '%s'", path, st->getName());
+      XBT_DEBUG("OPEN %s on disk '%s'", path, st->cname());
       Action* action = st->open((const char*)mount_name, (const char*)path);
       free((char*)path);
       free((char*)mount_name);
@@ -199,21 +199,21 @@ xbt_dynar_t HostImpl::getAttachedStorageList()
     Action* HostImpl::close(surf_file_t fd)
     {
       simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
-      XBT_DEBUG("CLOSE %s on disk '%s'", fd->name, st->getName());
+      XBT_DEBUG("CLOSE %s on disk '%s'", fd->name, st->cname());
       return st->close(fd);
     }
 
     Action* HostImpl::read(surf_file_t fd, sg_size_t size)
     {
       simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
-      XBT_DEBUG("READ %s on disk '%s'", fd->name, st->getName());
+      XBT_DEBUG("READ %s on disk '%s'", fd->name, st->cname());
       return st->read(fd, size);
     }
 
     Action* HostImpl::write(surf_file_t fd, sg_size_t size)
     {
       simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
-      XBT_DEBUG("WRITE %s on disk '%s'", fd->name, st->getName());
+      XBT_DEBUG("WRITE %s on disk '%s'", fd->name, st->cname());
       return st->write(fd, size);
     }
 
@@ -227,10 +227,10 @@ xbt_dynar_t HostImpl::getAttachedStorageList()
         simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
         /* Check if the file is on this storage */
         if (!xbt_dict_get_or_null(st->content_, fd->name)) {
-          XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name, st->getName());
+          XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name, st->cname());
           return -1;
         } else {
-          XBT_DEBUG("UNLINK %s on disk '%s'", fd->name, st->getName());
+          XBT_DEBUG("UNLINK %s on disk '%s'", fd->name, st->cname());
           st->usedSize_ -= fd->size;
 
           // Remove the file from storage
@@ -257,7 +257,7 @@ xbt_dynar_t HostImpl::getAttachedStorageList()
       xbt_dynar_t info           = xbt_dynar_new(sizeof(void*), nullptr);
       xbt_dynar_push_as(info, sg_size_t*, psize);
       xbt_dynar_push_as(info, void*, fd->mount);
-      xbt_dynar_push_as(info, void*, (void*)st->getName());
+      xbt_dynar_push_as(info, void*, (void*)st->cname());
       xbt_dynar_push_as(info, void*, st->typeId_);
       xbt_dynar_push_as(info, void*, st->contentType_);
 
index cb11f06..04db0b1 100644 (file)
@@ -91,7 +91,7 @@ CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, std::vector<d
 
 CpuCas01::~CpuCas01()
 {
-  if (getModel() == surf_cpu_model_pm)
+  if (model() == surf_cpu_model_pm)
     speedPerPstate_.clear();
 }
 
@@ -101,7 +101,7 @@ std::vector<double> * CpuCas01::getSpeedPeakList(){
 
 bool CpuCas01::isUsed()
 {
-  return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint());
+  return lmm_constraint_used(model()->getMaxminSystem(), constraint());
 }
 
 /** @brief take into account changes of speed (either load or max) */
@@ -109,12 +109,11 @@ void CpuCas01::onSpeedChange() {
   lmm_variable_t var = nullptr;
   lmm_element_t elem = nullptr;
 
-    lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(),
-                                coresAmount_ * speed_.scale * speed_.peak);
-    while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
-      CpuCas01Action *action = static_cast<CpuCas01Action*>(lmm_variable_id(var));
+  lmm_update_constraint_bound(model()->getMaxminSystem(), constraint(), coresAmount_ * speed_.scale * speed_.peak);
+  while ((var = lmm_get_var_from_cnst(model()->getMaxminSystem(), constraint(), &elem))) {
+    CpuCas01Action* action = static_cast<CpuCas01Action*>(lmm_variable_id(var));
 
-      lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), speed_.scale * speed_.peak);
+    lmm_update_variable_bound(model()->getMaxminSystem(), action->getVariable(), speed_.scale * speed_.peak);
     }
 
   Cpu::onSpeedChange();
@@ -139,14 +138,14 @@ void CpuCas01::apply_event(tmgr_trace_iterator_t event, double value)
         host_that_restart.push_back(getHost());
       turnOn();
     } else {
-      lmm_constraint_t cnst = getConstraint();
+      lmm_constraint_t cnst = constraint();
       lmm_variable_t var = nullptr;
       lmm_element_t elem = nullptr;
       double date = surf_get_clock();
 
       turnOff();
 
-      while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), cnst, &elem))) {
+      while ((var = lmm_get_var_from_cnst(model()->getMaxminSystem(), cnst, &elem))) {
         Action *action = static_cast<Action*>(lmm_variable_id(var));
 
         if (action->getState() == Action::State::running ||
@@ -166,7 +165,7 @@ void CpuCas01::apply_event(tmgr_trace_iterator_t event, double value)
 
 CpuAction *CpuCas01::execution_start(double size)
 {
-  return new CpuCas01Action(getModel(), size, isOff(), speed_.scale * speed_.peak, getConstraint());
+  return new CpuCas01Action(model(), size, isOff(), speed_.scale * speed_.peak, constraint());
 }
 
 CpuAction *CpuCas01::sleep(double duration)
@@ -174,8 +173,8 @@ CpuAction *CpuCas01::sleep(double duration)
   if (duration > 0)
     duration = MAX(duration, sg_surf_precision);
 
-  XBT_IN("(%s,%g)", getName(), duration);
-  CpuCas01Action *action = new CpuCas01Action(getModel(), 1.0, isOff(), speed_.scale * speed_.peak, getConstraint());
+  XBT_IN("(%s,%g)", cname(), duration);
+  CpuCas01Action* action = new CpuCas01Action(model(), 1.0, isOff(), speed_.scale * speed_.peak, constraint());
 
   // FIXME: sleep variables should not consume 1.0 in lmm_expand
   action->maxDuration_ = duration;
@@ -183,16 +182,16 @@ CpuAction *CpuCas01::sleep(double duration)
   if (duration == NO_MAX_DURATION) {
     /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
     action->getStateSet()->erase(action->getStateSet()->iterator_to(*action));
-    action->stateSet_ = static_cast<CpuCas01Model*>(getModel())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
+    action->stateSet_ = static_cast<CpuCas01Model*>(model())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
     action->getStateSet()->push_back(*action);
   }
 
-  lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), 0.0);
-  if (getModel()->getUpdateMechanism() == UM_LAZY) {     // remove action from the heap
-    action->heapRemove(getModel()->getActionHeap());
+  lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), 0.0);
+  if (model()->getUpdateMechanism() == UM_LAZY) { // remove action from the heap
+    action->heapRemove(model()->getActionHeap());
     // this is necessary for a variable with weight 0 since such variables are ignored in lmm and we need to set its
     // max_duration correctly at the next call to share_resources
-    getModel()->getModifiedSet()->push_front(*action);
+    model()->getModifiedSet()->push_front(*action);
   }
 
   XBT_OUT();
index e9fb0c7..177c968 100644 (file)
@@ -31,10 +31,8 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
     XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
     if (TRACE_is_enabled()) {
       Cpu *cpu = static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)));
-      TRACE_surf_host_set_utilization(cpu->getName(), action->getCategory(),
-                                      lmm_variable_getvalue(action->getVariable()),
-                                      action->getLastUpdate(),
-                                      now - action->getLastUpdate());
+      TRACE_surf_host_set_utilization(cpu->cname(), action->getCategory(), lmm_variable_getvalue(action->getVariable()),
+                                      action->getLastUpdate(), now - action->getLastUpdate());
     }
 
     action->finish();
@@ -78,11 +76,8 @@ void CpuModel::updateActionsStateFull(double now, double delta)
     if (TRACE_is_enabled()) {
       Cpu *cpu = static_cast<Cpu*> (lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)) );
 
-      TRACE_surf_host_set_utilization(cpu->getName(),
-                                      action->getCategory(),
-                                      lmm_variable_getvalue(action->getVariable()),
-                                      now - delta,
-                                      delta);
+      TRACE_surf_host_set_utilization(cpu->cname(), action->getCategory(), lmm_variable_getvalue(action->getVariable()),
+                                      now - delta, delta);
       TRACE_last_timestamp_to_dump = now - delta;
     }
 
@@ -147,8 +142,8 @@ int Cpu::getNbPStates()
 void Cpu::setPState(int pstate_index)
 {
   xbt_assert(pstate_index <= static_cast<int>(speedPerPstate_.size()),
-      "Invalid parameters for CPU %s (pstate %d > length of pstates %d)", getName(), pstate_index,
-      static_cast<int>(speedPerPstate_.size()));
+             "Invalid parameters for CPU %s (pstate %d > length of pstates %d)", cname(), pstate_index,
+             static_cast<int>(speedPerPstate_.size()));
 
   double new_peak_speed = speedPerPstate_[pstate_index];
   pstate_ = pstate_index;
@@ -181,7 +176,7 @@ double Cpu::getAvailableSpeed()
 }
 
 void Cpu::onSpeedChange() {
-  TRACE_surf_host_set_speed(surf_get_clock(), getName(), coresAmount_ * speed_.scale * speed_.peak);
+  TRACE_surf_host_set_speed(surf_get_clock(), cname(), coresAmount_ * speed_.scale * speed_.peak);
 }
 
 int Cpu::coreCount()
@@ -220,7 +215,7 @@ void CpuAction::updateRemainingLazy(double now)
 
     if (TRACE_is_enabled()) {
       Cpu *cpu = static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0)));
-      TRACE_surf_host_set_utilization(cpu->getName(), getCategory(), lastValue_, lastUpdate_, now - lastUpdate_);
+      TRACE_surf_host_set_utilization(cpu->cname(), getCategory(), lastValue_, lastUpdate_, now - lastUpdate_);
     }
     XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, remains_);
   }
index 530a2e2..b55d21e 100644 (file)
@@ -475,8 +475,8 @@ void CpuTi::apply_event(tmgr_trace_iterator_t event, double value)
           action->setFinishTime(date);
           action->setState(Action::State::failed);
           if (action->indexHeap_ >= 0) {
-            CpuTiAction *heap_act =
-                static_cast<CpuTiAction*>(xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->tiActionHeap_, action->indexHeap_));
+            CpuTiAction* heap_act = static_cast<CpuTiAction*>(
+                xbt_heap_remove(static_cast<CpuTiModel*>(model())->tiActionHeap_, action->indexHeap_));
             if (heap_act != action)
               DIE_IMPOSSIBLE;
           }
@@ -547,16 +547,16 @@ void CpuTi::updateActionsFinishTime(double now)
     /* add in action heap */
     XBT_DEBUG("action(%p) index %d", action, action->indexHeap_);
     if (action->indexHeap_ >= 0) {
-      CpuTiAction *heap_act =
-          static_cast<CpuTiAction*>(xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->tiActionHeap_, action->indexHeap_));
+      CpuTiAction* heap_act = static_cast<CpuTiAction*>(
+          xbt_heap_remove(static_cast<CpuTiModel*>(model())->tiActionHeap_, action->indexHeap_));
       if (heap_act != action)
         DIE_IMPOSSIBLE;
     }
     if (min_finish > NO_MAX_DURATION)
-      xbt_heap_push(static_cast<CpuTiModel*>(getModel())->tiActionHeap_, action, min_finish);
+      xbt_heap_push(static_cast<CpuTiModel*>(model())->tiActionHeap_, action, min_finish);
 
-    XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f",
-         getName(), action, action->getStartTime(), action->finishTime_, action->getMaxDuration());
+    XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", cname(), action,
+              action->getStartTime(), action->finishTime_, action->getMaxDuration());
   }
   /* remove from modified cpu */
   modified(false);
@@ -588,7 +588,7 @@ void CpuTi::updateRemainingAmount(double now)
   for(ActionTiList::iterator it(actionSet_->begin()), itend(actionSet_->end()) ; it != itend ; ++it) {
     CpuTiAction *action = &*it;
     /* action not running, skip it */
-    if (action->getStateSet() != getModel()->getRunningActionSet())
+    if (action->getStateSet() != model()->getRunningActionSet())
       continue;
 
     /* bogus priority, skip it */
@@ -616,8 +616,8 @@ void CpuTi::updateRemainingAmount(double now)
 
 CpuAction *CpuTi::execution_start(double size)
 {
-  XBT_IN("(%s,%g)", getName(), size);
-  CpuTiAction *action = new CpuTiAction(static_cast<CpuTiModel*>(getModel()), size, isOff(), this);
+  XBT_IN("(%s,%g)", cname(), size);
+  CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), size, isOff(), this);
 
   actionSet_->push_back(*action);
 
@@ -631,8 +631,8 @@ CpuAction *CpuTi::sleep(double duration)
   if (duration > 0)
     duration = MAX(duration, sg_surf_precision);
 
-  XBT_IN("(%s,%g)", getName(), duration);
-  CpuTiAction *action = new CpuTiAction(static_cast<CpuTiModel*>(getModel()), 1.0, isOff(), this);
+  XBT_IN("(%s,%g)", cname(), duration);
+  CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), 1.0, isOff(), this);
 
   action->maxDuration_ = duration;
   action->suspended_ = 2;
@@ -640,8 +640,8 @@ CpuAction *CpuTi::sleep(double duration)
    /* Move to the *end* of the corresponding action set. This convention
       is used to speed up update_resource_state  */
   action->getStateSet()->erase(action->getStateSet()->iterator_to(*action));
-    action->stateSet_ = static_cast<CpuTiModel*>(getModel())->runningActionSetThatDoesNotNeedBeingChecked_;
-    action->getStateSet()->push_back(*action);
+  action->stateSet_ = static_cast<CpuTiModel*>(model())->runningActionSetThatDoesNotNeedBeingChecked_;
+  action->getStateSet()->push_back(*action);
   }
 
   actionSet_->push_back(*action);
@@ -651,7 +651,7 @@ CpuAction *CpuTi::sleep(double duration)
 }
 
 void CpuTi::modified(bool modified){
-  CpuTiList *modifiedCpu = static_cast<CpuTiModel*>(getModel())->modifiedCpu_;
+  CpuTiList* modifiedCpu = static_cast<CpuTiModel*>(model())->modifiedCpu_;
   if (modified) {
     if (!cpu_ti_hook.is_linked()) {
       modifiedCpu->push_back(*this);
index f9ebbc6..89e9787 100644 (file)
@@ -215,7 +215,7 @@ static void instr_routing_parse_start_link(simgrid::surf::LinkImpl* link)
   double bandwidth_value = link->bandwidth();
   double latency_value   = link->latency();
 
-  container_t container = PJ_container_new(link->getName(), INSTR_LINK, father);
+  container_t container = PJ_container_new(link->cname(), INSTR_LINK, father);
 
   if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_link())) {
     type_t bandwidth = PJ_type_get_or_null("bandwidth", container->type);
index 72a7965..7f4e900 100644 (file)
@@ -191,8 +191,8 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
         NetworkCm02Link *link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
         double value = lmm_variable_getvalue(action->getVariable())*
             lmm_get_cnst_weight_from_var(maxminSystem_, action->getVariable(), i);
-        TRACE_surf_link_set_utilization(link->getName(), action->getCategory(), value,
-           action->getLastUpdate(), now - action->getLastUpdate());
+        TRACE_surf_link_set_utilization(link->cname(), action->getCategory(), value, action->getLastUpdate(),
+                                        now - action->getLastUpdate());
       }
     }
 
@@ -248,14 +248,10 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
           lmm_constraint_t constraint = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i);
 
           NetworkCm02Link* link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
-          TRACE_surf_link_set_utilization(link->getName(),
-                                        action->getCategory(),
-                                        (lmm_variable_getvalue(action->getVariable())*
-                                            lmm_get_cnst_weight_from_var(maxminSystem_,
-                                                action->getVariable(),
-                                                i)),
-                                        action->getLastUpdate(),
-                                        now - action->getLastUpdate());
+          TRACE_surf_link_set_utilization(link->cname(), action->getCategory(),
+                                          (lmm_variable_getvalue(action->getVariable()) *
+                                           lmm_get_cnst_weight_from_var(maxminSystem_, action->getVariable(), i)),
+                                          action->getLastUpdate(), now - action->getLastUpdate());
         }
       }
       if (!lmm_get_number_of_cnst_from_var (maxminSystem_, action->getVariable())) {
@@ -365,13 +361,13 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   }
 
   for (auto link: *route)
-    lmm_expand(maxminSystem_, link->getConstraint(), action->getVariable(), 1.0);
+    lmm_expand(maxminSystem_, link->constraint(), action->getVariable(), 1.0);
 
   if (back_route != nullptr) { //  sg_network_crosstraffic was activated
     XBT_DEBUG("Fullduplex active adding backward flow using 5%%");
     for (auto link : *back_route)
-      lmm_expand(maxminSystem_, link->getConstraint(), action->getVariable(), .05);
-     
+      lmm_expand(maxminSystem_, link->constraint(), action->getVariable(), .05);
+
     //Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
     //(You would also have to change lmm_element_concurrency())
     //lmm_variable_concurrency_share_set(action->getVariable(),2);
@@ -403,7 +399,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, doub
   latency_.peak  = latency;
 
   if (policy == SURF_LINK_FATPIPE)
-    lmm_constraint_shared(getConstraint());
+    lmm_constraint_shared(constraint());
 
   LinkImpl::onCreation(this);
 }
@@ -431,7 +427,7 @@ void NetworkCm02Link::apply_event(tmgr_trace_iterator_t triggered, double value)
       double now = surf_get_clock();
 
       turnOff();
-      while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
+      while ((var = lmm_get_var_from_cnst(model()->getMaxminSystem(), constraint(), &elem))) {
         Action *action = static_cast<Action*>( lmm_variable_id(var) );
 
         if (action->getState() == Action::State::running ||
@@ -446,8 +442,7 @@ void NetworkCm02Link::apply_event(tmgr_trace_iterator_t triggered, double value)
     xbt_die("Unknown event!\n");
   }
 
-  XBT_DEBUG("There was a resource state event, need to update actions related to the constraint (%p)",
-       getConstraint());
+  XBT_DEBUG("There was a resource state event, need to update actions related to the constraint (%p)", constraint());
 }
 
 void NetworkCm02Link::setBandwidth(double value)
@@ -455,9 +450,9 @@ void NetworkCm02Link::setBandwidth(double value)
 
   bandwidth_.peak = value;
 
-  lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(),
+  lmm_update_constraint_bound(model()->getMaxminSystem(), constraint(),
                               sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale));
-  TRACE_surf_link_set_bandwidth(surf_get_clock(), getName(), sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale);
+  TRACE_surf_link_set_bandwidth(surf_get_clock(), cname(), sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale);
 
   if (sg_weight_S_parameter > 0) {
     double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale);
@@ -465,11 +460,11 @@ void NetworkCm02Link::setBandwidth(double value)
     lmm_variable_t var;
     lmm_element_t elem = nullptr, nextelem = nullptr;
     int numelem = 0;
-    while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
+    while ((var = lmm_get_var_from_cnst_safe(model()->getMaxminSystem(), constraint(), &elem, &nextelem, &numelem))) {
       NetworkCm02Action *action = (NetworkCm02Action*) lmm_variable_id(var);
       action->weight_ += delta;
       if (!action->isSuspended())
-        lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->weight_);
+        lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), action->weight_);
     }
   }
 }
@@ -484,14 +479,15 @@ void NetworkCm02Link::setLatency(double value)
 
   latency_.peak = value;
 
-  while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
+  while ((var = lmm_get_var_from_cnst_safe(model()->getMaxminSystem(), constraint(), &elem, &nextelem, &numelem))) {
     NetworkCm02Action *action = (NetworkCm02Action*) lmm_variable_id(var);
     action->latCurrent_ += delta;
     action->weight_ += delta;
     if (action->rate_ < 0)
-      lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), sg_tcp_gamma / (2.0 * action->latCurrent_));
+      lmm_update_variable_bound(model()->getMaxminSystem(), action->getVariable(),
+                                sg_tcp_gamma / (2.0 * action->latCurrent_));
     else {
-      lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(),
+      lmm_update_variable_bound(model()->getMaxminSystem(), action->getVariable(),
                                 std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)));
 
       if (action->rate_ < sg_tcp_gamma / (2.0 * action->latCurrent_)) {
@@ -501,7 +497,7 @@ void NetworkCm02Link::setLatency(double value)
       }
     }
     if (!action->isSuspended())
-      lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->weight_);
+      lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), action->weight_);
   }
 }
 
index 7584401..f88f52b 100644 (file)
@@ -144,7 +144,7 @@ namespace simgrid {
 
     bool LinkImpl::isUsed()
     {
-      return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint());
+      return lmm_constraint_used(model()->getMaxminSystem(), constraint());
     }
 
     double LinkImpl::latency()
@@ -159,7 +159,7 @@ namespace simgrid {
 
     int LinkImpl::sharingPolicy()
     {
-      return lmm_constraint_sharing_policy(getConstraint());
+      return lmm_constraint_sharing_policy(constraint());
     }
 
     void LinkImpl::turnOn()
@@ -178,17 +178,17 @@ namespace simgrid {
     }
     void LinkImpl::setStateTrace(tmgr_trace_t trace)
     {
-      xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Link %s", getName());
+      xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Link %s", cname());
       stateEvent_ = future_evt_set->add_trace(trace, 0.0, this);
     }
     void LinkImpl::setBandwidthTrace(tmgr_trace_t trace)
     {
-      xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth trace to Link %s", getName());
+      xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth trace to Link %s", cname());
       bandwidth_.event = future_evt_set->add_trace(trace, 0.0, this);
     }
     void LinkImpl::setLatencyTrace(tmgr_trace_t trace)
     {
-      xbt_assert(latency_.event == nullptr, "Cannot set a second latency trace to Link %s", getName());
+      xbt_assert(latency_.event == nullptr, "Cannot set a second latency trace to Link %s", cname());
       latency_.event = future_evt_set->add_trace(trace, 0.0, this);
     }
 
index c82909d..76722a8 100644 (file)
@@ -97,13 +97,13 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin
   if (link_list->size() == 1) {
     simgrid::surf::LinkNS3* link = static_cast<simgrid::surf::LinkNS3*>(link_list->at(0));
 
-    XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->cname(), dst->cname(), link->getName(),
+    XBT_DEBUG("Route from '%s' to '%s' with link '%s' %s", src->cname(), dst->cname(), link->cname(),
               (symmetrical ? "(symmetrical)" : "(not symmetrical)"));
     char* link_bdw = bprintf("%fBps", link->bandwidth());
     char* link_lat = bprintf("%fs", link->latency());
 
     //   XBT_DEBUG("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id);
-    XBT_DEBUG("\tLink (%s) bdw:%s lat:%s", link->getName(), link_bdw, link_lat);
+    XBT_DEBUG("\tLink (%s) bdw:%s lat:%s", link->cname(), link_bdw, link_lat);
 
     // create link ns3
     NetPointNs3* host_src = src->extension<NetPointNs3>();
@@ -235,7 +235,8 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
 
       action->src_->routeTo(action->dst_, &route, nullptr);
       for (auto link : route)
-        TRACE_surf_link_set_utilization (link->getName(), action->getCategory(), (data_delta_sent)/delta, now-delta, delta);
+        TRACE_surf_link_set_utilization(link->cname(), action->getCategory(), (data_delta_sent) / delta, now - delta,
+                                        delta);
 
       action->lastSent_ = sgFlow->sentBytes_;
     }
index e79e6cc..4531307 100644 (file)
@@ -61,7 +61,7 @@ namespace simgrid {
 
     void NetworkSmpiModel::gapAppend(double size, LinkImpl* link, NetworkAction* act)
     {
-      const char *src = link->getName();
+      const char* src = link->cname();
       xbt_fifo_t fifo;
       NetworkCm02Action *action= static_cast<NetworkCm02Action*>(act);
 
index 26d723f..97e99fd 100644 (file)
@@ -72,7 +72,7 @@ void HostEnergy::update()
     // We consider that the machine is then fully loaded. That's arbitrary but it avoids a NaN
     cpu_load = 1;
   else
-    cpu_load = lmm_constraint_get_usage(host->pimpl_cpu->getConstraint()) / host->pimpl_cpu->getPstateSpeedCurrent();
+    cpu_load = lmm_constraint_get_usage(host->pimpl_cpu->constraint()) / host->pimpl_cpu->getPstateSpeedCurrent();
 
   /** Divide by the number of cores here **/
   cpu_load /= host->pimpl_cpu->coreCount();
index aff790d..2f0ccdc 100644 (file)
@@ -178,7 +178,7 @@ L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
           latency = MAX(latency, lat);
 
           for (auto link : route)
-            affected_links.insert(link->getName());
+            affected_links.insert(link->cname());
         }
       }
     }
@@ -201,8 +201,7 @@ L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
     lmm_update_variable_weight(model->getMaxminSystem(), this->getVariable(), 0.0);
 
   for (int i = 0; i < host_nb; i++)
-    lmm_expand(model->getMaxminSystem(), host_list[i]->pimpl_cpu->getConstraint(),
-        this->getVariable(), flops_amount[i]);
+    lmm_expand(model->getMaxminSystem(), host_list[i]->pimpl_cpu->constraint(), this->getVariable(), flops_amount[i]);
 
   if(bytes_amount != nullptr) {
     for (int i = 0; i < host_nb; i++) {
@@ -215,7 +214,8 @@ L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
         hostList_->at(i)->routeTo(hostList_->at(j), &route, nullptr);
 
         for (auto link : route)
-          lmm_expand_add(model->getMaxminSystem(), link->getConstraint(), this->getVariable(), bytes_amount[i * host_nb + j]);
+          lmm_expand_add(model->getMaxminSystem(), link->constraint(), this->getVariable(),
+                         bytes_amount[i * host_nb + j]);
       }
     }
   }
@@ -271,7 +271,7 @@ LinkL07::LinkL07(NetworkL07Model* model, const char* name, double bandwidth, dou
   latency_.peak   = latency;
 
   if (policy == SURF_LINK_FATPIPE)
-    lmm_constraint_shared(getConstraint());
+    lmm_constraint_shared(constraint());
 
   LinkImpl::onCreation(this);
 }
@@ -284,7 +284,7 @@ Action *CpuL07::execution_start(double size)
   host_list[0] = getHost();
   flops_amount[0] = size;
 
-  return static_cast<CpuL07Model*>(getModel())->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)
@@ -292,13 +292,13 @@ Action *CpuL07::sleep(double duration)
   L07Action *action = static_cast<L07Action*>(execution_start(1.0));
   action->maxDuration_ = duration;
   action->suspended_ = 2;
-  lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), 0.0);
+  lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), 0.0);
 
   return action;
 }
 
 bool CpuL07::isUsed(){
-  return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint());
+  return lmm_constraint_used(model()->getMaxminSystem(), constraint());
 }
 
 /** @brief take into account changes of speed (either load or max) */
@@ -306,11 +306,11 @@ void CpuL07::onSpeedChange() {
   lmm_variable_t var = nullptr;
   lmm_element_t elem = nullptr;
 
-    lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(), speed_.peak * speed_.scale);
-    while ((var = lmm_get_var_from_cnst (getModel()->getMaxminSystem(), getConstraint(), &elem))) {
-      Action *action = static_cast<Action*>(lmm_variable_id(var));
+  lmm_update_constraint_bound(model()->getMaxminSystem(), constraint(), speed_.peak * speed_.scale);
+  while ((var = lmm_get_var_from_cnst(model()->getMaxminSystem(), constraint(), &elem))) {
+    Action* action = static_cast<Action*>(lmm_variable_id(var));
 
-      lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), speed_.scale * speed_.peak);
+    lmm_update_variable_bound(model()->getMaxminSystem(), action->getVariable(), speed_.scale * speed_.peak);
     }
 
   Cpu::onSpeedChange();
@@ -318,11 +318,11 @@ void CpuL07::onSpeedChange() {
 
 
 bool LinkL07::isUsed(){
-  return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint());
+  return lmm_constraint_used(model()->getMaxminSystem(), constraint());
 }
 
 void CpuL07::apply_event(tmgr_trace_iterator_t triggered, double value){
-  XBT_DEBUG("Updating cpu %s (%p) with value %g", getName(), this, value);
+  XBT_DEBUG("Updating cpu %s (%p) with value %g", cname(), this, value);
   if (triggered == speed_.event) {
     speed_.scale = value;
     onSpeedChange();
@@ -341,7 +341,7 @@ void CpuL07::apply_event(tmgr_trace_iterator_t triggered, double value){
 }
 
 void LinkL07::apply_event(tmgr_trace_iterator_t triggered, double value) {
-  XBT_DEBUG("Updating link %s (%p) with value=%f", getName(), this, value);
+  XBT_DEBUG("Updating link %s (%p) with value=%f", cname(), this, value);
   if (triggered == bandwidth_.event) {
     setBandwidth(value);
     tmgr_trace_event_unref(&bandwidth_.event);
@@ -365,7 +365,7 @@ void LinkL07::apply_event(tmgr_trace_iterator_t triggered, double value) {
 void LinkL07::setBandwidth(double value)
 {
   bandwidth_.peak = value;
-  lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(), bandwidth_.peak * bandwidth_.scale);
+  lmm_update_constraint_bound(model()->getMaxminSystem(), constraint(), bandwidth_.peak * bandwidth_.scale);
 }
 
 void LinkL07::setLatency(double value)
@@ -375,7 +375,7 @@ void LinkL07::setLatency(double value)
   lmm_element_t elem = nullptr;
 
   latency_.peak = value;
-  while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
+  while ((var = lmm_get_var_from_cnst(model()->getMaxminSystem(), constraint(), &elem))) {
     action = static_cast<L07Action*>(lmm_variable_id(var));
     action->updateBound();
   }
index 4f892d0..88b7996 100644 (file)
@@ -45,7 +45,7 @@ static void check_disk_attachment()
           static_cast<simgrid::surf::Storage*>(xbt_lib_get_or_null(storage_lib, key, SURF_STORAGE_LEVEL));
       simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(storage->attach_);
       if (!host_elm)
-        surf_parse_error("Unable to attach storage %s: host %s does not exist.", storage->getName(), storage->attach_);
+        surf_parse_error("Unable to attach storage %s: host %s does not exist.", storage->cname(), storage->attach_);
     }
   }
 }
@@ -210,7 +210,7 @@ StorageAction *StorageN11::open(const char* mount, const char* path)
   file->mount = xbt_strdup(mount);
   file->current_position = 0;
 
-  StorageAction *action = new StorageN11Action(getModel(), 0, isOff(), this, OPEN);
+  StorageAction* action = new StorageN11Action(model(), 0, isOff(), this, OPEN);
   action->file_         = file;
 
   return action;
@@ -232,7 +232,7 @@ StorageAction *StorageN11::close(surf_file_t fd)
   free(fd->name);
   free(fd->mount);
   xbt_free(fd);
-  StorageAction *action = new StorageN11Action(getModel(), 0, isOff(), this, CLOSE);
+  StorageAction* action = new StorageN11Action(model(), 0, isOff(), this, CLOSE);
   return action;
 }
 
@@ -249,7 +249,7 @@ StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size)
   else
     fd->current_position += size;
 
-  StorageAction *action = new StorageN11Action(getModel(), size, isOff(), this, READ);
+  StorageAction* action = new StorageN11Action(model(), size, isOff(), this, READ);
   return action;
 }
 
@@ -258,7 +258,7 @@ StorageAction *StorageN11::write(surf_file_t fd, sg_size_t size)
   char *filename = fd->name;
   XBT_DEBUG("\tWrite file '%s' size '%llu/%llu'",filename,size,fd->size);
 
-  StorageAction *action = new StorageN11Action(getModel(), size, isOff(), this, WRITE);
+  StorageAction* action = new StorageN11Action(model(), size, isOff(), this, WRITE);
   action->file_         = fd;
   /* Substract the part of the file that might disappear from the used sized on the storage element */
   usedSize_ -= (fd->size - fd->current_position);
@@ -277,10 +277,10 @@ StorageN11Action::StorageN11Action(Model *model, double cost, bool failed, Stora
 : StorageAction(model, cost, failed,
     lmm_variable_new(model->getMaxminSystem(), this, 1.0, -1.0 , 3),
     storage, type) {
-  XBT_IN("(%s,%g", storage->getName(), cost);
+  XBT_IN("(%s,%g", storage->cname(), cost);
 
   // Must be less than the max bandwidth for all actions
-  lmm_expand(model->getMaxminSystem(), storage->getConstraint(), getVariable(), 1.0);
+  lmm_expand(model->getMaxminSystem(), storage->constraint(), getVariable(), 1.0);
   switch(type) {
   case OPEN:
   case CLOSE:
index ed0f2fc..8911c85 100644 (file)
@@ -102,7 +102,7 @@ double surf_solve(double max_date)
     XBT_DEBUG("Updating models (min = %g, NOW = %g, next_event_date = %g)", time_delta, NOW, next_event_date);
 
     while ((event = future_evt_set->pop_leq(next_event_date, &value, &resource))) {
-      if (resource->isUsed() || xbt_dict_get_or_null(watched_hosts_lib, resource->getName())) {
+      if (resource->isUsed() || xbt_dict_get_or_null(watched_hosts_lib, resource->cname())) {
         time_delta = next_event_date - NOW;
         XBT_DEBUG("This event invalidates the next_occuring_event() computation of models. Next event set to %f", time_delta);
       }
@@ -111,7 +111,7 @@ double surf_solve(double max_date)
       NOW = next_event_date;
       /* update state of the corresponding resource to the new value. Does not touch lmm.
          It will be modified if needed when updating actions */
-      XBT_DEBUG("Calling update_resource_state for resource %s", resource->getName());
+      XBT_DEBUG("Calling update_resource_state for resource %s", resource->cname());
       resource->apply_event(event, value);
       NOW = round_start;
     }
index 623aeba..dad5cb0 100644 (file)
@@ -579,11 +579,13 @@ void Resource::turnOff()
   isOn_ = false;
 }
 
-Model *Resource::getModel() const {
+Model* Resource::model() const
+{
   return model_;
 }
 
-const char *Resource::getName() const {
+const char* Resource::cname() const
+{
   return name_.c_str();
 }
 
@@ -591,7 +593,8 @@ bool Resource::operator==(const Resource &other) const {
   return name_ == other.name_;
 }
 
-lmm_constraint_t Resource::getConstraint() const {
+lmm_constraint_t Resource::constraint() const
+{
   return constraint_;
 }
 
@@ -876,7 +879,7 @@ void Action::updateRemainingLazy(double now)
     if (getModel() == surf_cpu_model_pm && TRACE_is_enabled()) {
       simgrid::surf::Resource *cpu = static_cast<simgrid::surf::Resource*>(
         lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0)));
-      TRACE_surf_host_set_utilization(cpu->getName(), getCategory(), lastValue_, lastUpdate_, now - lastUpdate_);
+      TRACE_surf_host_set_utilization(cpu->cname(), getCategory(), lastValue_, lastUpdate_, now - lastUpdate_);
     }
     XBT_DEBUG("Updating action(%p): remains is now %f", this, remains_);
   }
index 09d82fd..573d6c5 100644 (file)
@@ -382,10 +382,10 @@ public:
   virtual ~Resource();
 
   /** @brief Get the Model of the current Resource */
-  Model *getModel() const;
+  Model* model() const;
 
   /** @brief Get the name of the current Resource */
-  const char *getName() const;
+  const char* cname() const;
 
   bool operator==(const Resource &other) const;
 
@@ -416,7 +416,8 @@ private:
 
 public: /* LMM */
   /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
-  lmm_constraint_t getConstraint() const;
+  lmm_constraint_t constraint() const;
+
 protected:
   const lmm_constraint_t constraint_ = nullptr;
 };
@@ -430,7 +431,7 @@ namespace std {
   {
     std::size_t operator()(const simgrid::surf::Resource& r) const
     {
-      return (std::size_t) xbt_str_hash(r.getName());
+      return (std::size_t) xbt_str_hash(r.cname());
     }
   };
 }
index 4471349..8415f1c 100644 (file)
@@ -159,7 +159,7 @@ int main(int argc, char **argv)
         if (!route.empty()) {
           std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->cname(), host2->cname());
           for (auto link : route)
-            std::printf("<link_ctn id=\"%s\"/>",link->getName());
+            std::printf("<link_ctn id=\"%s\"/>", link->cname());
           std::printf("\n  </route>\n");
         }
       }
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
           std::vector<simgrid::surf::LinkImpl*> route;
           simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
           for (auto link : route)
-            std::printf("<link_ctn id=\"%s\"/>",link->getName());
+            std::printf("<link_ctn id=\"%s\"/>", link->cname());
           std::printf("\n  </route>\n");
         }
       }
@@ -183,7 +183,7 @@ int main(int argc, char **argv)
             std::vector<simgrid::surf::LinkImpl*> route;
             simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, &route, nullptr);
             for (auto link : route)
-              std::printf("<link_ctn id=\"%s\"/>",link->getName());
+              std::printf("<link_ctn id=\"%s\"/>", link->cname());
             std::printf("\n  </route>\n");
           }
         }
@@ -194,7 +194,7 @@ int main(int argc, char **argv)
           simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
           simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, &route, nullptr);
           for (auto link : route)
-            std::printf("<link_ctn id=\"%s\"/>",link->getName());
+            std::printf("<link_ctn id=\"%s\"/>", link->cname());
           std::printf("\n  </route>\n");
         }
       }
index 07441cf..3bcd610 100644 (file)
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
   while (next_event_date > -1.0) {
     XBT_INFO("%g:", next_event_date);
     while (fes->pop_leq(next_event_date, &value, &resource)) {
-      XBT_INFO("   %s: %g", resource->getName(), value);
+      XBT_INFO("   %s: %g", resource->cname(), value);
     }
     if (next_event_date > 100)
       break;