Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 6 Jun 2017 06:34:33 +0000 (08:34 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 6 Jun 2017 06:34:33 +0000 (08:34 +0200)
18 files changed:
include/simgrid/forward.h
src/kernel/activity/ActivityImpl.cpp
src/kernel/activity/ActivityImpl.hpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/LivenessChecker.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/mc_state.h
src/simgrid/sg_config.cpp
src/simix/popping_private.h
src/smpi/smpi_datatype.cpp
src/surf/instr_routing.cpp
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp
src/xbt/backtrace_linux.cpp
src/xbt/dynar.cpp
src/xbt/parmap.cpp
teshsuite/surf/maxmin_bench/maxmin_bench.cpp
teshsuite/surf/surf_usage/surf_usage.cpp

index ff78fe3..82b6c58 100644 (file)
 namespace simgrid {
 namespace kernel {
 namespace activity {
-class ActivityImpl;
-     }
-     namespace routing {
-     class NetPoint;
-     }
-  }
-  namespace simix {
-    class Host;
-  }
-  namespace surf {
-    class Resource;
-    class Cpu;
-    class LinkImpl;
-    class HostImpl;
-    class StorageImpl;
-  }
-  namespace trace_mgr {
-    class trace;
-    class future_evt_set;
-  }
+  class ActivityImpl;
+  XBT_PUBLIC(void) intrusive_ptr_add_ref(ActivityImpl* activity);
+  XBT_PUBLIC(void) intrusive_ptr_release(ActivityImpl* activity);
+}
+namespace routing {
+  class NetPoint;
+}
+}
+namespace simix {
+  class Host;
+}
+namespace surf {
+  class Resource;
+  class Cpu;
+  class LinkImpl;
+  class HostImpl;
+  class StorageImpl;
+}
+namespace trace_mgr {
+  class trace;
+  class future_evt_set;
+}
 }
 
 typedef simgrid::s4u::Actor s4u_Actor;
 typedef simgrid::s4u::Host s4u_Host;
 typedef simgrid::s4u::Link s4u_Link;
 typedef simgrid::s4u::NetZone s4u_NetZone;
-typedef simgrid::kernel::activity::ActivityImpl kernel_Activity;
+typedef simgrid::kernel::activity::ActivityImpl* smx_activity_t;
 typedef simgrid::kernel::routing::NetPoint routing_NetPoint;
 typedef simgrid::surf::Resource surf_Resource;
 typedef simgrid::trace_mgr::trace tmgr_Trace;
@@ -53,7 +55,7 @@ typedef struct s4u_Actor s4u_Actor;
 typedef struct s4u_Host s4u_Host;
 typedef struct s4u_Link s4u_Link;
 typedef struct s4u_NetZone s4u_NetZone;
-typedef struct kernel_Activity kernel_Activity;
+typedef struct kernel_Activity* smx_activity_t;
 typedef struct routing_NetPoint routing_NetPoint;
 typedef struct surf_Resource surf_Resource;
 typedef struct Trace tmgr_Trace;
@@ -64,7 +66,6 @@ typedef s4u_NetZone* sg_netzone_t;
 typedef s4u_Host* sg_host_t;
 typedef s4u_Link* sg_link_t;
 
-typedef kernel_Activity *smx_activity_t;
 
 typedef routing_NetPoint* sg_netpoint_t;
 typedef surf_Resource *sg_resource_t;
index 77e6570..c732b28 100644 (file)
@@ -1,21 +1,25 @@
-/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/activity/ActivityImpl.hpp"
 
-simgrid::kernel::activity::ActivityImpl::ActivityImpl() = default;
-simgrid::kernel::activity::ActivityImpl::~ActivityImpl() = default;
+namespace simgrid {
+namespace kernel {
+namespace activity {
 
-void simgrid::kernel::activity::ActivityImpl::ref()
+ActivityImpl::ActivityImpl()  = default;
+ActivityImpl::~ActivityImpl() = default;
+
+void ActivityImpl::ref()
 {
   // Atomic operation! Do not split in two instructions!
   xbt_assert(refcount_ != 0);
   refcount_++;
 }
 
-void simgrid::kernel::activity::ActivityImpl::unref()
+void ActivityImpl::unref()
 {
   xbt_assert(refcount_ > 0,
              "This activity has a negative refcount! You can only call test() or wait() once per activity.");
@@ -23,3 +27,17 @@ void simgrid::kernel::activity::ActivityImpl::unref()
   if (refcount_ == 0)
     delete this;
 }
+
+// boost::intrusive_ptr<Activity> support:
+void intrusive_ptr_add_ref(simgrid::kernel::activity::ActivityImpl* activity)
+{
+  activity->ref();
+}
+
+void intrusive_ptr_release(simgrid::kernel::activity::ActivityImpl* activity)
+{
+  activity->unref();
+}
+}
+}
+} // namespace simgrid::kernel::activity::
index af36c69..1496c41 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -31,21 +31,15 @@ namespace activity {
     virtual void resume()=0;
     virtual void post() =0; // What to do when a simcall terminates
 
-    // boost::intrusive_ptr<Activity> support:
-    friend void intrusive_ptr_add_ref(ActivityImpl * activity)
-    {
-      activity->ref();
-    }
-
-    friend void intrusive_ptr_release(ActivityImpl * activity)
-    {
-      activity->unref();
-    }
-
     /** @brief Increases the refcount */
     void ref();
     /** @brief Reduces the refcount */
     void unref();
+
+     // boost::intrusive_ptr<Activity> support:
+    friend void intrusive_ptr_add_ref(ActivityImpl * activity);
+    friend void intrusive_ptr_release(ActivityImpl * activity);
+
   private:
     std::atomic_int_fast32_t refcount_{1};
   };
index 15d1ccd..2410b9d 100644 (file)
@@ -360,7 +360,7 @@ void CommunicationDeterminismChecker::prepare()
   /* Get an enabled actor and insert it in the interleave set of the initial state */
   for (auto& actor : mc_model_checker->process().actors())
     if (simgrid::mc::actor_is_enabled(actor.copy.getBuffer()))
-      initial_state->interleave(actor.copy.getBuffer());
+      initial_state->addInterleavingSet(actor.copy.getBuffer());
 
   stack_.push_back(std::move(initial_state));
 }
@@ -488,7 +488,7 @@ void CommunicationDeterminismChecker::main()
         /* Get enabled actors and insert them in the interleave set of the next state */
         for (auto& actor : mc_model_checker->process().actors())
           if (simgrid::mc::actor_is_enabled(actor.copy.getBuffer()))
-            next_state->interleave(actor.copy.getBuffer());
+            next_state->addInterleavingSet(actor.copy.getBuffer());
 
         if (dot_output != nullptr)
           fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n",
index 0dda3dd..f65fff1 100644 (file)
@@ -316,7 +316,7 @@ std::shared_ptr<Pair> LivenessChecker::newPair(Pair* current_pair, xbt_automaton
   /* Get enabled actors and insert them in the interleave set of the next graph_state */
   for (auto& actor : mc_model_checker->process().actors())
     if (simgrid::mc::actor_is_enabled(actor.copy.getBuffer()))
-      next_pair->graph_state->interleave(actor.copy.getBuffer());
+      next_pair->graph_state->addInterleavingSet(actor.copy.getBuffer());
   next_pair->requests = next_pair->graph_state->interleaveSize();
   /* FIXME : get search_cycle value for each accepting state */
   if (next_pair->automaton_state->type == 1 || (current_pair && current_pair->search_cycle))
index d382815..4256b56 100644 (file)
@@ -162,12 +162,14 @@ void SafetyChecker::run()
     if (visitedState_ == nullptr) {
 
       /* Get an enabled process and insert it in the interleave set of the next state */
-      for (auto& actor : mc_model_checker->process().actors())
-        if (simgrid::mc::actor_is_enabled(actor.copy.getBuffer())) {
-          next_state->interleave(actor.copy.getBuffer());
+      for (auto& remoteActor : mc_model_checker->process().actors()) {
+        auto actor = remoteActor.copy.getBuffer();
+        if (simgrid::mc::actor_is_enabled(actor)) {
+          next_state->addInterleavingSet(actor);
           if (reductionMode_ == simgrid::mc::ReductionMode::dpor)
-            break;
+            break; // With DPOR, we take the first enabled transition
         }
+      }
 
       if (dot_output != nullptr)
         std::fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n",
@@ -231,7 +233,7 @@ void SafetyChecker::backtrack()
           }
 
           if (not prev_state->actorStates[issuer->pid].isDone())
-            prev_state->interleave(issuer);
+            prev_state->addInterleavingSet(issuer);
           else
             XBT_DEBUG("Process %p is in done set", req->issuer);
 
@@ -321,7 +323,7 @@ SafetyChecker::SafetyChecker(Session& session) : Checker(session)
   /* Get an enabled actor and insert it in the interleave set of the initial state */
   for (auto& actor : mc_model_checker->process().actors())
     if (simgrid::mc::actor_is_enabled(actor.copy.getBuffer())) {
-      initial_state->interleave(actor.copy.getBuffer());
+      initial_state->addInterleavingSet(actor.copy.getBuffer());
       if (reductionMode_ != simgrid::mc::ReductionMode::none)
         break;
     }
index d807e28..e4eb0d9 100644 (file)
@@ -137,9 +137,7 @@ struct XBT_PRIVATE State {
   State(unsigned long state_number);
 
   std::size_t interleaveSize() const;
-  void interleave(smx_actor_t actor) {
-    this->actorStates[actor->pid].consider();
-  }
+  void addInterleavingSet(smx_actor_t actor) { this->actorStates[actor->pid].consider(); }
   Transition getTransition() const;
 };
 
index 8aa0849..e617c48 100644 (file)
@@ -295,84 +295,92 @@ void sg_config_init(int *argc, char **argv)
   char description[descsize];
 
   /* Create the configuration support */
-  if (_sg_cfg_init_status == 0) { /* Only create stuff if not already inited */
+  if (_sg_cfg_init_status != 0) { /* Only create stuff if not already inited */
+    XBT_WARN("Call to sg_config_init() after initialization ignored");
+    return;
+  }
 
-    /* Plugins configuration */
-    describe_model(description,descsize, surf_plugin_description, "plugin", "The plugins");
-    xbt_cfg_register_string("plugin", nullptr, &_sg_cfg_cb__plugin, description);
+  /* Plugins configuration */
+  describe_model(description, descsize, surf_plugin_description, "plugin", "The plugins");
+  xbt_cfg_register_string("plugin", nullptr, &_sg_cfg_cb__plugin, description);
 
-    describe_model(description,descsize, surf_cpu_model_description, "model", "The model to use for the CPU");
-    xbt_cfg_register_string("cpu/model", "Cas01", &_sg_cfg_cb__cpu_model, description);
+  describe_model(description, descsize, surf_cpu_model_description, "model", "The model to use for the CPU");
+  xbt_cfg_register_string("cpu/model", "Cas01", &_sg_cfg_cb__cpu_model, description);
 
-    describe_model(description,descsize, surf_optimization_mode_description, "optimization mode", "The optimization modes to use for the CPU");
-    xbt_cfg_register_string("cpu/optim", "Lazy", &_sg_cfg_cb__optimization_mode, description);
+  describe_model(description, descsize, surf_optimization_mode_description, "optimization mode",
+                 "The optimization modes to use for the CPU");
+  xbt_cfg_register_string("cpu/optim", "Lazy", &_sg_cfg_cb__optimization_mode, description);
 
-    describe_model(description,descsize, surf_storage_model_description, "model", "The model to use for the storage");
-    xbt_cfg_register_string("storage/model", "default", &_sg_cfg_cb__storage_mode, description);
+  describe_model(description, descsize, surf_storage_model_description, "model", "The model to use for the storage");
+  xbt_cfg_register_string("storage/model", "default", &_sg_cfg_cb__storage_mode, description);
 
-    describe_model(description,descsize, surf_network_model_description, "model", "The model to use for the network");
-    xbt_cfg_register_string("network/model", "LV08", &_sg_cfg_cb__network_model, description);
+  describe_model(description, descsize, surf_network_model_description, "model", "The model to use for the network");
+  xbt_cfg_register_string("network/model", "LV08", &_sg_cfg_cb__network_model, description);
 
-    describe_model(description,descsize, surf_optimization_mode_description, "optimization mode", "The optimization modes to use for the network");
-    xbt_cfg_register_string("network/optim", "Lazy", &_sg_cfg_cb__optimization_mode, description);
+  describe_model(description, descsize, surf_optimization_mode_description, "optimization mode",
+                 "The optimization modes to use for the network");
+  xbt_cfg_register_string("network/optim", "Lazy", &_sg_cfg_cb__optimization_mode, description);
 
-    describe_model(description,descsize, surf_host_model_description, "model", "The model to use for the host");
-    xbt_cfg_register_string("host/model", "default", &_sg_cfg_cb__host_model, description);
+  describe_model(description, descsize, surf_host_model_description, "model", "The model to use for the host");
+  xbt_cfg_register_string("host/model", "default", &_sg_cfg_cb__host_model, description);
 
-    sg_tcp_gamma = 4194304.0;
-    simgrid::config::bindFlag(sg_tcp_gamma, { "network/TCP-gamma", "network/TCP_gamma" },
-      "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; Use the last given value, which is the max window size)");
+  sg_tcp_gamma = 4194304.0;
+  simgrid::config::bindFlag(sg_tcp_gamma, {"network/TCP-gamma", "network/TCP_gamma"},
+                            "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; "
+                            "Use the last given value, which is the max window size)");
 
-    simgrid::config::bindFlag(sg_surf_precision, "surf/precision",
-      "Numerical precision used when updating simulation times (in seconds)");
+  simgrid::config::bindFlag(sg_surf_precision, "surf/precision",
+                            "Numerical precision used when updating simulation times (in seconds)");
 
-    simgrid::config::bindFlag(sg_maxmin_precision, "maxmin/precision",
-                              "Numerical precision used when computing resource sharing (in flops/sec or bytes/sec)");
+  simgrid::config::bindFlag(sg_maxmin_precision, "maxmin/precision",
+                            "Numerical precision used when computing resource sharing (in flops/sec or bytes/sec)");
 
-    simgrid::config::bindFlag(sg_concurrency_limit, "maxmin/concurrency-limit",
-                              "Maximum number of concurrent variables in the maxmim system. Also limits the number of "
-                              "processes on each host, at higher level. (default: -1 means no such limitation)");
-    xbt_cfg_register_alias("maxmin/concurrency-limit", "maxmin/concurrency_limit");
+  simgrid::config::bindFlag(sg_concurrency_limit, "maxmin/concurrency-limit",
+                            "Maximum number of concurrent variables in the maxmim system. Also limits the number of "
+                            "processes on each host, at higher level. (default: -1 means no such limitation)");
+  xbt_cfg_register_alias("maxmin/concurrency-limit", "maxmin/concurrency_limit");
 
-    /* The parameters of network models */
+  /* The parameters of network models */
 
-    // real default for "network/sender-gap" is set in network_smpi.cpp:
-    sg_sender_gap = NAN;
-    simgrid::config::bindFlag(sg_sender_gap, { "network/sender-gap", "network/sender_gap" },
-      "Minimum gap between two overlapping sends");
+  // real default for "network/sender-gap" is set in network_smpi.cpp:
+  sg_sender_gap = NAN;
+  simgrid::config::bindFlag(sg_sender_gap, {"network/sender-gap", "network/sender_gap"},
+                            "Minimum gap between two overlapping sends");
 
-    sg_latency_factor = 1.0;
-    simgrid::config::bindFlag(sg_latency_factor, { "network/latency-factor", "network/latency_factor" },
-      "Correction factor to apply to the provided latency (default value set by network model)");
+  sg_latency_factor = 1.0;
+  simgrid::config::bindFlag(sg_latency_factor, {"network/latency-factor", "network/latency_factor"},
+                            "Correction factor to apply to the provided latency (default value set by network model)");
 
-    sg_bandwidth_factor = 1.0;
-    simgrid::config::bindFlag(sg_bandwidth_factor, { "network/bandwidth-factor", "network/bandwidth_factor" },
+  sg_bandwidth_factor = 1.0;
+  simgrid::config::bindFlag(
+      sg_bandwidth_factor, {"network/bandwidth-factor", "network/bandwidth_factor"},
       "Correction factor to apply to the provided bandwidth (default value set by network model)");
 
-    // real default for "network/weight-S" is set in network_*.cpp:
-    sg_weight_S_parameter = NAN;
-    simgrid::config::bindFlag(sg_weight_S_parameter, { "network/weight-S", "network/weight_S" },
+  // real default for "network/weight-S" is set in network_*.cpp:
+  sg_weight_S_parameter = NAN;
+  simgrid::config::bindFlag(
+      sg_weight_S_parameter, {"network/weight-S", "network/weight_S"},
       "Correction factor to apply to the weight of competing streams (default value set by network model)");
 
-    /* Inclusion path */
-    simgrid::config::declareFlag<std::string>("path",
-      "Lookup path for inclusions in platform and deployment XML files",
-      "",
-      [](std::string const& path) {
-        if (path[0] != '\0') {
-          surf_path.push_back(path);
-        }
-      });
-
-    xbt_cfg_register_boolean("cpu/maxmin-selective-update", "no", nullptr,
-        "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)");
-    xbt_cfg_register_alias("cpu/maxmin-selective-update","cpu/maxmin_selective_update");
-    xbt_cfg_register_boolean("network/maxmin-selective-update", "no", nullptr,
-        "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)");
-    xbt_cfg_register_alias("network/maxmin-selective-update","network/maxmin_selective_update");
-    /* Replay (this part is enabled even if MC it disabled) */
-    xbt_cfg_register_string("model-check/replay", nullptr, _sg_cfg_cb_model_check_replay,
-        "Model-check path to replay (as reported by SimGrid when a violation is reported)");
+  /* Inclusion path */
+  simgrid::config::declareFlag<std::string>("path", "Lookup path for inclusions in platform and deployment XML files",
+                                            "", [](std::string const& path) {
+                                              if (path[0] != '\0') {
+                                                surf_path.push_back(path);
+                                              }
+                                            });
+
+  xbt_cfg_register_boolean("cpu/maxmin-selective-update", "no", nullptr, "Update the constraint set propagating "
+                                                                         "recursively to others constraints (off by "
+                                                                         "default when optim is set to lazy)");
+  xbt_cfg_register_alias("cpu/maxmin-selective-update", "cpu/maxmin_selective_update");
+  xbt_cfg_register_boolean("network/maxmin-selective-update", "no", nullptr, "Update the constraint set propagating "
+                                                                             "recursively to others constraints (off "
+                                                                             "by default when optim is set to lazy)");
+  xbt_cfg_register_alias("network/maxmin-selective-update", "network/maxmin_selective_update");
+  /* Replay (this part is enabled even if MC it disabled) */
+  xbt_cfg_register_string("model-check/replay", nullptr, _sg_cfg_cb_model_check_replay,
+                          "Model-check path to replay (as reported by SimGrid when a violation is reported)");
 
 #if SIMGRID_HAVE_MC
     /* do model-checking-record */
@@ -568,9 +576,6 @@ void sg_config_init(int *argc, char **argv)
     sg_config_cmd_line(argc, argv);
 
     xbt_mallocator_initialization_is_done(SIMIX_context_is_parallel());
-  } else {
-    XBT_WARN("Call to sg_config_init() after initialization ignored");
-  }
 }
 
 void sg_config_finalize()
index abbc756..389f89b 100644 (file)
@@ -9,6 +9,11 @@
 #include <xbt/base.h>
 #include <simgrid/simix.h>
 
+#include <src/kernel/activity/ActivityImpl.hpp>
+#include <src/kernel/activity/CommImpl.hpp>
+
+#include <boost/intrusive_ptr.hpp>
+
 SG_BEGIN_DECL()
 
 /********************************* Simcalls *********************************/
@@ -118,6 +123,19 @@ T* unmarshal(type<T*>, u_smx_scalar const& simcall)
   return static_cast<T*>(simcall.dp);
 }
 
+template <class T>
+inline void marshal(type<boost::intrusive_ptr<T>>, u_smx_scalar& simcall, boost::intrusive_ptr<T> value)
+{
+  intrusive_ptr_add_ref(&*value);
+  simcall.dp = static_cast<void*>(&*value);
+}
+template <class T> inline boost::intrusive_ptr<T> unmarshal(type<boost::intrusive_ptr<T>>, u_smx_scalar const& simcall)
+{
+  boost::intrusive_ptr<T> res = boost::intrusive_ptr<T>(static_cast<T*>(simcall.dp), false);
+  intrusive_ptr_release(&*res);
+  return res;
+}
+
 template<class R, class... T> inline
 void marshal(type<R(*)(T...)>, u_smx_scalar& simcall, R(*value)(T...))
 {
index b5ea234..4faee97 100644 (file)
@@ -263,7 +263,6 @@ int Datatype::unpack(void* inbuf, int insize, int* position, void* outbuf, int o
 
 int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
                        void *recvbuf, int recvcount, MPI_Datatype recvtype){
-  int count;
 
 // FIXME Handle the case of a partial shared malloc.
 
@@ -274,7 +273,7 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   if (recvcount > 0 && recvbuf != sendbuf) {
     sendcount *= sendtype->size();
     recvcount *= recvtype->size();
-    count = sendcount < recvcount ? sendcount : recvcount;
+    int count = sendcount < recvcount ? sendcount : recvcount;
 
     if (not(sendtype->flags() & DT_FLAG_DERIVED) && not(recvtype->flags() & DT_FLAG_DERIVED)) {
       if (not smpi_process()->replaying())
index 72d975c..2baf7b9 100644 (file)
@@ -233,7 +233,7 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link)
   }
 }
 
-void sg_instr_new_host(simgrid::s4u::Host& host)
+static void sg_instr_new_host(simgrid::s4u::Host& host)
 {
   container_t father = currentContainer.back();
   container_t container = PJ_container_new(host.cname(), INSTR_HOST, father);
@@ -322,6 +322,7 @@ void instr_routing_define_callbacks ()
     return;
   simgrid::s4u::Link::onCreation.connect(instr_routing_parse_start_link);
   simgrid::s4u::onPlatformCreated.connect(instr_routing_parse_end_platform);
+  simgrid::s4u::Host::onCreation.connect(sg_instr_new_host);
 }
 
 /*
index 0b49f04..2e10ec0 100644 (file)
@@ -99,9 +99,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t args)
     host->pimpl_cpu->setPState(args->pstate);
   if (args->coord && strcmp(args->coord, ""))
     new simgrid::kernel::routing::vivaldi::Coords(host->pimpl_netpoint, args->coord);
-
-  if (TRACE_is_enabled() && TRACE_needs_platform())
-    sg_instr_new_host(*host);
+    
 }
 
 /** @brief Add a "router" to the network element list */
index 1ffead7..2bc61f3 100644 (file)
@@ -247,7 +247,6 @@ XBT_PUBLIC(void) routing_route_free(sg_platf_route_cbarg_t route);
 /********** Instr. **********/
 XBT_PRIVATE void sg_instr_AS_begin(sg_platf_AS_cbarg_t AS);
 XBT_PRIVATE void sg_instr_new_router(const char* name);
-XBT_PRIVATE void sg_instr_new_host(simgrid::s4u::Host& host);
 XBT_PRIVATE void sg_instr_AS_end();
 
 SG_END_DECL()
index c61c519..8760a89 100644 (file)
@@ -220,7 +220,6 @@ std::vector<std::string> resolveBacktrace(
       char maps_buff[512];
       long int offset = 0;
       char* p;
-      char* p2;
       int found = 0;
 
       /* let's look for the offset of this library in our addressing space */
@@ -282,7 +281,7 @@ std::vector<std::string> resolveBacktrace(
         free(p);
         snprintf(line_func,3, "??");
       } else {
-        p2 = strrchr(p, '(');
+        char* p2 = strrchr(p, '(');
         if (p2)
           *p2 = '\0';
         p2 = strrchr(p, ' ');
index 84ba004..47300c3 100644 (file)
@@ -365,9 +365,6 @@ extern "C" void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, cons
  */
 extern "C" void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void* const object)
 {
-  unsigned long nb_shift;
-  unsigned long offset;
-
   _sanity_check_dynar(dynar);
   _check_inbound_idx(dynar, idx);
 
@@ -377,10 +374,10 @@ extern "C" void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void
     dynar->free_f(_xbt_dynar_elm(dynar, idx));
   }
 
-  nb_shift = dynar->used - 1 - idx;
+  unsigned long nb_shift = dynar->used - 1 - idx;
 
   if (nb_shift) {
-    offset = nb_shift * dynar->elmsize;
+    unsigned long offset = nb_shift * dynar->elmsize;
     memmove(_xbt_dynar_elm(dynar, idx), _xbt_dynar_elm(dynar, idx + 1), offset);
   }
 
@@ -398,7 +395,6 @@ extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned in
 {
   unsigned long nb_shift;
   unsigned long offset;
-  unsigned long cur;
 
   if (not n)
     return;
@@ -408,7 +404,7 @@ extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned in
   _check_inbound_idx(dynar, idx + n - 1);
 
   if (dynar->free_f) {
-    for (cur = idx; cur < idx + n; cur++) {
+    for (unsigned long cur = idx; cur < idx + n; cur++) {
       dynar->free_f(_xbt_dynar_elm(dynar, cur));
     }
   }
@@ -744,7 +740,6 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
   /* Vars_decl [doxygen cruft] */
   int i;
   unsigned int cursor;
-  int *iptr;
 
   xbt_test_add("==== Traverse the empty dynar");
   xbt_dynar_t d = xbt_dynar_new(sizeof(int), nullptr);
@@ -767,7 +762,7 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
 
   /* 2. Traverse manually the dynar */
   for (cursor = 0; cursor < NB_ELEM; cursor++) {
-    iptr = (int*) xbt_dynar_get_ptr(d, cursor);
+    int* iptr = (int*)xbt_dynar_get_ptr(d, cursor);
     xbt_test_assert(cursor == (unsigned int)*iptr, "The retrieved value is not the same than the injected one (%u!=%d)",
                     cursor, *iptr);
   }
index 0423149..a0689f0 100644 (file)
@@ -114,13 +114,12 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode)
   xbt_parmap_set_mode(parmap, mode);
 
   /* Create the pool of worker threads */
-  xbt_parmap_thread_data_t data;
   parmap->workers[0] = nullptr;
 #if HAVE_PTHREAD_SETAFFINITY
   int core_bind = 0;
 #endif  
   for (unsigned int i = 1; i < num_workers; i++) {
-    data = xbt_new0(s_xbt_parmap_thread_data_t, 1);
+    xbt_parmap_thread_data_t data = xbt_new0(s_xbt_parmap_thread_data_t, 1);
     data->parmap = parmap;
     data->worker_id = i;
     parmap->workers[i] = xbt_os_thread_create(nullptr, xbt_parmap_worker_main, data, nullptr);
index 6dbca8c..e5a911a 100644 (file)
@@ -41,7 +41,6 @@ static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limi
   lmm_constraint_t cnst[nb_cnst];
   lmm_variable_t var[nb_var];
   int used[nb_cnst];
-  int concurrency_share;
 
   lmm_system_t Sys = lmm_system_new(1);
 
@@ -61,7 +60,7 @@ static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limi
   for (int i = 0; i < nb_var; i++) {
     var[i] = lmm_variable_new(Sys, NULL, 1.0, -1.0, nb_elem);
     //Have a few variables with a concurrency share of two (e.g. cross-traffic in some cases)
-    concurrency_share=1+int_random(max_share);
+    int concurrency_share = 1 + int_random(max_share);
     lmm_variable_concurrency_share_set(var[i],concurrency_share);
 
     for (int j = 0; j < nb_cnst; j++)
index 6d71570..1c92988 100644 (file)
@@ -31,7 +31,6 @@ static const char *string_action(simgrid::surf::Action::State state)
 
 int main(int argc, char **argv)
 {
-  double now = -1.0;
   surf_init(&argc, argv);       /* Initialize some common structures */
   xbt_cfg_set_parse("cpu/model:Cas01");
   xbt_cfg_set_parse("network/model:CM02");
@@ -65,8 +64,7 @@ int main(int argc, char **argv)
   surf_solve(-1.0);
   do {
     simgrid::surf::ActionList *action_list = nullptr;
-    now = surf_get_clock();
-    XBT_INFO("Next Event : %g", now);
+    XBT_INFO("Next Event : %g", surf_get_clock());
     XBT_DEBUG("\t CPU actions");
 
     action_list = surf_cpu_model_pm->getFailedActionSet();