Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #215 from Takishipp/s_type_cleanup
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 27 Aug 2017 22:22:02 +0000 (00:22 +0200)
committerGitHub <noreply@github.com>
Sun, 27 Aug 2017 22:22:02 +0000 (00:22 +0200)
s_type cleanup

125 files changed:
examples/java/io/storage/Client.java
examples/s4u/app-bittorrent/s4u_bittorrent.cpp
examples/s4u/app-bittorrent/s4u_peer.cpp
examples/s4u/app-bittorrent/s4u_tracker.hpp
examples/s4u/app-masterworker/s4u_app-masterworker.cpp
examples/s4u/app-masterworker/s4u_app-masterworker.tesh
examples/s4u/app-token-ring/s4u_app-token-ring.cpp
examples/s4u/dht-chord/s4u_dht-chord.cpp
examples/s4u/io/s4u_io.cpp
examples/simdag/test/sd_test.cpp
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/Host.hpp
include/xbt/signal.hpp
src/bindings/java/JavaContext.cpp
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_as.cpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_vm.cpp
src/bindings/lua/lua_platf.cpp
src/include/xbt/parmap.hpp
src/instr/instr_config.cpp
src/instr/instr_interface.cpp
src/instr/instr_paje_trace.cpp
src/instr/jedule/jedule.cpp
src/instr/jedule/jedule_events.cpp
src/instr/jedule/jedule_platform.cpp
src/kernel/EngineImpl.cpp
src/kernel/activity/MailboxImpl.cpp
src/kernel/activity/SynchroIo.cpp
src/kernel/context/ContextThread.cpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/RoutedZone.cpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/mc/ChunkedData.hpp
src/mc/ModelChecker.cpp
src/mc/PageStore.cpp
src/mc/checker/LivenessChecker.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/compare.cpp
src/mc/mc_base.cpp
src/mc/mc_checkpoint.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_global.cpp
src/mc/remote/Client.cpp
src/mc/remote/RemoteClient.cpp
src/msg/msg_actions.cpp
src/msg/msg_environment.cpp
src/msg/msg_host.cpp
src/msg/msg_io.cpp
src/msg/msg_process.cpp
src/msg/msg_vm.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/plugins/vm/s4u_VirtualMachine.cpp
src/s4u/s4u_engine.cpp
src/s4u/s4u_file.cpp
src/s4u/s4u_host.cpp
src/s4u/s4u_netzone.cpp
src/s4u/s4u_storage.cpp
src/simdag/sd_daxloader.cpp
src/simdag/sd_dotloader.cpp
src/simdag/sd_global.cpp
src/simdag/sd_task.cpp
src/simgrid/host.cpp
src/simix/ActorImpl.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_enum.h
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_global.cpp
src/simix/smx_host.cpp
src/simix/smx_host_private.h
src/simix/smx_io.cpp
src/smpi/include/smpi_info.hpp
src/smpi/include/smpi_keyvals.hpp
src/smpi/internals/SmpiHost.cpp
src/smpi/internals/instr_smpi.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_deployment.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/internals/smpi_replay.cpp
src/smpi/internals/smpi_shared.cpp
src/smpi/internals/smpi_utils.cpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_f2c.cpp
src/smpi/mpi/smpi_group.cpp
src/smpi/mpi/smpi_info.cpp
src/smpi/mpi/smpi_request.cpp
src/smpi/mpi/smpi_win.cpp
src/surf/HostImpl.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_ti.cpp
src/surf/instr_routing.cpp
src/surf/network_cm02.cpp
src/surf/network_ib.cpp
src/surf/network_interface.cpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/network_smpi.cpp
src/surf/ns3/ns3_simulator.cc
src/surf/plugins/host_energy.cpp
src/surf/plugins/host_load.cpp
src/surf/ptask_L07.cpp
src/surf/sg_platf.cpp
src/surf/storage_n11.cpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/trace_mgr.cpp
src/surf/trace_mgr_test.cpp
src/surf/xml/surfxml_parseplatf.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/config.cpp
src/xbt/xbt_replay.cpp
teshsuite/s4u/actor/actor.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp
teshsuite/simdag/flatifier/flatifier.cpp
teshsuite/simdag/is-router/is-router.cpp
teshsuite/surf/surf_usage2/surf_usage2.cpp
tools/cmake/MakeLib.cmake

index 480ff86..2239ffb 100644 (file)
@@ -15,6 +15,8 @@
 
 package io.storage;
 
+import java.util.Arrays;
+import java.util.Comparator;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.Process;
@@ -30,6 +32,11 @@ public class Client extends Process {
    // Retrieve all mount points of current host
     Storage[] storages = getHost().getMountedStorage();
 
+    Arrays.sort(storages, new Comparator<Storage>() {
+        public int compare(Storage a, Storage b) {
+          return a.getName().compareTo(b.getName());
+        }
+      });
     for (int i = 0; i < storages.length; i++) {
       // For each disk mounted on host
       Msg.info("------------------------------------");
@@ -61,4 +68,4 @@ public class Client extends Process {
       Msg.info("Disk: "+ stos[i].getName());
     }
   }
-}
\ No newline at end of file
+}
index cbc093b..e45b1e7 100644 (file)
@@ -23,7 +23,7 @@ int main(int argc, char* argv[])
 
   std::vector<simgrid::s4u::Host*> list;
   simgrid::s4u::Engine::getInstance()->getHostList(&list);
-  for (auto host : list)
+  for (auto const& host : list)
     host->extension_set(new HostBittorrent(host));
 
   e->registerFunction<Tracker>("tracker");
index 0b03bdb..431f433 100644 (file)
@@ -57,7 +57,7 @@ Peer::Peer(std::vector<std::string> args)
 
 Peer::~Peer()
 {
-  for (auto peer : connected_peers)
+  for (auto const& peer : connected_peers)
     delete peer.second;
   delete[] pieces_count;
 }
@@ -102,7 +102,7 @@ bool Peer::getPeersFromTracker()
   try {
     TrackerAnswer* answer = static_cast<TrackerAnswer*>(mailbox_->get(GET_PEERS_TIMEOUT));
     // Add the peers the tracker gave us to our peer list.
-    for (auto peer_id : *answer->getPeers())
+    for (auto const& peer_id : *answer->getPeers())
       if (id != peer_id)
         connected_peers[peer_id] = new Connection(peer_id);
     delete answer;
@@ -117,7 +117,7 @@ bool Peer::getPeersFromTracker()
 
 void Peer::sendHandshakeToAllPeers()
 {
-  for (auto kv : connected_peers) {
+  for (auto const& kv : connected_peers) {
     Connection* remote_peer = kv.second;
     Message* handshake      = new Message(MESSAGE_HANDSHAKE, id, mailbox_);
     remote_peer->mailbox_->put_init(handshake, MESSAGE_HANDSHAKE_SIZE)->detach();
@@ -151,7 +151,7 @@ void Peer::sendPiece(simgrid::s4u::MailboxPtr mailbox, unsigned int piece, int b
 void Peer::sendHaveToAllPeers(unsigned int piece)
 {
   XBT_DEBUG("Sending HAVE message to all my peers");
-  for (auto kv : connected_peers) {
+  for (auto const& kv : connected_peers) {
     Connection* remote_peer = kv.second;
     remote_peer->mailbox_->put_init(new Message(MESSAGE_HAVE, id, mailbox_, piece), MESSAGE_HAVE_SIZE)->detach();
   }
@@ -220,7 +220,7 @@ unsigned int Peer::countPieces(unsigned int bitfield)
 int Peer::nbInterestedPeers()
 {
   int nb = 0;
-  for (auto kv : connected_peers)
+  for (auto const& kv : connected_peers)
     if (kv.second->interested)
       nb++;
   return nb;
@@ -546,14 +546,19 @@ void Peer::updateChokedPeers()
   round_                  = (round_ + 1) % 3;
   Connection* chosen_peer = nullptr;
   // select first active peer and remove it from the set
-  Connection* choked_peer = *(active_peers.begin());
-  active_peers.erase(choked_peer);
+  Connection* choked_peer;
+  if (active_peers.empty()) {
+    choked_peer = nullptr;
+  } else {
+    choked_peer = *active_peers.begin();
+    active_peers.erase(choked_peer);
+  }
 
   /**If we are currently seeding, we unchoke the peer which has been unchoked the last time.*/
   if (hasFinished()) {
     Connection* remote_peer;
     double unchoke_time = simgrid::s4u::Engine::getClock() + 1;
-    for (auto kv : connected_peers) {
+    for (auto const& kv : connected_peers) {
       remote_peer = kv.second;
       if (remote_peer->last_unchoke < unchoke_time && remote_peer->interested && remote_peer->choked_upload) {
         unchoke_time = remote_peer->last_unchoke;
@@ -580,7 +585,7 @@ void Peer::updateChokedPeers()
     } else {
       // Use the "fastest download" policy.
       double fastest_speed = 0.0;
-      for (auto kv : connected_peers) {
+      for (auto const& kv : connected_peers) {
         Connection* remote_peer = kv.second;
         if (remote_peer->peer_speed > fastest_speed && remote_peer->choked_upload && remote_peer->interested) {
           chosen_peer   = remote_peer;
@@ -617,7 +622,7 @@ void Peer::updateChokedPeers()
 /** @brief Update "interested" state of peers: send "not interested" to peers that don't have any more pieces we want.*/
 void Peer::updateInterestedAfterReceive()
 {
-  for (auto kv : connected_peers) {
+  for (auto const& kv : connected_peers) {
     Connection* remote_peer = kv.second;
     if (remote_peer->am_interested) {
       bool interested = false;
index 591233f..bebc397 100644 (file)
@@ -22,10 +22,10 @@ public:
 };
 
 class TrackerAnswer {
-  XBT_ATTRIB_UNUSED int interval; // how often the peer should contact the tracker (unused for now)
+  // int interval; // how often the peer should contact the tracker (unused for now)
   std::set<int>* peers; // the peer list the peer has asked for.
 public:
-  explicit TrackerAnswer(int interval) : interval(interval) { peers = new std::set<int>; }
+  explicit TrackerAnswer(int /*interval*/) /*: interval(interval)*/ { peers = new std::set<int>; }
   TrackerAnswer(const TrackerAnswer&)                               = delete;
   ~TrackerAnswer() { delete peers; };
   void addPeer(int peer) { peers->insert(peer); }
index 04102b7..c0ce006 100644 (file)
@@ -41,17 +41,15 @@ public:
                  number_of_tasks, mailbox->getName());
 
       /* - Send the computation amount to the @ref worker */
-      mailbox->put(static_cast<void*>(&comp_size), comm_size);
+      mailbox->put(new double(comp_size), comm_size);
     }
 
     XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
     for (int i = 0; i < workers_count; i++) {
       /* - Eventually tell all the workers to stop by sending a "finalize" task */
       mailbox = simgrid::s4u::Mailbox::byName(std::string("worker-") + std::to_string(i % workers_count));
-      double finalize = -1;
-      mailbox->put(static_cast<void*>(&finalize), 0);
+      mailbox->put(new double(-1.0), 0);
     }
-    simgrid::s4u::this_actor::sleep_for(.1); // Grace time to ensure everyone finishes.
   }
 };
 
@@ -71,14 +69,16 @@ public:
   void operator()()
   {
     while (1) { /* The worker waits in an infinite loop for tasks sent by the \ref master */
-      double* comp_size = static_cast<double*>(mailbox->get());
-      xbt_assert(comp_size != nullptr, "MSG_task_get failed");
-      if (*comp_size < 0) { /* - Exit if 'finalize' is received */
+      double* task = static_cast<double*>(mailbox->get());
+      xbt_assert(task != nullptr, "mailbox->get() failed");
+      double comp_size = *task;
+      delete task;
+      if (comp_size < 0) { /* - Exit when -1.0 is received */
         XBT_INFO("I'm done. See you!");
         break;
       }
       /*  - Otherwise, process the task */
-      simgrid::s4u::this_actor::execute(*comp_size);
+      simgrid::s4u::this_actor::execute(comp_size);
     }
   }
 };
index ff2092d..f9b20df 100644 (file)
@@ -31,6 +31,6 @@ $ $SG_TEST_EXENV ${bindir:=.}/s4u_app-masterworker$EXEEXT ${srcdir:=.}/small_pla
 > [  4.057541] (worker@Jupiter) I'm done. See you!
 > [  4.083249] (worker@Fafard) I'm done. See you!
 > [  4.931805] (worker@Ginette) I'm done. See you!
+> [  5.094868] (maestro@) Simulation time 5.09487
 > [  5.094868] (worker@Bourassa) I'm done. See you!
-> [  5.194868] (maestro@) Simulation time 5.19487
 
index ead05bf..a5c3d7f 100644 (file)
@@ -63,7 +63,7 @@ int main(int argc, char** argv)
   int id = 0;
   std::vector<simgrid::s4u::Host*> list;
   e->getHostList(&list);
-  for (auto host : list) {
+  for (auto const& host : list) {
     /* - Give a unique rank to each host and create a @ref relay_runner process on each */
     simgrid::s4u::Actor::createActor((std::to_string(id)).c_str(), host, RelayRunner());
     id++;
index 1a9db78..6bd3cc8 100644 (file)
@@ -30,7 +30,7 @@ static void chord_init()
 
   std::vector<simgrid::s4u::Host*> list;
   simgrid::s4u::Engine::getInstance()->getHostList(&list);
-  for (auto host : list)
+  for (auto const& host : list)
     host->extension_set(new HostChord(host));
 }
 
index 8c60b63..789bf1c 100644 (file)
@@ -15,7 +15,7 @@ public:
   {
     XBT_INFO("Storage info on %s:", simgrid::s4u::Host::current()->getCname());
 
-    for (const auto&kv : mounts) {
+    for (auto const& kv : mounts) {
       std::string mountpoint         = kv.first;
       simgrid::s4u::Storage* storage = kv.second;
 
index 3b3de64..f5fad58 100644 (file)
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
   double latency = 0;
   h1->routeTo(h2, &route, &latency);
 
-  for (auto link : route)
+  for (auto const& link : route)
     XBT_INFO("   Link %s: latency = %f, bandwidth = %f", sg_link_name(link), sg_link_latency(link),
              sg_link_bandwidth(link));
 
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
   SD_task_schedule(taskD, 2, host_list, computation_amount, communication_amount, -1);
 
   std::set<SD_task_t> *changed_tasks = simgrid::sd::simulate(-1.0);
-  for (auto task: *changed_tasks){
+  for (auto const& task : *changed_tasks) {
     XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task),
           SD_task_get_start_time(task), SD_task_get_finish_time(task));
   }
index dd4dcc8..c972fe0 100644 (file)
@@ -41,7 +41,7 @@ public:
     xbt_dynar_t comms = xbt_dynar_new(sizeof(simgrid::kernel::activity::ActivityImpl*), [](void*ptr){
       intrusive_ptr_release(*(simgrid::kernel::activity::ActivityImpl**)ptr);
     });
-    for (auto comm : *comms_in) {
+    for (auto const& comm : *comms_in) {
       if (comm->state_ == inited)
         comm->start();
       xbt_assert(comm->state_ == started);
index 30c932e..b27c954 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2015. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-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. */
@@ -67,7 +67,7 @@ public:
   static s4u::Host* current();
 
   simgrid::xbt::string const& getName() const { return name_; }
-  const char* getCname() { return name_.c_str(); }
+  const char* getCname() const { return name_.c_str(); }
 
   void actorList(std::vector<ActorPtr> * whereto);
 
index 508822c..d5ad826 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2015. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-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. */
@@ -34,7 +34,7 @@ namespace xbt {
     }
     R operator()(P... args) const
     {
-      for (auto& handler : handlers_)
+      for (auto const& handler : handlers_)
         handler(args...);
     }
     void disconnect_all_slots()
index c796b18..7865d16 100644 (file)
@@ -47,7 +47,7 @@ JavaContext* JavaContextFactory::create_context(
 
 void JavaContextFactory::run_all()
 {
-  for (smx_actor_t process : simgrid::simix::process_get_runnable()) {
+  for (smx_actor_t const& process : simgrid::simix::process_get_runnable()) {
     static_cast<JavaContext*>(process->context)->resume();
   }
 }
index 11342f2..09d4170 100644 (file)
@@ -154,7 +154,7 @@ JNIEXPORT void JNICALL JNICALL Java_org_simgrid_msg_Msg_run(JNIEnv * env, jclass
   xbt_dynar_free(&hosts);
 
   /* Cleanup java storages */
-  for (auto elm : java_storage_map)
+  for (auto const& elm : java_storage_map)
     jstorage_unref(env, elm.second);
 }
 
index cd344be..41ed0b3 100644 (file)
@@ -78,7 +78,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, job
     return nullptr;
   }
 
-  for (auto tmp_as : *self_as->getChildren()) {
+  for (auto const& tmp_as : *self_as->getChildren()) {
     jobject tmp_jas = jnetzone_new_instance(env);
     if (not tmp_jas) {
       jxbt_throw_jni(env, "java As instantiation failed");
@@ -140,7 +140,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   }
 
   int index = 0;
-  for (auto host : table) {
+  for (auto const& host : table) {
     jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
     if (not jhost) {
       jname = env->NewStringUTF(host->getCname());
index 28804e7..a255e2e 100644 (file)
@@ -249,7 +249,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEn
     return nullptr;
   }
 
-  for (auto elm : mounted_storages) {
+  for (auto const& elm : mounted_storages) {
     jname    = env->NewStringUTF(elm.second->getName());
     jstorage = Java_org_simgrid_msg_Storage_getByName(env,cls,jname);
     env->SetObjectArrayElement(jtable, index, jstorage);
index b570d72..76b0dce 100644 (file)
@@ -77,7 +77,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_create(JNIEnv* env, jobject jVm,
   env->ReleaseStringUTFChars(jname, name);
 
   jvm_bind(env, jVm, vm);
-  jVm = env->NewWeakGlobalRef(jVm);
+  jVm = env->NewGlobalRef(jVm);
   // We use the extension level of the host, even if that's somehow disturbing
   vm->extension_set(JAVA_HOST_LEVEL, (void*)jVm);
 }
@@ -136,11 +136,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_shutdown(JNIEnv *env, jobject jvm
   if (vm) {
     MSG_vm_shutdown(vm);
     auto vmList = &simgrid::vm::VirtualMachineImpl::allVms_;
-    vmList->erase(
-        std::remove_if(vmList->begin(), vmList->end(), [vm](simgrid::s4u::VirtualMachine* it) {
-          return vm == it;
-        }),
-        vmList->end());
+    vmList->erase(std::remove(vmList->begin(), vmList->end(), vm), vmList->end());
   }
 }
 
index f0ca438..cddfe8a 100644 (file)
@@ -337,7 +337,7 @@ int console_add_route(lua_State *L) {
     route.link_list->push_back(simgrid::surf::LinkImpl::byName(lua_tostring(L, -1)));
   } else {
     // Several names separated by , \t\r\n
-    for (auto name : names) {
+    for (auto const& name : names) {
       if (name.length() > 0) {
         simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name);
         route.link_list->push_back(link);
@@ -418,7 +418,7 @@ int console_add_ASroute(lua_State *L) {
     ASroute.link_list->push_back(simgrid::surf::LinkImpl::byName(lua_tostring(L, -1)));
   } else {
     // Several names separated by , \t\r\n
-    for (auto name : names) {
+    for (auto const& name : names) {
       if (name.length() > 0) {
         simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name);
         ASroute.link_list->push_back(link);
index 24affcc..dd5037f 100644 (file)
@@ -62,25 +62,25 @@ private:
   class Synchro {
   public:
     explicit Synchro(Parmap<T>& parmap) : parmap(parmap) {}
-    virtual ~Synchro() {}
+    virtual ~Synchro() = default;
     /**
      * \brief Wakes all workers and waits for them to finish the tasks.
      *
      * This function is called by the controller thread.
      */
-    virtual void master_signal()       = 0;
+    virtual void master_signal() = 0;
     /**
      * \brief Starts the parmap: waits for all workers to be ready and returns.
      *
      * This function is called by the controller thread.
      */
-    virtual void master_wait()         = 0;
+    virtual void master_wait() = 0;
     /**
      * \brief Ends the parmap: wakes the controller thread when all workers terminate.
      *
      * This function is called by all worker threads when they end (not including the controller).
      */
-    virtual void worker_signal()       = 0;
+    virtual void worker_signal() = 0;
     /**
      * \brief Waits for some work to process.
      *
index 3e46cf0..8bbe263 100644 (file)
@@ -482,7 +482,7 @@ static void output_categories(const char* name, FILE* file)
 {
   unsigned int i = created_categories.size();
   fprintf (file, "    values = (");
-  for (auto cat : created_categories) {
+  for (auto const& cat : created_categories) {
     --i;
     fprintf(file, "\"%s%s\"", name, cat.c_str());
     if (i > 0) {
@@ -618,21 +618,3 @@ void instr_resume_tracing ()
   XBT_DEBUG ("Tracing is resumed.");
   previous_trace_state = -1;
 }
-
-#undef OPT_TRACING
-#undef OPT_TRACING_PLATFORM
-#undef OPT_TRACING_TOPOLOGY
-#undef OPT_TRACING_SMPI
-#undef OPT_TRACING_SMPI_GROUP
-#undef OPT_TRACING_CATEGORIZED
-#undef OPT_TRACING_UNCATEGORIZED
-#undef OPT_TRACING_MSG_PROCESS
-#undef OPT_TRACING_FILENAME
-#undef OPT_TRACING_BUFFER
-#undef OPT_TRACING_ONELINK_ONLY
-#undef OPT_TRACING_DISABLE_DESTROY
-#undef OPT_TRACING_BASIC
-#undef OPT_TRACING_COMMENT
-#undef OPT_TRACING_COMMENT_FILE
-#undef OPT_VIVA_UNCAT_CONF
-#undef OPT_VIVA_CAT_CONF
index baa43b3..2029d3c 100644 (file)
@@ -35,7 +35,7 @@ static xbt_dynar_t instr_set_to_dynar(std::set<std::string>* filter)
     return nullptr;
 
   xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
-  for (auto name : *filter)
+  for (auto const& name : *filter)
     xbt_dynar_push_as(ret, char*, xbt_strdup(name.c_str()));
 
   return ret;
@@ -314,7 +314,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)
+  for (auto const& link : route)
     instr_user_variable(time, link->cname(), variable, father_type, value, what, nullptr, &user_link_variables);
 }
 
index 13a4828..9745a0f 100644 (file)
@@ -68,14 +68,14 @@ void TRACE_paje_dump_buffer (int force)
     return;
   XBT_DEBUG("%s: dump until %f. starts", __FUNCTION__, TRACE_last_timestamp_to_dump);
   if (force){
-    for (auto event : buffer){
+    for (auto const& event : buffer) {
       event->print();
       delete event;
     }
     buffer.clear();
   }else{
     std::vector<PajeEvent*>::iterator i = buffer.begin();
-    for (auto event :buffer){
+    for (auto const& event : buffer) {
       double head_timestamp = event->timestamp;
       if (head_timestamp > TRACE_last_timestamp_to_dump)
         break;
@@ -92,7 +92,7 @@ void buffer_debug(std::vector<PajeEvent*> *buf);
 void buffer_debug(std::vector<PajeEvent*> *buf) {
   return;
   XBT_DEBUG(">>>>>> Dump the state of the buffer. %zu events", buf->size());
-  for (auto event :*buf){
+  for (auto const& event : *buf) {
     event->print();
     XBT_DEBUG("%p %s", event, stream.str().c_str());
     stream.str("");
index 4f7841f..3138d6a 100644 (file)
@@ -14,7 +14,7 @@ namespace jedule {
 
 Jedule::~Jedule() {
   delete this->root_container;
-  for (auto evt: this->event_set)
+  for (auto const& evt : this->event_set)
     delete evt;
   this->event_set.clear();
 }
@@ -32,7 +32,7 @@ void Jedule::writeOutput(FILE *file) {
 
     if (not this->meta_info.empty()) {
       fprintf(file, "  <jedule_meta>\n");
-      for (auto elm: this->meta_info)
+      for (auto const& elm : this->meta_info)
         fprintf(file, "        <prop key=\"%s\" value=\"%s\" />\n",elm.first,elm.second);
       fprintf(file, "  </jedule_meta>\n");
     }
@@ -42,8 +42,8 @@ void Jedule::writeOutput(FILE *file) {
     fprintf(file, "  </platform>\n");
 
     fprintf(file, "  <events>\n");
-    for (auto event :this->event_set)
-        event->print(file);
+    for (auto const& event : this->event_set)
+      event->print(file);
     fprintf(file, "  </events>\n");
 
     fprintf(file, "</jedule>\n");
index afe12f3..01ca092 100644 (file)
@@ -21,7 +21,7 @@ Event::Event(std::string name, double start_time, double end_time, std::string t
 Event::~Event()
 {
   if (not this->resource_subsets->empty()) {
-    for (auto subset: *this->resource_subsets)
+    for (auto const& subset : *this->resource_subsets)
       delete subset;
     delete this->resource_subsets;
   }
@@ -53,7 +53,7 @@ void Event::print(FILE *jed_file)
 
   xbt_assert(not this->resource_subsets->empty());
   fprintf(jed_file, "      <res_util>\n");
-  for (auto subset: *this->resource_subsets) {
+  for (auto const& subset : *this->resource_subsets) {
     fprintf(jed_file, "        <select resources=\"");
     fprintf(jed_file, "%s", subset->parent->getHierarchyAsString().c_str());
     fprintf(jed_file, ".[%d-%d]", subset->start_idx, subset->start_idx + subset->nres-1);
@@ -63,14 +63,14 @@ void Event::print(FILE *jed_file)
 
   if (not this->characteristics_list.empty()) {
     fprintf(jed_file, "      <characteristics>\n");
-    for (auto ch: this->characteristics_list)
+    for (auto const& ch : this->characteristics_list)
       fprintf(jed_file, "          <characteristic name=\"%s\" />\n", ch);
     fprintf(jed_file, "      </characteristics>\n");
   }
 
   if (not this->info_map.empty()) {
     fprintf(jed_file, "      <info>\n");
-    for (auto elm: this->info_map)
+    for (auto const& elm : this->info_map)
       fprintf(jed_file, "        <prop key=\"%s\" value=\"%s\" />\n",elm.first,elm.second);
     fprintf(jed_file, "      </info>\n");
   }
index babb894..877905d 100644 (file)
@@ -27,7 +27,7 @@ Container::Container(std::string name): name(name)
 Container::~Container()
 {
   if (not this->children.empty())
-    for (auto child: this->children)
+    for (auto const& child : this->children)
       delete child;
 }
 
@@ -46,7 +46,7 @@ void Container::addResources(std::vector<sg_host_t> hosts)
 
   //FIXME do we need to sort?: xbt_dynar_sort_strings(host_names);
 
-  for (auto host : hosts) {
+  for (auto const& host : hosts) {
     const char *host_name = sg_host_get_name(host);
     this->name2id.insert({host_name, this->last_id});
     (this->last_id)++;
@@ -65,7 +65,7 @@ void Container::createHierarchy(sg_netzone_t from_as)
     from_as->getHosts(&table);
     this->addResources(table);
   } else {
-    for (auto nz : *from_as->getChildren()) {
+    for (auto const& nz : *from_as->getChildren()) {
       jed_container_t child_container = new simgrid::jedule::Container(std::string(nz->getCname()));
       this->addChild(child_container);
       child_container->createHierarchy(nz);
@@ -84,7 +84,7 @@ std::vector<int> Container::getHierarchy()
       unsigned int i =0;
       int child_nb = -1;
 
-      for (auto child : this->parent->children) {
+      for (auto const& child : this->parent->children) {
         if( child == this) {
           child_nb = i;
           break;
@@ -112,7 +112,7 @@ std::string Container::getHierarchyAsString()
 
   unsigned int length = heir_list.size();
   unsigned int i = 0;
-  for (auto id : heir_list) {
+  for (auto const& id : heir_list) {
     output += std::to_string(id);
     if( i != length-1 ) {
       output += ".";
@@ -131,7 +131,7 @@ void Container::printResources(FILE * jed_file)
   std::string resid = this->getHierarchyAsString();
 
   fprintf(jed_file, "      <rset id=\"%s\" nb=\"%u\" names=\"", resid.c_str(), res_nb);
-  for (auto res: this->resource_list) {
+  for (auto const& res : this->resource_list) {
     const char * res_name = sg_host_get_name(res);
     fprintf(jed_file, "%s", res_name);
     if( i != res_nb-1 ) {
@@ -146,7 +146,7 @@ void Container::print(FILE* jed_file)
 {
   fprintf(jed_file, "    <res name=\"%s\">\n", this->name.c_str());
   if (not this->children.empty()) {
-    for (auto child: this->children) {
+    for (auto const& child : this->children) {
       child->print(jed_file);
     }
   } else {
@@ -169,7 +169,7 @@ static void add_subsets_to(std::vector<jed_subset_t> *subset_list, std::vector<c
 
   std::vector<unsigned int> id_list;
 
-  for (auto host_name : hostgroup) {
+  for (auto const& host_name : hostgroup) {
     xbt_assert( host_name != nullptr );
     jed_container_t parent = host2_simgrid_parent_container.at(host_name);
     unsigned int id = parent->name2id.at(host_name);
@@ -207,7 +207,7 @@ void get_resource_selection_by_hosts(std::vector<jed_subset_t> *subset_list, std
   //  find parent container
   //  group by parent container
   std::unordered_map<const char*, std::vector<const char*>> parent2hostgroup;
-  for (auto host: *host_list) {
+  for (auto const& host : *host_list) {
     const char *host_name = sg_host_get_name(host);
     jed_container_t parent = host2_simgrid_parent_container.at(host_name);
     xbt_assert( parent != nullptr );
@@ -219,7 +219,7 @@ void get_resource_selection_by_hosts(std::vector<jed_subset_t> *subset_list, std
       host_group->second.push_back(host_name);
   }
 
-  for (auto elm: parent2hostgroup) {
+  for (auto const& elm : parent2hostgroup) {
     jed_container_t parent = container_name2container.at(elm.first);
     add_subsets_to(subset_list, elm.second, parent);
   }
index 2b4edf7..779a7b0 100644 (file)
@@ -16,7 +16,7 @@ EngineImpl::~EngineImpl()
 {
   sg_host_exit(); // Hosts should be part of the engine, at some point
   delete netRoot_;
-  for (auto kv : netpoints_)
+  for (auto const& kv : netpoints_)
     delete kv.second;
 }
 }
index 936b249..13e9870 100644 (file)
@@ -13,7 +13,7 @@ static std::map<std::string, smx_mailbox_t>* mailboxes = new std::map<std::strin
 
 void SIMIX_mailbox_exit()
 {
-  for (auto elm : *mailboxes)
+  for (auto const& elm : *mailboxes)
     delete elm.second;
   delete mailboxes;
 }
index a9543f7..7e8ea86 100644 (file)
@@ -21,7 +21,7 @@ void simgrid::kernel::activity::IoImpl::resume()
 
 void simgrid::kernel::activity::IoImpl::post()
 {
-  for (smx_simcall_t simcall : simcalls) {
+  for (smx_simcall_t const& simcall : simcalls) {
     switch (simcall->call) {
     case SIMCALL_FILE_WRITE:
       simcall_file_write__set__result(simcall, surf_io->getCost());
index 4ed2f29..67a6418 100644 (file)
@@ -58,7 +58,7 @@ void ThreadContextFactory::run_all()
 {
   if (smx_ctx_thread_sem == nullptr) {
     // Serial execution
-    for (smx_actor_t process : simix_global->process_to_run) {
+    for (smx_actor_t const& process : simix_global->process_to_run) {
       XBT_DEBUG("Handling %p",process);
       ThreadContext* context = static_cast<ThreadContext*>(process->context);
       xbt_os_sem_release(context->begin_);
@@ -66,9 +66,9 @@ void ThreadContextFactory::run_all()
     }
   } else {
     // Parallel execution
-    for (smx_actor_t process : simix_global->process_to_run)
+    for (smx_actor_t const& process : simix_global->process_to_run)
       xbt_os_sem_release(static_cast<ThreadContext*>(process->context)->begin_);
-    for (smx_actor_t process : simix_global->process_to_run)
+    for (smx_actor_t const& process : simix_global->process_to_run)
       xbt_os_sem_acquire(static_cast<ThreadContext*>(process->context)->end_);
   }
 }
index 296f3f8..1418fb4 100644 (file)
@@ -88,7 +88,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges
     new_xbt_graph_edge(graph, routerNode, backboneNode, edges);
   }
 
-  for (auto src : getVertices()) {
+  for (auto const& src : getVertices()) {
     if (not src->isRouter()) {
       xbt_node_t previous = new_xbt_graph_node(graph, src->cname(), nodes);
 
index a76b617..8808698 100644 (file)
@@ -167,7 +167,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb
 
     sg_platf_route_cbarg_t e_route = (sg_platf_route_cbarg_t)xbt_graph_edge_get_data(edge);
 
-    for (auto link : *e_route->link_list) {
+    for (auto const& link : *e_route->link_list) {
       route->link_list->insert(route->link_list->begin(), link);
       if (lat)
         *lat += static_cast<surf::LinkImpl*>(link)->latency();
@@ -265,7 +265,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb
       NetPoint* prev_gw_src_net_elm = nullptr;
       getGlobalRoute(gw_dst_net_elm, prev_gw_src_net_elm, &e_route_as_to_as, nullptr);
       auto pos = route->link_list->begin();
-      for (auto link : e_route_as_to_as) {
+      for (auto const& link : e_route_as_to_as) {
         route->link_list->insert(pos, link);
         if (lat)
           *lat += link->latency();
@@ -273,7 +273,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb
       }
     }
 
-    for (auto link : *e_route->link_list) {
+    for (auto const& link : *e_route->link_list) {
       route->link_list->insert(route->link_list->begin(), link);
       if (lat)
         *lat += static_cast<surf::LinkImpl*>(link)->latency();
index 329eff9..7c59972 100644 (file)
@@ -74,7 +74,7 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg
       getGlobalRoute(prev_dst_gw, e_route->gw_src, route->link_list, lat);
     }
 
-    for (auto link : *e_route->link_list) {
+    for (auto const& link : *e_route->link_list) {
       route->link_list->push_back(link);
       if (lat)
         *lat += link->latency();
index dbb5a80..ece81d3 100644 (file)
@@ -68,7 +68,7 @@ void FullZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_
   if (e_route != nullptr) {
     res->gw_src = e_route->gw_src;
     res->gw_dst = e_route->gw_dst;
-    for (auto link : *e_route->link_list) {
+    for (auto const& link : *e_route->link_list) {
       res->link_list->push_back(link);
       if (lat)
         *lat += link->latency();
index e128d57..994c6e1 100644 (file)
@@ -37,7 +37,7 @@ NetZoneImpl::NetZoneImpl(NetZone* father, std::string name) : NetZone(father, na
 
 NetZoneImpl::~NetZoneImpl()
 {
-  for (auto& kv : bypassRoutes_)
+  for (auto const& kv : bypassRoutes_)
     delete kv.second;
 
   simgrid::s4u::Engine::getInstance()->netpointUnregister(netpoint_);
@@ -56,7 +56,7 @@ simgrid::s4u::Host* NetZoneImpl::createHost(const char* name, std::vector<double
   surf_cpu_model_pm->createCpu(res, speedPerPstate, coreAmount);
 
   if (props != nullptr)
-    for (auto kv : *props)
+    for (auto const& kv : *props)
       res->setProperty(kv.first, kv.second);
 
   simgrid::s4u::Host::onCreation(*res); // notify the signal
@@ -85,7 +85,7 @@ void NetZoneImpl::addBypassRoute(sg_platf_route_cbarg_t e_route)
 
   /* Build a copy that will be stored in the dict */
   kernel::routing::BypassRoute* newRoute = new kernel::routing::BypassRoute(e_route->gw_src, e_route->gw_dst);
-  for (auto link : *e_route->link_list)
+  for (auto const& link : *e_route->link_list)
     newRoute->links.push_back(link);
 
   /* Store it */
@@ -213,7 +213,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
   if (dst->netzone() == this && src->netzone() == this) {
     if (bypassRoutes_.find({src, dst}) != bypassRoutes_.end()) {
       BypassRoute* bypassedRoute = bypassRoutes_.at({src, dst});
-      for (surf::LinkImpl* link : bypassedRoute->links) {
+      for (surf::LinkImpl* const& link : bypassedRoute->links) {
         links->push_back(link);
         if (latency)
           *latency += link->latency();
@@ -297,7 +297,7 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
               src->cname(), dst->cname(), bypassedRoute->links.size());
     if (src != key.first)
       getGlobalRoute(src, bypassedRoute->gw_src, links, latency);
-    for (surf::LinkImpl* link : bypassedRoute->links) {
+    for (surf::LinkImpl* const& link : bypassedRoute->links) {
       links->push_back(link);
       if (latency)
         *latency += link->latency();
@@ -348,7 +348,7 @@ void NetZoneImpl::getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst,
   /* If source gateway is not our source, we have to recursively find our way up to this point */
   if (src != route.gw_src)
     getGlobalRoute(src, route.gw_src, links, latency);
-  for (auto link : *route.link_list)
+  for (auto const& link : *route.link_list)
     links->push_back(link);
   delete route.link_list;
 
index cd223f1..fb5db13 100644 (file)
@@ -73,8 +73,8 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
 {
   std::vector<kernel::routing::NetPoint*> vertices = getVertices();
 
-  for (auto my_src : vertices) {
-    for (auto my_dst : vertices) {
+  for (auto const& my_src : vertices) {
+    for (auto const& my_dst : vertices) {
       if (my_src == my_dst)
         continue;
 
@@ -98,7 +98,7 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
         previous_name = my_src->cname();
       }
 
-      for (auto link : *route->link_list) {
+      for (auto const& link : *route->link_list) {
         const char* link_name = link->cname();
         current               = new_xbt_graph_node(graph, link_name, nodes);
         current_name          = link_name;
@@ -145,7 +145,7 @@ sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_pl
     result->gw_dst = routearg->gw_dst;
   }
 
-  for (auto link : *routearg->link_list) {
+  for (auto const& link : *routearg->link_list) {
     if (change_order)
       result->link_list->push_back(link);
     else
index 945fa9e..b3b83df 100644 (file)
@@ -17,7 +17,7 @@ inline void rankId_to_coords(int rankId, std::vector<unsigned int> dimensions, u
 {
   unsigned int dim_size_product = 1;
   unsigned int i = 0;
-  for (auto cur_dim_size: dimensions) {
+  for (auto const& cur_dim_size : dimensions) {
     (*coords)[i] = (rankId / dim_size_product) % cur_dim_size;
     dim_size_product *= cur_dim_size;
     i++;
@@ -84,7 +84,7 @@ void TorusZone::parse_specific_arguments(ClusterCreationArgs* cluster)
      * Parse attribute dimensions="dim1,dim2,dim3,...,dimN" and save them into a vector.
      * Additionally, we need to know how many ranks we have in total
      */
-    for (auto group : dimensions)
+    for (auto const& group : dimensions)
       dimensions_.push_back(surf_parse_get_int(group));
 
     linkCountPerNode_ = dimensions_.size();
@@ -135,7 +135,7 @@ void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg
   while (current_node != dst->id()) {
     unsigned int dim_product = 1; // First, we will route in x-dimension
     int j=0;
-    for (auto cur_dim : dimensions_){
+    for (auto const& cur_dim : dimensions_) {
       // current_node/dim_product = position in current dimension
       if ((current_node / dim_product) % cur_dim != (dst->id() / dim_product) % cur_dim) {
 
index 9901722..77ff837 100644 (file)
@@ -29,7 +29,7 @@ Coords::Coords(NetPoint* netpoint, std::string coordStr)
   boost::split(string_values, coordStr, boost::is_any_of(" "));
   xbt_assert(string_values.size() == 3, "Coordinates of %s must have 3 dimensions", netpoint->cname());
 
-  for (auto str : string_values)
+  for (auto const& str : string_values)
     try {
       coords.push_back(std::stod(str));
     } catch (std::invalid_argument const& ia) {
index a739fea..6263496 100644 (file)
@@ -37,7 +37,7 @@ public:
   ChunkedData() = default;
   void clear()
   {
-    for (std::size_t pageno : pagenos_)
+    for (std::size_t const& pageno : pagenos_)
       store_->unref_page(pageno);
     pagenos_.clear();
   }
@@ -51,7 +51,7 @@ public:
      : store_ (that.store_)
      , pagenos_(that.pagenos_)
   {
-    for (std::size_t pageno : pagenos_)
+    for (std::size_t const& pageno : pagenos_)
       store_->ref_page(pageno);
   }
   ChunkedData(ChunkedData&& that)
@@ -66,7 +66,7 @@ public:
     this->clear();
     store_ = that.store_;
     pagenos_ = that.pagenos_;
-    for (std::size_t pageno : pagenos_)
+    for (std::size_t const& pageno : pagenos_)
       store_->ref_page(pageno);
     return *this;
   }
index d5a8195..a82fa8f 100644 (file)
@@ -175,7 +175,7 @@ static void MC_report_crash(int status)
     XBT_INFO("No core dump was generated by the system.");
   XBT_INFO("Counter-example execution trace:");
   simgrid::mc::dumpRecordPath();
-  for (auto& s : mc_model_checker->getChecker()->getTextualTrace())
+  for (auto const& s : mc_model_checker->getChecker()->getTextualTrace())
     XBT_INFO("%s", s.c_str());
   simgrid::mc::session->logState();
   XBT_INFO("Stack trace:");
@@ -189,7 +189,7 @@ static void MC_report_assertion_error()
   XBT_INFO("**************************");
   XBT_INFO("Counter-example execution trace:");
   simgrid::mc::dumpRecordPath();
-  for (auto& s : mc_model_checker->getChecker()->getTextualTrace())
+  for (auto const& s : mc_model_checker->getChecker()->getTextualTrace())
     XBT_INFO("%s", s.c_str());
   simgrid::mc::session->logState();
 }
index 20d3e5e..a2e4993 100644 (file)
@@ -162,7 +162,7 @@ std::size_t PageStore::store_page(void* page)
 
   // Try to find a duplicate in set of pages with the same hash:
   page_set_type& page_set = this->hash_index_[hash];
-  for (size_t pageno : page_set) {
+  for (size_t const& pageno : page_set) {
     const void* snapshot_page = this->get_page(pageno);
     if (memcmp(page, snapshot_page, xbt_pagesize) == 0) {
 
index 4f3a21a..26cba12 100644 (file)
@@ -279,7 +279,7 @@ void LivenessChecker::showAcceptanceCycle(std::size_t depth)
   XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
   XBT_INFO("Counter-example that violates formula :");
   simgrid::mc::dumpRecordPath();
-  for (auto& s : this->getTextualTrace())
+  for (auto const& s : this->getTextualTrace())
     XBT_INFO("%s", s.c_str());
   simgrid::mc::session->logState();
   XBT_INFO("Counter-example depth : %zu", depth);
index a48780f..e360a1e 100644 (file)
@@ -48,7 +48,7 @@ void SafetyChecker::checkNonTermination(simgrid::mc::State* current_state)
       XBT_INFO("*** NON-PROGRESSIVE CYCLE DETECTED ***");
       XBT_INFO("******************************************");
       XBT_INFO("Counter-example execution trace:");
-      for (auto& s : mc_model_checker->getChecker()->getTextualTrace())
+      for (auto const& s : mc_model_checker->getChecker()->getTextualTrace())
         XBT_INFO("%s", s.c_str());
       simgrid::mc::session->logState();
 
index 5a342c6..2a1ddae 100644 (file)
@@ -306,7 +306,7 @@ int StateComparator::initHeapInformation(xbt_mheap_t heap1, xbt_mheap_t heap2,
 static inline
 mc_mem_region_t MC_get_heap_region(simgrid::mc::Snapshot* snapshot)
 {
-  for (auto& region : snapshot->snapshot_regions)
+  for (auto const& region : snapshot->snapshot_regions)
     if (region->region_type() == simgrid::mc::RegionType::Heap)
       return region.get();
   xbt_die("No heap region");
@@ -865,7 +865,7 @@ top:
           return res;
       }
     } else {
-      for(simgrid::mc::Member& member : type->members) {
+      for (simgrid::mc::Member& member : type->members) {
         // TODO, optimize this? (for the offset case)
         void *real_member1 = simgrid::dwarf::resolve_member(
           real_area1, type, &member, (simgrid::mc::AddressSpace*) snapshot1, process_index);
@@ -926,7 +926,7 @@ static simgrid::mc::Type* get_offset_type(void *real_base_address, simgrid::mc::
         return nullptr;
     }
 
-    for(simgrid::mc::Member& member : type->members) {
+    for (simgrid::mc::Member& member : type->members) {
       if (member.has_offset_location()) {
         // We have the offset, use it directly (shortcut):
         if (member.offset() == offset)
@@ -1395,7 +1395,7 @@ static int compare_areas_with_type(simgrid::mc::StateComparator& state,
   }
   case DW_TAG_structure_type:
   case DW_TAG_class_type:
-    for(simgrid::mc::Member& member : type->members) {
+    for (simgrid::mc::Member& member : type->members) {
       void *member1 = simgrid::dwarf::resolve_member(
         real_area1, type, &member, snapshot1, process_index);
       void *member2 = simgrid::dwarf::resolve_member(
@@ -1459,7 +1459,7 @@ static int compare_global_variables(
 
   std::vector<simgrid::mc::Variable>& variables = object_info->global_variables;
 
-  for (simgrid::mc::Variable& current_var : variables) {
+  for (simgrid::mc::Variable const& current_var : variables) {
 
     // If the variable is not in this object, skip it:
     // We do not expect to find a pointer to something which is not reachable
index a12f15c..3e02230 100644 (file)
@@ -37,7 +37,7 @@ void wait_for_requests()
 #endif
   while (not simix_global->process_to_run.empty()) {
     SIMIX_process_runall();
-    for (smx_actor_t process : simix_global->process_that_ran) {
+    for (smx_actor_t const& process : simix_global->process_that_ran) {
       smx_simcall_t req = &process->simcall;
       if (req->call != SIMCALL_NONE && not simgrid::mc::request_is_visible(req))
         SIMIX_simcall_handle(req, 0);
@@ -45,7 +45,7 @@ void wait_for_requests()
   }
 #if SIMGRID_HAVE_MC
   xbt_dynar_reset(simix_global->actors_vector);
-  for (std::pair<aid_t, smx_actor_t> kv : simix_global->process_list) {
+  for (std::pair<aid_t, smx_actor_t> const& kv : simix_global->process_list) {
     xbt_dynar_push_as(simix_global->actors_vector, smx_actor_t, kv.second);
   }
 #endif
index daf52a4..44d5091 100644 (file)
@@ -288,8 +288,7 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame,
   if (not scope || not scope->range.contain(stack_frame->ip))
     return;
 
-  for(simgrid::mc::Variable& current_variable :
-      scope->variables) {
+  for (simgrid::mc::Variable& current_variable : scope->variables) {
 
     if (not valid_variable(&current_variable, scope, (void*)stack_frame->ip))
       continue;
@@ -331,7 +330,7 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame,
   }
 
   // Recursive processing of nested scopes:
-  for(simgrid::mc::Frame& nested_scope : scope->scopes)
+  for (simgrid::mc::Frame& nested_scope : scope->scopes)
     fill_local_variables_values(
       stack_frame, &nested_scope, process_index, result);
 }
@@ -453,7 +452,7 @@ static void snapshot_handle_ignore(simgrid::mc::Snapshot* snapshot)
   }
 
   // Zero the memory:
-  for(auto const& region : mc_model_checker->process().ignored_regions())
+  for (auto const& region : mc_model_checker->process().ignored_regions())
     snapshot->process()->clear_bytes(remote(region.addr), region.size);
 
 }
@@ -559,7 +558,7 @@ std::shared_ptr<simgrid::mc::Snapshot> take_snapshot(int num_state)
 
   std::shared_ptr<simgrid::mc::Snapshot> snapshot = std::make_shared<simgrid::mc::Snapshot>(mc_process, num_state);
 
-  for (auto& p : mc_model_checker->process().actors())
+  for (auto const& p : mc_model_checker->process().actors())
     snapshot->enabled_processes.insert(p.copy.getBuffer()->pid);
 
   snapshot_handle_ignore(snapshot.get());
@@ -588,7 +587,7 @@ std::shared_ptr<simgrid::mc::Snapshot> take_snapshot(int num_state)
 static inline
 void restore_snapshot_regions(simgrid::mc::Snapshot* snapshot)
 {
-  for(std::unique_ptr<s_mc_mem_region_t> const& region : snapshot->snapshot_regions) {
+  for (std::unique_ptr<s_mc_mem_region_t> const& region : snapshot->snapshot_regions) {
     // For privatized, variables we decided it was not necessary to take the snapshot:
     if (region)
       restore(region.get());
index e05b628..8be8053 100644 (file)
@@ -1134,7 +1134,7 @@ std::string find_by_build_id(std::vector<char> id)
 {
   std::string filename;
   std::string hex = to_hex(id);
-  for (const char* debug_path : debug_paths) {
+  for (const char* const& debug_path : debug_paths) {
     // Example:
     filename = std::string(debug_path) + ".build-id/"
       + to_hex(id.data(), 1) + '/'
@@ -1277,7 +1277,7 @@ static void MC_post_process_variables(simgrid::mc::ObjectInformation* info)
   // Someone needs this to be sorted but who?
   boost::range::sort(info->global_variables, MC_compare_variable);
 
-  for(simgrid::mc::Variable& variable : info->global_variables)
+  for (simgrid::mc::Variable& variable : info->global_variables)
     if (variable.type_id)
       variable.type = simgrid::util::find_map_ptr(
         info->types, variable.type_id);
@@ -1303,8 +1303,7 @@ static void mc_post_process_scope(simgrid::mc::ObjectInformation* info, simgrid:
 
   // Recursive post-processing of nested-scopes:
   for (simgrid::mc::Frame& nested_scope : scope->scopes)
-      mc_post_process_scope(info, &nested_scope);
-
+    mc_post_process_scope(info, &nested_scope);
 }
 
 static
@@ -1337,7 +1336,7 @@ simgrid::mc::Type* MC_resolve_type(
 static void MC_post_process_types(simgrid::mc::ObjectInformation* info)
 {
   // Lookup "subtype" field:
-  for(auto& i : info->types) {
+  for (auto& i : info->types) {
     i.second.subtype = MC_resolve_type(info, i.second.type_id);
     for (simgrid::mc::Member& member : i.second.members)
       member.type = MC_resolve_type(info, member.type_id);
index 07eeace..0204bbd 100644 (file)
@@ -96,7 +96,7 @@ void MC_run()
   simgrid::mc::processes_time.resize(SIMIX_process_get_maxpid());
   MC_ignore_heap(simgrid::mc::processes_time.data(),
     simgrid::mc::processes_time.size() * sizeof(simgrid::mc::processes_time[0]));
-  for (auto kv : simix_global->process_list) {
+  for (auto const& kv : simix_global->process_list) {
     smx_actor_t actor = kv.second;
     MC_ignore_heap(&(actor->process_hookup), sizeof(actor->process_hookup));
   }
@@ -110,7 +110,7 @@ void MC_show_deadlock()
   XBT_INFO("*** DEAD-LOCK DETECTED ***");
   XBT_INFO("**************************");
   XBT_INFO("Counter-example execution trace:");
-  for (auto& s : mc_model_checker->getChecker()->getTextualTrace())
+  for (auto const& s : mc_model_checker->getChecker()->getTextualTrace())
     XBT_INFO("%s", s.c_str());
   simgrid::mc::session->logState();
 }
index d6a72a1..20b9c2d 100644 (file)
@@ -88,7 +88,7 @@ void Client::handleDeadlockCheck(mc_message_t* msg)
   bool deadlock = false;
   if (not simix_global->process_list.empty()) {
     deadlock = true;
-    for (auto kv : simix_global->process_list)
+    for (auto const& kv : simix_global->process_list)
       if (simgrid::mc::actor_is_enabled(kv.second)) {
         deadlock = false;
         break;
index 3811904..74ffde1 100644 (file)
@@ -105,7 +105,7 @@ static bool is_simgrid_lib(const char* libname)
 
 static bool is_filtered_lib(const char* libname)
 {
-  for (const char* filtered_lib : filtered_libraries)
+  for (const char* const& filtered_lib : filtered_libraries)
     if (strcmp(libname, filtered_lib) == 0)
       return true;
   return false;
index 9557caa..917c868 100644 (file)
@@ -40,7 +40,7 @@ msg_error_t MSG_action_trace_run(char *path)
     XBT_WARN("Not all actions got consumed. If the simulation ended successfully (without deadlock),"
              " you may want to add new processes to your deployment file.");
 
-    for (auto actions_of : simgrid::xbt::action_queues) {
+    for (auto const& actions_of : simgrid::xbt::action_queues) {
       XBT_WARN("Still %zu actions for %s", actions_of.second->size(), actions_of.first.c_str());
     }
   }
index 1114b49..8399065 100644 (file)
@@ -53,7 +53,7 @@ msg_netzone_t MSG_zone_get_by_name(const char* name)
 
 void MSG_zone_get_sons(msg_netzone_t netzone, xbt_dict_t whereto)
 {
-  for (auto elem : *netzone->getChildren()) {
+  for (auto const& elem : *netzone->getChildren()) {
     xbt_dict_set(whereto, elem->getCname(), static_cast<void*>(elem), nullptr);
   }
 }
@@ -73,7 +73,7 @@ void MSG_zone_get_hosts(msg_netzone_t netzone, xbt_dynar_t whereto)
   /* converts vector to dynar */
   std::vector<simgrid::s4u::Host*> hosts;
   netzone->getHosts(&hosts);
-  for (auto host : hosts)
+  for (auto const& host : hosts)
     xbt_dynar_push(whereto, &host);
 }
 
index cea2d8a..e40c790 100644 (file)
@@ -169,7 +169,7 @@ xbt_dict_t MSG_host_get_properties(msg_host_t host)
   std::map<std::string, std::string>* props = host->getProperties();
   if (props == nullptr)
     return nullptr;
-  for (auto elm : *props) {
+  for (auto const& elm : *props) {
     xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr);
   }
   return as_dict;
@@ -262,7 +262,7 @@ xbt_dict_t MSG_host_get_storage_content(msg_host_t host)
 {
   xbt_assert((host != nullptr), "Invalid parameters");
   xbt_dict_t contents = xbt_dict_new_homogeneous(nullptr);
-  for (auto elm : host->getMountedStorages())
+  for (auto const& elm : host->getMountedStorages())
     xbt_dict_set(contents, elm.first.c_str(), MSG_storage_get_content(elm.second), nullptr);
 
   return contents;
index 3b06983..7156228 100644 (file)
@@ -285,7 +285,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
   msg_host_t dst_host;
   size_t longest_prefix_length = 0;
 
-  for (auto elm : host->getMountedStorages()) {
+  for (auto const& elm : host->getMountedStorages()) {
     std::string mount_point = std::string(fullpath).substr(0, elm.first.size());
     if (mount_point == elm.first && elm.first.length() > longest_prefix_length) {
       /* The current mount name is found in the full path and is bigger than the previous*/
@@ -393,7 +393,7 @@ xbt_dict_t MSG_storage_get_properties(msg_storage_t storage)
   std::map<std::string, std::string>* props = storage->getProperties();
   if (props == nullptr)
     return nullptr;
-  for (auto elm : *props) {
+  for (auto const& elm : *props) {
     xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr);
   }
   return as_dict;
@@ -440,7 +440,7 @@ xbt_dynar_t MSG_storages_as_dynar()
 {
   std::map<std::string, simgrid::s4u::Storage*>* storage_map = simgrid::s4u::allStorages();
   xbt_dynar_t res = xbt_dynar_new(sizeof(msg_storage_t),nullptr);
-  for (auto s : *storage_map)
+  for (auto const& s : *storage_map)
     xbt_dynar_push(res, &(s.second));
   delete storage_map;
   return res;
@@ -480,7 +480,7 @@ xbt_dict_t MSG_storage_get_content(msg_storage_t storage)
   std::map<std::string, sg_size_t>* content = storage->getContent();
   xbt_dict_t content_as_dict = xbt_dict_new_homogeneous(xbt_free_f);
 
-  for (auto entry : *content) {
+  for (auto const& entry : *content) {
     sg_size_t* psize = static_cast<sg_size_t*>(malloc(sizeof(sg_size_t)));
     *psize           = entry.second;
     xbt_dict_set(content_as_dict, entry.first.c_str(), psize, nullptr);
index d26778e..75a3997 100644 (file)
@@ -306,7 +306,7 @@ msg_process_t MSG_process_from_PID(int PID)
 /** @brief returns a list of all currently existing processes */
 xbt_dynar_t MSG_processes_as_dynar() {
   xbt_dynar_t res = xbt_dynar_new(sizeof(smx_actor_t), nullptr);
-  for (auto kv : simix_global->process_list) {
+  for (auto const& kv : simix_global->process_list) {
     smx_actor_t actor = kv.second;
     xbt_dynar_push(res, &actor);
   }
@@ -391,7 +391,7 @@ xbt_dict_t MSG_process_get_properties(msg_process_t process)
       simgrid::simix::kernelImmediate([process] { return process->getImpl()->getProperties(); });
   if (props == nullptr)
     return nullptr;
-  for (auto elm : *props) {
+  for (auto const& elm : *props) {
     xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr);
   }
   return as_dict;
index da329f3..f12bbd0 100644 (file)
@@ -338,7 +338,7 @@ static void start_dirty_page_tracking(msg_vm_t vm)
   if (vm->pimpl_vm_->dp_objs.empty())
     return;
 
-  for (auto elm : vm->pimpl_vm_->dp_objs) {
+  for (auto const& elm : vm->pimpl_vm_->dp_objs) {
     dirty_page_t dp    = elm.second;
     double remaining = MSG_task_get_flops_amount(dp->task);
     dp->prev_clock = MSG_get_clock();
@@ -367,7 +367,7 @@ static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug
 {
   double total = 0;
 
-  for (auto elm : vm->pimpl_vm_->dp_objs) {
+  for (auto const& elm : vm->pimpl_vm_->dp_objs) {
     const char* key  = elm.first.c_str();
     dirty_page_t dp  = elm.second;
     double remaining = MSG_task_get_flops_amount(dp->task);
index a3b4a0a..ea9a040 100644 (file)
@@ -71,7 +71,7 @@ double VMModel::nextOccuringEvent(double now)
    **/
 
   /* iterate for all virtual machines */
-  for (s4u::VirtualMachine* ws_vm : VirtualMachineImpl::allVms_) {
+  for (s4u::VirtualMachine* const& ws_vm : VirtualMachineImpl::allVms_) {
     surf::Cpu* cpu = ws_vm->pimpl_cpu;
     xbt_assert(cpu, "cpu-less host");
 
index 7c4f791..7915262 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-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. */
@@ -71,7 +71,7 @@ void VirtualMachine::start()
     if (pm_ramsize && not pm_overcommit) { /* Only verify that we don't overcommit on need */
       /* Retrieve the memory occupied by the VMs on that host. Yep, we have to traverse all VMs of all hosts for that */
       long total_ramsize_of_vms = 0;
-      for (simgrid::s4u::VirtualMachine* ws_vm : simgrid::vm::VirtualMachineImpl::allVms_)
+      for (simgrid::s4u::VirtualMachine* const& ws_vm : simgrid::vm::VirtualMachineImpl::allVms_)
         if (pm == ws_vm->pimpl_vm_->getPm())
           total_ramsize_of_vms += ws_vm->pimpl_vm_->getRamsize();
 
index 50d287e..07fa11b 100644 (file)
@@ -88,7 +88,7 @@ size_t Engine::getHostCount()
 /** @brief Fills the passed list with all hosts found in the platform */
 void Engine::getHostList(std::vector<Host*>* list)
 {
-  for (auto kv : host_list)
+  for (auto const& kv : host_list)
     list->push_back(kv.second);
 }
 
@@ -110,7 +110,7 @@ static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* n
   if (not strcmp(current->getCname(), name))
     return current;
 
-  for (auto elem : *(current->getChildren())) {
+  for (auto const& elem : *(current->getChildren())) {
     simgrid::s4u::NetZone* tmp = netzoneByNameRecursive(elem, name);
     if (tmp != nullptr) {
       return tmp;
@@ -135,7 +135,7 @@ simgrid::kernel::routing::NetPoint* Engine::getNetpointByNameOrNull(std::string
 /** @brief Fill the provided vector with all existing netpoints */
 void Engine::getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*>* list)
 {
-  for (auto kv : pimpl->netpoints_)
+  for (auto const& kv : pimpl->netpoints_)
     list->push_back(kv.second);
 }
 /** @brief Register a new netpoint to the system */
index 35f59e7..14c73e0 100644 (file)
@@ -27,7 +27,7 @@ File::File(std::string fullpath, sg_host_t host, void* userdata) : path_(fullpat
   std::string path;
   XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath.c_str(), host->getCname());
 
-  for (auto mnt : host->getMountedStorages()) {
+  for (auto const& mnt : host->getMountedStorages()) {
     XBT_DEBUG("See '%s'", mnt.first.c_str());
     mount_point = fullpath.substr(0, mnt.first.length());
 
index 5439ce8..2bb3ab1 100644 (file)
@@ -157,7 +157,7 @@ void Host::routeTo(Host* dest, std::vector<Link*>* links, double* latency)
 {
   std::vector<surf::LinkImpl*> linkImpls;
   this->routeTo(dest, &linkImpls, latency);
-  for (surf::LinkImpl* l : linkImpls)
+  for (surf::LinkImpl* const& l : linkImpls)
     links->push_back(&l->piface_);
 }
 
@@ -168,7 +168,7 @@ void Host::routeTo(Host* dest, std::vector<surf::LinkImpl*>* links, double* late
   if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
     XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", getCname(), dest->getCname(),
                (latency == nullptr ? -1 : *latency));
-    for (auto link : *links)
+    for (auto const& link : *links)
       XBT_CDEBUG(surf_route, "Link %s", link->cname());
   }
 }
@@ -248,7 +248,7 @@ std::unordered_map<std::string, Storage*> const& Host::getMountedStorages()
 {
   if (mounts == nullptr) {
     mounts = new std::unordered_map<std::string, Storage*>();
-    for (auto m : this->pimpl_->storage_) {
+    for (auto const& m : this->pimpl_->storage_) {
       mounts->insert({m.first, &m.second->piface_});
     }
   }
index 1490c8f..0dc3a43 100644 (file)
@@ -35,7 +35,7 @@ void NetZone::seal()
 
 NetZone::~NetZone()
 {
-  for (auto nz : *children_)
+  for (auto const& nz : *children_)
     delete nz;
   delete children_;
 }
@@ -74,7 +74,7 @@ NetZone* NetZone::getFather()
 
 void NetZone::getHosts(std::vector<s4u::Host*>* whereto)
 {
-  for (auto card : vertices_) {
+  for (auto const& card : vertices_) {
     s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->name());
     if (host != nullptr)
       whereto->push_back(host);
index 3890ce3..092afea 100644 (file)
@@ -16,7 +16,7 @@ std::map<std::string, Storage*>* allStorages()
 {
   std::unordered_map<std::string, surf::StorageImpl*>* map = surf::StorageImpl::storagesMap();
   std::map<std::string, Storage*>* res                     = new std::map<std::string, Storage*>;
-  for (auto s : *map)
+  for (auto const& s : *map)
     res->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface
 
   return res;
index 17ce94e..110716b 100644 (file)
@@ -35,20 +35,20 @@ void uniq_transfer_task_name(SD_task_t task)
 }
 
 static bool children_are_marked(SD_task_t task){
-  for (SD_task_t it : *task->successors)
+  for (SD_task_t const& it : *task->successors)
     if (it->marked == 0)
       return false;
-  for (SD_task_t it : *task->outputs)
+  for (SD_task_t const& it : *task->outputs)
     if (it->marked == 0)
       return false;
   return true;
 }
 
 static bool parents_are_marked(SD_task_t task){
-  for (SD_task_t it : *task->predecessors)
+  for (SD_task_t const& it : *task->predecessors)
     if (it->marked == 0)
       return false;
-  for (SD_task_t it : *task->inputs)
+  for (SD_task_t const& it : *task->inputs)
     if (it->marked == 0)
       return false;
   return true;
@@ -68,17 +68,17 @@ bool acyclic_graph_detail(xbt_dynar_t dag){
   }
   while (not current.empty()) {
     std::vector<SD_task_t> next;
-    for (auto t: current){
+    for (auto const& t : current) {
       //Mark task
       t->marked = 1;
-      for (SD_task_t input : *t->inputs){
+      for (SD_task_t const& input : *t->inputs) {
         input->marked=1;
         // Inputs are communication, hence they can have only one predecessor
         SD_task_t input_pred = *(input->predecessors->begin());
         if (children_are_marked(input_pred))
           next.push_back(input_pred);
       }
-      for (SD_task_t pred : *t->predecessors) {
+      for (SD_task_t const& pred : *t->predecessors) {
         if (children_are_marked(pred))
           next.push_back(pred);
       }
@@ -109,22 +109,22 @@ bool acyclic_graph_detail(xbt_dynar_t dag){
     while (not current.empty()) {
       std::vector<SD_task_t> next;
       //test if the current iteration is done
-      for (auto t: current){
+      for (auto const& t : current) {
         t->marked = 1;
-        for (SD_task_t output : *t->outputs) {
+        for (SD_task_t const& output : *t->outputs) {
           output->marked = 1;
           // outputs are communication, hence they can have only one successor
           SD_task_t output_succ = *(output->successors->begin());
           if (parents_are_marked(output_succ))
             next.push_back(output_succ);
         }
-        for (SD_task_t succ : *t->successors) {
+        for (SD_task_t const& succ : *t->successors) {
           if (parents_are_marked(succ))
             next.push_back(succ);
         }
-        current.clear();
-        current = next;
       }
+      current.clear();
+      current = next;
     }
 
     all_marked = true;
@@ -186,26 +186,26 @@ xbt_dynar_t SD_daxload(const char *filename)
    * Files not consumed in the system are said to be consumed by end task (bottom of DAG).
    */
 
-  for (auto elm : files) {
+  for (auto const& elm : files) {
     file = elm.second;
     SD_task_t newfile;
     if (file->predecessors->empty()) {
-      for (SD_task_t it : *file->successors) {
+      for (SD_task_t const& it : *file->successors) {
         newfile = SD_task_create_comm_e2e(file->name, nullptr, file->amount);
         SD_task_dependency_add(nullptr, nullptr, root_task, newfile);
         SD_task_dependency_add(nullptr, nullptr, newfile, it);
         xbt_dynar_push(result, &newfile);
       }
     } else if (file->successors->empty()) {
-      for (SD_task_t it : *file->predecessors){
+      for (SD_task_t const& it : *file->predecessors) {
         newfile = SD_task_create_comm_e2e(file->name, nullptr, file->amount);
         SD_task_dependency_add(nullptr, nullptr, it, newfile);
         SD_task_dependency_add(nullptr, nullptr, newfile, end_task);
         xbt_dynar_push(result, &newfile);
       }
     } else {
-      for (SD_task_t it : *file->predecessors) {
-        for (SD_task_t it2 : *file->successors) {
+      for (SD_task_t const& it : *file->predecessors) {
+        for (SD_task_t const& it2 : *file->successors) {
           if (it == it2) {
             XBT_WARN ("File %s is produced and consumed by task %s."
                       "This loop dependency will prevent the execution of the task.", file->name, it->name);
@@ -223,7 +223,7 @@ xbt_dynar_t SD_daxload(const char *filename)
   xbt_dynar_push(result, &end_task);
 
   /* Free previous copy of the files */
-  for (auto elm : files)
+  for (auto const& elm : files)
     SD_task_destroy(elm.second);
   unsigned int cpt;
   xbt_dynar_foreach(result, cpt, file) {
index 0960689..663dcb0 100644 (file)
@@ -213,9 +213,9 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
   if(schedule){
     if (schedule_success) {
       const sg_host_t *workstations = sg_host_list ();
-      for (auto elm : computers) {
+      for (auto const& elm : computers) {
         SD_task_t previous_task = nullptr;
-        for (auto task : *elm.second) {
+        for (auto const& task : *elm.second) {
           /* add dependency between the previous and the task to avoid parallel execution */
           if(task){
             if (previous_task && not SD_task_dependency_exists(previous_task, task))
@@ -229,7 +229,7 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
       }
     } else {
       XBT_WARN("The scheduling is ignored");
-      for (auto elm : computers)
+      for (auto const& elm : computers)
         delete elm.second;
       xbt_dynar_free(&result);
       result = nullptr;
index 805dd0e..9fe8020 100644 (file)
@@ -55,7 +55,7 @@ std::set<SD_task_t>* simulate(double how_long){
       total_time += elapsed_time;
 
     /* let's see which tasks are done */
-    for (const auto& model : *all_existing_models) {
+    for (auto const& model : *all_existing_models) {
       surf_action_t action = surf_model_extract_done_action_set(model);
       while (action != nullptr) {
         SD_task_t task = static_cast<SD_task_t>(action->getData());
@@ -67,7 +67,7 @@ std::set<SD_task_t>* simulate(double how_long){
           sd_global->return_set->insert(task);
 
         /* remove the dependencies after this task */
-        for (const auto& succ : *task->successors) {
+        for (auto const& succ : *task->successors) {
           succ->predecessors->erase(task);
           succ->inputs->erase(task);
           XBT_DEBUG("Release dependency on %s: %zu remain(s). Becomes schedulable if %zu=0", SD_task_get_name(succ),
@@ -84,7 +84,7 @@ std::set<SD_task_t>* simulate(double how_long){
         }
         task->successors->clear();
 
-        for (const auto& output : *task->outputs) {
+        for (auto const& output : *task->outputs) {
           output->start_time = task->finish_time;
           output->predecessors->erase(task);
           if (SD_task_get_state(output) == SD_SCHEDULED)
@@ -119,7 +119,7 @@ std::set<SD_task_t>* simulate(double how_long){
 
   if (not sd_global->watch_point_reached && how_long < 0 && not sd_global->initial_tasks->empty()) {
     XBT_WARN("Simulation is finished but %zu tasks are still not done", sd_global->initial_tasks->size());
-    for (const auto& t : *sd_global->initial_tasks)
+    for (auto const& t : *sd_global->initial_tasks)
       XBT_WARN("%s is in %s state", SD_task_get_name(t), __get_state_name(SD_task_get_state(t)));
   }
 
@@ -231,7 +231,7 @@ void SD_simulate(double how_long)
 void SD_simulate_with_update(double how_long, xbt_dynar_t changed_tasks_dynar)
 {
   std::set<SD_task_t> *changed_tasks = simgrid::sd::simulate(how_long);
-  for (const auto& task : *changed_tasks)
+  for (auto const& task : *changed_tasks)
     xbt_dynar_push(changed_tasks_dynar, &task);
 }
 
index 0dee8e1..978bb6b 100644 (file)
@@ -336,9 +336,9 @@ xbt_dynar_t SD_task_get_parents(SD_task_t task)
 {
   xbt_dynar_t parents = xbt_dynar_new(sizeof(SD_task_t), nullptr);
 
-  for (auto it : *task->predecessors)
+  for (auto const& it : *task->predecessors)
     xbt_dynar_push(parents, &it);
-  for (auto it : *task->inputs)
+  for (auto const& it : *task->inputs)
     xbt_dynar_push(parents, &it);
 
   return parents;
@@ -353,9 +353,9 @@ xbt_dynar_t SD_task_get_children(SD_task_t task)
 {
   xbt_dynar_t children = xbt_dynar_new(sizeof(SD_task_t), nullptr);
 
-  for (auto it : *task->successors)
+  for (auto const& it : *task->successors)
     xbt_dynar_push(children, &it);
-  for (auto it : *task->outputs)
+  for (auto const& it : *task->outputs)
     xbt_dynar_push(children, &it);
 
   return children;
@@ -380,7 +380,7 @@ int SD_task_get_workstation_count(SD_task_t task)
  */
 sg_host_t *SD_task_get_workstation_list(SD_task_t task)
 {
-  return &(*(task->allocation))[0];
+  return task->allocation->data();
 }
 
 /**
@@ -480,18 +480,18 @@ void SD_task_dump(SD_task_t task)
   XBT_INFO("  - Dependencies to satisfy: %zu", task->inputs->size()+ task->predecessors->size());
   if ((task->inputs->size()+ task->predecessors->size()) > 0) {
     XBT_INFO("  - pre-dependencies:");
-    for (auto it : *task->predecessors)
+    for (auto const& it : *task->predecessors)
       XBT_INFO("    %s", it->name);
 
-    for (auto it: *task->inputs)
+    for (auto const& it : *task->inputs)
       XBT_INFO("    %s", it->name);
   }
   if ((task->outputs->size() + task->successors->size()) > 0) {
     XBT_INFO("  - post-dependencies:");
 
-    for (auto it : *task->successors)
+    for (auto const& it : *task->successors)
       XBT_INFO("    %s", it->name);
-    for (auto it : *task->outputs)
+    for (auto const& it : *task->outputs)
       XBT_INFO("    %s", it->name);
   }
 }
@@ -514,9 +514,9 @@ void SD_task_dotty(SD_task_t task, void *out)
     xbt_die("Unknown task type!");
   }
   fprintf(fout, "];\n");
-  for (auto it : *task->predecessors)
+  for (auto const& it : *task->predecessors)
     fprintf(fout, " T%p -> T%p;\n", it, task);
-  for (auto it : *task->inputs)
+  for (auto const& it : *task->inputs)
     fprintf(fout, " T%p -> T%p;\n", it, task);
 }
 
@@ -800,7 +800,7 @@ void SD_task_run(SD_task_t task)
   int host_nb = task->allocation->size();
   sg_host_t *hosts = xbt_new(sg_host_t, host_nb);
   int i =0;
-  for (auto host: *task->allocation){
+  for (auto const& host : *task->allocation) {
     hosts[i] = host;
     i++;
   }
@@ -926,7 +926,7 @@ void SD_task_schedulev(SD_task_t task, int count, const sg_host_t * list)
   SD_task_do_schedule(task);
 
   /* Iterate over all inputs and outputs to say where I am located (and start them if runnable) */
-  for (auto input : *task->inputs){
+  for (auto const& input : *task->inputs) {
     int src_nb = input->allocation->size();
     int dst_nb = count;
     if (input->allocation->empty())
@@ -945,7 +945,7 @@ void SD_task_schedulev(SD_task_t task, int count, const sg_host_t * list)
     }
   }
 
-  for (auto output : *task->outputs){
+  for (auto const& output : *task->outputs) {
     int src_nb = count;
     int dst_nb = output->allocation->size();
     if (output->allocation->empty())
index b86e068..3d528ae 100644 (file)
@@ -37,12 +37,12 @@ void sg_host_exit()
    * the tests.
    */
   std::vector<std::string> names = std::vector<std::string>();
-  for (auto kv : simgrid::s4u::host_list)
+  for (auto const& kv : simgrid::s4u::host_list)
     names.push_back(kv.second->getName());
 
   std::sort(names.begin(), names.end());
 
-  for (auto name : names)
+  for (auto const& name : names)
     simgrid::s4u::host_list.at(name)->destroy();
 
   // host_list.clear(); This would be sufficient if the dict would contain smart_ptr. It's now useless
@@ -97,7 +97,7 @@ xbt_dynar_t sg_hosts_as_dynar()
 {
   xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),nullptr);
 
-  for (auto kv : simgrid::s4u::host_list) {
+  for (auto const& kv : simgrid::s4u::host_list) {
     simgrid::s4u::Host* host = kv.second;
     if (host && host->pimpl_netpoint && host->pimpl_netpoint->isHost())
       xbt_dynar_push(res, &host);
@@ -123,7 +123,7 @@ void sg_host_user_destroy(sg_host_t host) {
 xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){
   xbt_assert((host != nullptr), "Invalid parameters");
   xbt_dict_t res = xbt_dict_new_homogeneous(nullptr);
-  for (auto elm : host->getMountedStorages()) {
+  for (auto const& elm : host->getMountedStorages()) {
     const char* mount_name = elm.first.c_str();
     sg_storage_t storage   = elm.second;
     xbt_dict_set(res, mount_name, (void*)storage->getName(), nullptr);
@@ -136,7 +136,7 @@ xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){
   std::vector<const char*>* storage_vector = new std::vector<const char*>();
   xbt_dynar_t storage_dynar = xbt_dynar_new(sizeof(const char*), nullptr);
   host->getAttachedStorages(storage_vector);
-  for (auto name : *storage_vector)
+  for (auto const& name : *storage_vector)
     xbt_dynar_push(storage_dynar, &name);
   delete storage_vector;
   return storage_dynar;
@@ -184,7 +184,7 @@ xbt_dict_t sg_host_get_properties(sg_host_t host) {
   std::map<std::string, std::string>* props = host->getProperties();
   if (props == nullptr)
     return nullptr;
-  for (auto elm : *props) {
+  for (auto const& elm : *props) {
     xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr);
   }
   return as_dict;
@@ -218,7 +218,7 @@ void sg_host_route(sg_host_t from, sg_host_t to, xbt_dynar_t links)
 {
   std::vector<simgrid::s4u::Link*> vlinks;
   from->routeTo(to, &vlinks, nullptr);
-  for (auto link : vlinks)
+  for (auto const& link : vlinks)
     xbt_dynar_push(links, &link);
 }
 /**
@@ -246,7 +246,7 @@ double sg_host_route_bandwidth(sg_host_t from, sg_host_t to)
 
   std::vector<simgrid::s4u::Link*> vlinks;
   from->routeTo(to, &vlinks, nullptr);
-  for (auto link : vlinks) {
+  for (auto const& link : vlinks) {
     double bandwidth = link->bandwidth();
     if (bandwidth < min_bandwidth || min_bandwidth < 0.0)
       min_bandwidth = bandwidth;
@@ -264,7 +264,7 @@ void sg_host_dump(sg_host_t host)
 
   if (not props->empty()) {
     XBT_INFO("  - properties:");
-    for (auto elm : *props) {
+    for (auto const& elm : *props) {
       XBT_INFO("    %s->%s", elm.first.c_str(), elm.second.c_str());
     }
   }
index 610678f..930d90e 100644 (file)
@@ -330,7 +330,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, v
 
   /* Add properties */
   if (properties != nullptr)
-    for (auto kv : *properties)
+    for (auto const& kv : *properties)
       process->setProperty(kv.first, kv.second);
 
   /* Make sure that the process is initialized for simix, in case we are called from the Host::onCreation signal */
@@ -400,7 +400,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
 
   /* Add properties */
   if (properties != nullptr)
-    for (auto kv : *properties)
+    for (auto const& kv : *properties)
       process->setProperty(kv.first, kv.second);
 
   /* Add the process to it's host process list */
@@ -545,9 +545,8 @@ void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const
 
     simgrid::kernel::activity::ExecImplPtr exec =
         boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(process->waiting_synchro);
-    if (exec != nullptr) {
-      SIMIX_execution_cancel(process->waiting_synchro);
-    }
+    if (exec != nullptr && exec->surf_exec)
+      exec->surf_exec->cancel();
 
     simgrid::kernel::activity::CommImplPtr comm =
         boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(process->waiting_synchro);
@@ -593,7 +592,7 @@ void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid) {
  */
 void SIMIX_process_killall(smx_actor_t issuer, int reset_pid)
 {
-  for (auto kv : simix_global->process_list)
+  for (auto const& kv : simix_global->process_list)
     if (kv.second != issuer)
       SIMIX_process_kill(kv.second, issuer);
 
@@ -665,7 +664,7 @@ const char* SIMIX_process_self_get_name() {
 
 smx_actor_t SIMIX_process_get_by_name(const char* name)
 {
-  for (auto kv : simix_global->process_list)
+  for (auto const& kv : simix_global->process_list)
     if (kv.second->name == name)
       return kv.second;
   return nullptr;
index d8a0a0f..b26dcb7 100644 (file)
@@ -111,7 +111,14 @@ smx_activity_t simcall_execution_parallel_start(const char* name, int host_nb, s
  */
 void simcall_execution_cancel(smx_activity_t execution)
 {
-  simcall_BODY_execution_cancel(execution);
+  simgrid::simix::kernelImmediate([execution] {
+    XBT_DEBUG("Cancel synchro %p", execution.get());
+    simgrid::kernel::activity::ExecImplPtr exec =
+        boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
+
+    if (exec->surf_exec)
+      exec->surf_exec->cancel();
+  });
 }
 
 /**
@@ -126,8 +133,13 @@ void simcall_execution_set_priority(smx_activity_t execution, double priority)
 {
   /* checking for infinite values */
   xbt_assert(std::isfinite(priority), "priority is not finite!");
+  simgrid::simix::kernelImmediate([execution, priority] {
 
-  simcall_BODY_execution_set_priority(execution, priority);
+    simgrid::kernel::activity::ExecImplPtr exec =
+        boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
+    if (exec->surf_exec)
+      exec->surf_exec->setSharingWeight(priority);
+  });
 }
 
 /**
@@ -140,7 +152,12 @@ void simcall_execution_set_priority(smx_activity_t execution, double priority)
  */
 void simcall_execution_set_bound(smx_activity_t execution, double bound)
 {
-  simcall_BODY_execution_set_bound(execution, bound);
+  simgrid::simix::kernelImmediate([execution, bound] {
+    simgrid::kernel::activity::ExecImplPtr exec =
+        boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
+    if (exec->surf_exec)
+      static_cast<simgrid::surf::CpuAction*>(exec->surf_exec)->setBound(bound);
+  });
 }
 
 /**
index eb130f4..a101a80 100644 (file)
@@ -279,81 +279,6 @@ simcall_execution_parallel_start__set__result(smx_simcall_t simcall,
   simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>>(simcall->result, result);
 }
 
-static inline boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>
-simcall_execution_cancel__get__execution(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]);
-}
-static inline simgrid::kernel::activity::ActivityImpl*
-simcall_execution_cancel__getraw__execution(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<simgrid::kernel::activity::ActivityImpl*>(simcall->args[0]);
-}
-static inline void
-simcall_execution_cancel__set__execution(smx_simcall_t simcall,
-                                         boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> arg)
-{
-  simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0], arg);
-}
-
-static inline boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>
-simcall_execution_set_priority__get__execution(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]);
-}
-static inline simgrid::kernel::activity::ActivityImpl*
-simcall_execution_set_priority__getraw__execution(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<simgrid::kernel::activity::ActivityImpl*>(simcall->args[0]);
-}
-static inline void
-simcall_execution_set_priority__set__execution(smx_simcall_t simcall,
-                                               boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> arg)
-{
-  simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0], arg);
-}
-static inline double simcall_execution_set_priority__get__priority(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<double>(simcall->args[1]);
-}
-static inline double simcall_execution_set_priority__getraw__priority(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<double>(simcall->args[1]);
-}
-static inline void simcall_execution_set_priority__set__priority(smx_simcall_t simcall, double arg)
-{
-  simgrid::simix::marshal<double>(simcall->args[1], arg);
-}
-
-static inline boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>
-simcall_execution_set_bound__get__execution(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]);
-}
-static inline simgrid::kernel::activity::ActivityImpl*
-simcall_execution_set_bound__getraw__execution(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<simgrid::kernel::activity::ActivityImpl*>(simcall->args[0]);
-}
-static inline void
-simcall_execution_set_bound__set__execution(smx_simcall_t simcall,
-                                            boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> arg)
-{
-  simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0], arg);
-}
-static inline double simcall_execution_set_bound__get__bound(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<double>(simcall->args[1]);
-}
-static inline double simcall_execution_set_bound__getraw__bound(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<double>(simcall->args[1]);
-}
-static inline void simcall_execution_set_bound__set__bound(smx_simcall_t simcall, double arg)
-{
-  simgrid::simix::marshal<double>(simcall->args[1], arg);
-}
-
 static inline boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>
 simcall_execution_wait__get__execution(smx_simcall_t simcall)
 {
index 3a1bd5e..4f3e9a7 100644 (file)
@@ -87,35 +87,6 @@ inline static int simcall_BODY_process_sleep(double duration) {
                                             bytes_amount, rate, timeout);
   }
 
-  inline static void
-  simcall_BODY_execution_cancel(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution)
-  {
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_execution_cancel(execution);
-    return simcall<void, boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(SIMCALL_EXECUTION_CANCEL,
-                                                                                        execution);
-  }
-
-  inline static void
-  simcall_BODY_execution_set_priority(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution,
-                                      double priority)
-  {
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_execution_set_priority(execution, priority);
-    return simcall<void, boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, double>(
-        SIMCALL_EXECUTION_SET_PRIORITY, execution, priority);
-  }
-
-  inline static void
-  simcall_BODY_execution_set_bound(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution,
-                                   double bound)
-  {
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_execution_set_bound(execution, bound);
-    return simcall<void, boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, double>(
-        SIMCALL_EXECUTION_SET_BOUND, execution, bound);
-  }
-
   inline static int simcall_BODY_execution_wait(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution)
   {
     /* Go to that function to follow the code flow through the simcall barrier */
index a2f3155..8e44e97 100644 (file)
@@ -26,9 +26,6 @@ typedef enum {
   SIMCALL_PROCESS_SLEEP,
   SIMCALL_EXECUTION_START,
   SIMCALL_EXECUTION_PARALLEL_START,
-  SIMCALL_EXECUTION_CANCEL,
-  SIMCALL_EXECUTION_SET_PRIORITY,
-  SIMCALL_EXECUTION_SET_BOUND,
   SIMCALL_EXECUTION_WAIT,
   SIMCALL_PROCESS_ON_EXIT,
   SIMCALL_COMM_IPROBE,
index e52c41f..7f4fc93 100644 (file)
@@ -32,9 +32,6 @@ const char* simcall_names[] = {
     "SIMCALL_PROCESS_SLEEP",
     "SIMCALL_EXECUTION_START",
     "SIMCALL_EXECUTION_PARALLEL_START",
-    "SIMCALL_EXECUTION_CANCEL",
-    "SIMCALL_EXECUTION_SET_PRIORITY",
-    "SIMCALL_EXECUTION_SET_BOUND",
     "SIMCALL_EXECUTION_WAIT",
     "SIMCALL_PROCESS_ON_EXIT",
     "SIMCALL_COMM_IPROBE",
@@ -118,26 +115,6 @@ case SIMCALL_EXECUTION_PARALLEL_START:
   SIMIX_simcall_answer(simcall);
   break;
 
-case SIMCALL_EXECUTION_CANCEL:
-  SIMIX_execution_cancel(
-      simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]));
-  SIMIX_simcall_answer(simcall);
-  break;
-
-case SIMCALL_EXECUTION_SET_PRIORITY:
-  SIMIX_execution_set_priority(
-      simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]),
-      simgrid::simix::unmarshal<double>(simcall->args[1]));
-  SIMIX_simcall_answer(simcall);
-  break;
-
-case SIMCALL_EXECUTION_SET_BOUND:
-  SIMIX_execution_set_bound(
-      simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]),
-      simgrid::simix::unmarshal<double>(simcall->args[1]));
-  SIMIX_simcall_answer(simcall);
-  break;
-
 case SIMCALL_EXECUTION_WAIT:
   simcall_HANDLER_execution_wait(
       simcall,
index c13413f..8397063 100644 (file)
@@ -43,9 +43,6 @@ int  process_sleep(double duration) [[block]];
 
 boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> execution_start(const char* name, double flops_amount, double priority, double bound);
 boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double rate, double timeout) [[nohandler]];
-void          execution_cancel(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution) [[nohandler]];
-void          execution_set_priority(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution, double priority) [[nohandler]];
-void          execution_set_bound(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution, double bound) [[nohandler]];
 int           execution_wait(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution) [[block]];
 
 void          process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void* data) [[nohandler]];
index 0e69735..1babc15 100644 (file)
@@ -338,7 +338,7 @@ static void SIMIX_wake_processes()
 {
   surf_action_t action;
 
-  for(auto model : *all_existing_models) {
+  for (auto const& model : *all_existing_models) {
     XBT_DEBUG("Handling the processes whose action failed (if any)");
     while ((action = surf_model_extract_failed_action_set(model))) {
       XBT_DEBUG("   Handling Action %p",action);
@@ -480,7 +480,7 @@ void SIMIX_run()
        *   That would thus be a pure waste of time.
        */
 
-      for (smx_actor_t process : simix_global->process_that_ran) {
+      for (smx_actor_t const& process : simix_global->process_that_ran) {
         if (process->simcall.call != SIMCALL_NONE) {
           SIMIX_simcall_handle(&process->simcall, 0);
         }
@@ -493,7 +493,7 @@ void SIMIX_run()
 
       /* If only daemon processes remain, cancel their actions, mark them to die and reschedule them */
       if (simix_global->process_list.size() == simix_global->daemons.size())
-        for (const auto& dmon : simix_global->daemons) {
+        for (auto const& dmon : simix_global->daemons) {
           XBT_DEBUG("Kill %s", dmon->cname());
           SIMIX_process_kill(dmon, simix_global->maestro_process);
         }
@@ -520,7 +520,7 @@ void SIMIX_run()
     } while (again);
 
     /* Autorestart all process */
-    for (auto host: host_that_restart) {
+    for (auto const& host : host_that_restart) {
       XBT_INFO("Restart processes on host %s", host->getCname());
       SIMIX_host_autorestart(host);
     }
@@ -627,7 +627,7 @@ void SIMIX_display_process_status()
   XBT_INFO("%d processes are still running, waiting for something.", nbprocess);
   /*  List the process and their state */
   XBT_INFO("Legend of the following listing: \"Process <pid> (<name>@<host>): <status>\"");
-  for (auto kv : simix_global->process_list) {
+  for (auto const& kv : simix_global->process_list) {
     smx_actor_t process = kv.second;
 
     if (process->waiting_synchro) {
index ed75d52..d89dd0d 100644 (file)
@@ -38,10 +38,10 @@ namespace simgrid {
         SIMIX_display_process_status();
         THROWF(arg_error, 0, "%s", msg.c_str());
       }
-      for (auto arg : auto_restart_processes)
+      for (auto const& arg : auto_restart_processes)
         delete arg;
       auto_restart_processes.clear();
-      for (auto arg : boot_processes)
+      for (auto const& arg : boot_processes)
         delete arg;
       boot_processes.clear();
       xbt_swag_free(process_list);
@@ -53,7 +53,7 @@ namespace simgrid {
      */
     void Host::turnOn()
     {
-      for (auto arg : boot_processes) {
+      for (auto const& arg : boot_processes) {
         XBT_DEBUG("Booting Process %s(%s) right now", arg->name.c_str(), arg->host->getCname());
         smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host,
                                                                   arg->properties, nullptr);
@@ -137,7 +137,7 @@ void SIMIX_host_autorestart(sg_host_t host)
   std::vector<simgrid::simix::ProcessArg*> process_list =
       host->extension<simgrid::simix::Host>()->auto_restart_processes;
 
-  for (auto arg : process_list) {
+  for (auto const& arg : process_list) {
     XBT_DEBUG("Restarting Process %s@%s right now", arg->name.c_str(), arg->host->getCname());
     smx_actor_t actor = simix_global->create_process_function(arg->name.c_str(), arg->code, nullptr, arg->host,
                                                               arg->properties, nullptr);
@@ -216,32 +216,6 @@ SIMIX_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_li
   return exec;
 }
 
-void SIMIX_execution_cancel(smx_activity_t synchro)
-{
-  XBT_DEBUG("Cancel synchro %p", synchro.get());
-  simgrid::kernel::activity::ExecImplPtr exec =
-      boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(synchro);
-
-  if (exec->surf_exec)
-    exec->surf_exec->cancel();
-}
-
-void SIMIX_execution_set_priority(smx_activity_t synchro, double priority)
-{
-  simgrid::kernel::activity::ExecImplPtr exec =
-      boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(synchro);
-  if(exec->surf_exec)
-    exec->surf_exec->setSharingWeight(priority);
-}
-
-void SIMIX_execution_set_bound(smx_activity_t synchro, double bound)
-{
-  simgrid::kernel::activity::ExecImplPtr exec =
-      boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(synchro);
-  if(exec->surf_exec)
-    static_cast<simgrid::surf::CpuAction*>(exec->surf_exec)->setBound(bound);
-}
-
 void simcall_HANDLER_execution_wait(smx_simcall_t simcall, smx_activity_t synchro)
 {
   simgrid::kernel::activity::ExecImplPtr exec =
@@ -266,7 +240,7 @@ void simcall_HANDLER_execution_wait(smx_simcall_t simcall, smx_activity_t synchr
 
 void SIMIX_execution_finish(simgrid::kernel::activity::ExecImplPtr exec)
 {
-  for (smx_simcall_t simcall : exec->simcalls) {
+  for (smx_simcall_t const& simcall : exec->simcalls) {
     switch (exec->state) {
 
       case SIMIX_DONE:
index b7028b9..d9a6b57 100644 (file)
@@ -45,9 +45,6 @@ XBT_PRIVATE void SIMIX_host_add_auto_restart_process(sg_host_t host, const char*
                                                      std::map<std::string, std::string>* properties, int auto_restart);
 
 XBT_PRIVATE void SIMIX_host_autorestart(sg_host_t host);
-XBT_PRIVATE void SIMIX_execution_cancel(smx_activity_t synchro);
-XBT_PRIVATE void SIMIX_execution_set_priority(smx_activity_t synchro, double priority);
-XBT_PRIVATE void SIMIX_execution_set_bound(smx_activity_t synchro, double bound);
 
 XBT_PRIVATE void SIMIX_execution_finish(simgrid::kernel::activity::ExecImplPtr exec);
 
index 9361f1d..1493988 100644 (file)
@@ -68,7 +68,7 @@ void SIMIX_io_destroy(smx_activity_t synchro)
 
 void SIMIX_io_finish(smx_activity_t synchro)
 {
-  for (smx_simcall_t simcall : synchro->simcalls) {
+  for (smx_simcall_t const& simcall : synchro->simcalls) {
     switch (synchro->state) {
       case SIMIX_DONE:
         /* do nothing, synchro done */
index 2812182..61eccb2 100644 (file)
 #include "smpi/smpi.h"
 #include "smpi_f2c.hpp"
 #include <string>
-#include <unordered_map>
+#include <map>
 
 namespace simgrid{
 namespace smpi{
 
 class Info : public F2C{
   private:
-    std::unordered_map<std::string, std::string> map_;
+    std::map<std::string, std::string> map_;
     int refcount_ = 1;
 
   public:
index 986540f..c0ee395 100644 (file)
@@ -140,7 +140,7 @@ template <typename T> int Keyval::attr_put(int keyval, void* attr_value){
 template <typename T> void Keyval::cleanup_attr(){
   if (not attributes()->empty()) {
     int flag=0;
-    for(auto it : attributes_){
+    for (auto const& it : attributes_) {
       auto elm = T::keyvals_.find(it.first);
       if (elm != T::keyvals_.end()) {
         smpi_key_elem elem = elm->second;
index 6f71391..2fe8025 100644 (file)
@@ -25,7 +25,7 @@ double SmpiHost::orecv(size_t size)
   // Iterate over all the sections that were specified and find the right value. (fact.factor represents the interval
   // sizes; we want to find the section that has fact.factor <= size and no other such fact.factor <= size)
   // Note: parse_factor() (used before) already sorts the vector we iterate over!
-  for (auto fact : orecv_parsed_values) {
+  for (auto const& fact : orecv_parsed_values) {
     if (size <= fact.factor) { // Values already too large, use the previously computed value of current!
       XBT_DEBUG("or : %zu <= %zu return %.10f", size, fact.factor, current);
       return current;
@@ -48,7 +48,7 @@ double SmpiHost::osend(size_t size)
   // value. (fact.factor represents the interval sizes; we want to find the
   // section that has fact.factor <= size and no other such fact.factor <= size)
   // Note: parse_factor() (used before) already sorts the vector we iterate over!
-  for (auto& fact : osend_parsed_values) {
+  for (auto const& fact : osend_parsed_values) {
     if (size <= fact.factor) { // Values already too large, use the previously computed value of current!
       XBT_DEBUG("os : %zu <= %zu return %.10f", size, fact.factor, current);
       return current;
@@ -71,7 +71,7 @@ double SmpiHost::oisend(size_t size)
   // Iterate over all the sections that were specified and find the right value. (fact.factor represents the interval
   // sizes; we want to find the section that has fact.factor <= size and no other such fact.factor <= size)
   // Note: parse_factor() (used before) already sorts the vector we iterate over!
-  for (auto& fact : oisend_parsed_values) {
+  for (auto const& fact : oisend_parsed_values) {
     if (size <= fact.factor) { // Values already too large, use the previously  computed value of current!
       XBT_DEBUG("ois : %zu <= %zu return %.10f", size, fact.factor, current);
       return current;
index 522a228..38e3158 100644 (file)
@@ -176,7 +176,7 @@ void TRACE_smpi_alloc()
 
 void TRACE_smpi_release()
 {
-  for (auto elm : keys)
+  for (auto const& elm : keys)
     delete elm.second;
 }
 
@@ -203,7 +203,7 @@ void TRACE_smpi_init(int rank)
 #if HAVE_PAPI
   papi_counter_t counters = smpi_process()->papi_counters();
 
-  for (auto& it : counters) {
+  for (auto const& it : counters) {
     /**
      * Check whether this variable already exists or not. Otherwise, it will be created
      * multiple times but only the last one would be used...
index 8e17376..1074307 100644 (file)
@@ -165,7 +165,7 @@ void smpi_bench_end()
     container_t container        = PJ_container_get(container_name);
     papi_counter_t& counter_data = smpi_process()->papi_counters();
 
-    for (auto& pair : counter_data) {
+    for (auto const& pair : counter_data) {
       new_pajeSetVariable(surf_get_clock(), container,
                           PJ_type_get(/* countername */ pair.first.c_str(), container->type), pair.second);
     }
@@ -432,6 +432,6 @@ void smpi_trace_set_call_location__(const char* file, int* line)
 
 void smpi_bench_destroy()
 {
-  for (auto elm : samples)
+  for (auto const& elm : samples)
     xbt_free(elm.second);
 }
index 3d88598..78a95fd 100644 (file)
@@ -61,7 +61,7 @@ void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_
   static int already_called = 0;
   if (not already_called) {
     already_called = 1;
-    for (auto& item : simgrid::s4u::host_list) {
+    for (auto const& item : simgrid::s4u::host_list) {
       simgrid::s4u::Host* host = item.second;
       host->extension_set(new simgrid::smpi::SmpiHost(host));
     }
@@ -113,7 +113,7 @@ msg_bar_t smpi_deployment_finalization_barrier(const char* instance_id)
 }
 
 void smpi_deployment_cleanup_instances(){
-  for (auto& item : smpi_instances) {
+  for (auto const& item : smpi_instances) {
     Instance instance = item.second;
     if (instance.comm_world != MPI_COMM_NULL)
       delete instance.comm_world->group();
index f1226a2..aa46baa 100644 (file)
@@ -125,19 +125,19 @@ void smpi_comm_set_copy_data_callback(void (*callback) (smx_activity_t, void*, s
 
 static void print(std::vector<std::pair<size_t, size_t>> vec) {
   std::fprintf(stderr, "{");
-  for (auto elt : vec) {
+  for (auto const& elt : vec) {
     std::fprintf(stderr, "(0x%zx, 0x%zx),", elt.first, elt.second);
   }
   std::fprintf(stderr, "}\n");
 }
 static void memcpy_private(void* dest, const void* src, std::vector<std::pair<size_t, size_t>>& private_blocks)
 {
-  for (auto block : private_blocks)
+  for (auto const& block : private_blocks)
     memcpy((uint8_t*)dest+block.first, (uint8_t*)src+block.first, block.second-block.first);
 }
 
 static void check_blocks(std::vector<std::pair<size_t, size_t>> &private_blocks, size_t buff_size) {
-  for (auto block : private_blocks)
+  for (auto const& block : private_blocks)
     xbt_assert(block.first <= block.second && block.second <= buff_size, "Oops, bug in shared malloc.");
 }
 
@@ -282,7 +282,7 @@ void smpi_global_init()
 
     // Iterate over all the computational units. This could be processes, hosts, threads, ranks... You name it.
     // I'm not exactly sure what we will support eventually, so I'll leave it at the general term "units".
-    for (auto& unit_it : tokens) {
+    for (auto const& unit_it : tokens) {
       boost::char_separator<char> separator_events(":");
       Tokenizer event_tokens(unit_it, separator_events);
 
index 77162fa..90cac5b 100644 (file)
@@ -430,7 +430,7 @@ static void action_waitall(const char *const *action){
    int recvs_snd[count_requests];
    int recvs_rcv[count_requests];
    unsigned int i=0;
-   for (auto req : *(get_reqq_self())){
+   for (auto const& req : *(get_reqq_self())) {
      if (req && (req->flags () & RECV)){
        recvs_snd[i]=req->src();
        recvs_rcv[i]=req->dst();
@@ -970,7 +970,7 @@ void smpi_replay_main(int* argc, char*** argv)
     MPI_Status status[count_requests];
     unsigned int i=0;
 
-    for (auto req: *get_reqq_self()){
+    for (auto const& req : *get_reqq_self()) {
       requests[i] = req;
       i++;
     }
index 27bd066..f8c5f8b 100644 (file)
@@ -388,7 +388,7 @@ int smpi_is_shared(void* ptr, std::vector<std::pair<size_t, size_t>> &private_bl
     return 0;
   if ( smpi_cfg_shared_malloc == shmalloc_local || smpi_cfg_shared_malloc == shmalloc_global) {
     auto low = allocs_metadata.lower_bound(ptr);
-    if (low->first==ptr) {
+    if (low != allocs_metadata.end() && low->first == ptr) {
       private_blocks = low->second.private_blocks;
       *offset = 0;
       return 1;
@@ -410,11 +410,11 @@ int smpi_is_shared(void* ptr, std::vector<std::pair<size_t, size_t>> &private_bl
 
 std::vector<std::pair<size_t, size_t>> shift_and_frame_private_blocks(const std::vector<std::pair<size_t, size_t>> vec, size_t offset, size_t buff_size) {
     std::vector<std::pair<size_t, size_t>> result;
-    for(auto block: vec) {
-        auto new_block = std::make_pair(std::min(std::max((size_t)0, block.first-offset), buff_size),
-                                        std::min(std::max((size_t)0, block.second-offset), buff_size));
-        if(new_block.second > 0 && new_block.first < buff_size)
-            result.push_back(new_block);
+    for (auto const& block : vec) {
+      auto new_block = std::make_pair(std::min(std::max((size_t)0, block.first - offset), buff_size),
+                                      std::min(std::max((size_t)0, block.second - offset), buff_size));
+      if (new_block.second > 0 && new_block.first < buff_size)
+        result.push_back(new_block);
     }
     return result;
 }
index 7951ecf..0a043ae 100644 (file)
@@ -64,7 +64,7 @@ std::vector<s_smpi_factor_t> parse_factor(const char *smpi_coef_string)
   std::sort(smpi_factor.begin(), smpi_factor.end(), [](const s_smpi_factor_t &pa, const s_smpi_factor_t &pb) {
     return (pa.factor < pb.factor);
   });
-  for (auto& fact : smpi_factor) {
+  for (auto const& fact : smpi_factor) {
     XBT_DEBUG("smpi_factor:\t%zu : %zu values, first: %f", fact.factor, smpi_factor.size() ,fact.values[0]);
   }
   smpi_factor.shrink_to_fit();
index 051be8c..e70e205 100644 (file)
@@ -65,7 +65,7 @@ int Comm::dup(MPI_Comm* newcomm){
   if (not attributes()->empty()) {
     int flag;
     void* value_out;
-    for(auto it : *attributes()){
+    for (auto const& it : *attributes()) {
       smpi_key_elem elem = keyvals_.at(it.first);
       if (elem != nullptr && elem->copy_fn.comm_copy_fn != MPI_NULL_COPY_FN) {
         ret = elem->copy_fn.comm_copy_fn(this, it.first, nullptr, it.second, &value_out, &flag);
@@ -222,7 +222,7 @@ MPI_Comm Comm::split(int color, int key)
         }
         MPI_Request* requests = xbt_new(MPI_Request, rankmap.size());
         int reqs              = 0;
-        for (const auto& rank : rankmap) {
+        for (auto const& rank : rankmap) {
           if (rank.second != 0) {
             group_snd[reqs]=new  Group(group_out);
             requests[reqs] = Request::isend(&(group_snd[reqs]), 1, MPI_PTR, rank.second, system_tag, this);
@@ -484,7 +484,7 @@ void Comm::remove_rma_win(MPI_Win win){
 }
 
 void Comm::finish_rma_calls(){
-  for(auto it : rma_wins_){
+  for (auto const& it : rma_wins_) {
     if(it->rank()==this->rank()){//is it ours (for MPI_COMM_WORLD)?
       int finished = it->finish_comms();
       XBT_DEBUG("Barrier for rank %d - Finished %d RMA calls",this->rank(), finished);
index 532f3e4..4a31be6 100644 (file)
@@ -75,7 +75,7 @@ int F2C::c2f()
     f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
   }
 
-  for (auto elm : *f2c_lookup_)
+  for (auto const& elm : *f2c_lookup_)
     if (elm.second == this)
       return std::stoi(elm.first);
 
index 2320768..580d0d6 100644 (file)
@@ -39,7 +39,7 @@ Group::Group(MPI_Group origin)
       rank_to_index_map_[i] = origin->rank_to_index_map_[i];
     }
 
-    for (auto elm : origin->index_to_rank_map_) {
+    for (auto const& elm : origin->index_to_rank_map_) {
       index_to_rank_map_.insert({elm.first, elm.second});
     }
   }
index 3698e30..160892e 100644 (file)
@@ -60,7 +60,7 @@ int Info::get_nkeys(int *nkeys){
 
 int Info::get_nthkey(int n, char *key){
   int num=0;
-  for (auto elm : map_) {
+  for (auto const& elm : map_) {
     if (num == n) {
       strncpy(key, elm.first.c_str(), elm.first.length() + 1);
       return MPI_SUCCESS;
index 0edf528..4f57f6d 100644 (file)
@@ -862,7 +862,7 @@ int Request::waitall(int count, MPI_Request requests[], MPI_Status status[])
 
   if (not accumulates.empty()) {
     std::sort(accumulates.begin(), accumulates.end(), sort_accumulates);
-    for (auto req : accumulates) {
+    for (auto& req : accumulates) {
       finish_wait(&req, status);
     }
   }
index f2782d1..f976108 100644 (file)
@@ -195,7 +195,7 @@ int Win::put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : recv_win->lockers_)
+    for (auto const& it : recv_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
@@ -252,7 +252,7 @@ int Win::get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : send_win->lockers_)
+    for (auto const& it : send_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
@@ -314,7 +314,7 @@ int Win::accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : recv_win->lockers_)
+    for (auto const& it : recv_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
@@ -368,7 +368,7 @@ int Win::get_accumulate( void *origin_addr, int origin_count, MPI_Datatype origi
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : send_win->lockers_)
+    for (auto const& it : send_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
@@ -405,7 +405,7 @@ int Win::compare_and_swap(void *origin_addr, void *compare_addr,
   if(opened_==0){//check that post/start has been done
     // no fence or start .. lock ok ?
     int locked=0;
-    for(auto it : send_win->lockers_)
+    for (auto const& it : send_win->lockers_)
       if (it == comm_->rank())
         locked = 1;
     if(locked != 1)
index 6d88f27..f3530f5 100644 (file)
@@ -29,7 +29,7 @@ namespace surf {
 void HostModel::ignoreEmptyVmInPmLMM()
 {
   /* iterate for all virtual machines */
-  for (s4u::VirtualMachine* ws_vm : vm::VirtualMachineImpl::allVms_) {
+  for (s4u::VirtualMachine* const& ws_vm : vm::VirtualMachineImpl::allVms_) {
     Cpu* cpu = ws_vm->pimpl_cpu;
     int active_tasks = lmm_constraint_get_variable_amount(cpu->constraint());
 
@@ -102,7 +102,7 @@ HostImpl::HostImpl(s4u::Host* host) : piface_(host)
 
 void HostImpl::getAttachedStorageList(std::vector<const char*>* storages)
 {
-  for (auto s : storage_)
+  for (auto const& s : storage_)
     if (s.second->getHost() == piface_->getCname())
       storages->push_back(s.second->piface_.getName());
 }
index caf30b7..e8282cb 100644 (file)
@@ -110,7 +110,7 @@ Cpu::Cpu(Model* model, simgrid::s4u::Host* host, lmm_constraint_t constraint, st
   xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->getCname());
 
   // Copy the power peak array:
-  for (double value : *speedPerPstate) {
+  for (double const& value : *speedPerPstate) {
     speedPerPstate_.push_back(value);
   }
 }
index dd6c06f..5366483 100644 (file)
@@ -34,7 +34,7 @@ CpuTiTrace::CpuTiTrace(tmgr_trace_t speedTrace)
   nbPoints_ = speedTrace->event_list.size() + 1;
   timePoints_ = new double[nbPoints_];
   integral_ =  new double[nbPoints_];
-  for (auto val : speedTrace->event_list) {
+  for (auto const& val : speedTrace->event_list) {
     timePoints_[i] = time;
     integral_[i] = integral;
     integral += val.date_ * val.value_;
@@ -273,7 +273,7 @@ CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) :
   type_ = TRACE_DYNAMIC;
 
   /* count the total time of trace file */
-  for (auto val : speedTrace->event_list)
+  for (auto const& val : speedTrace->event_list)
     total_time += val.date_;
 
   trace_ = new CpuTiTrace(speedTrace);
index 6fe981c..d320711 100644 (file)
@@ -135,7 +135,7 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t
   XBT_DEBUG("Graph extraction for NetZone = %s", netzone->getCname());
   if (not netzone->getChildren()->empty()) {
     //bottom-up recursion
-    for (auto nz_son : *netzone->getChildren()) {
+    for (auto const& nz_son : *netzone->getChildren()) {
       container_t child_container = static_cast<container_t>(xbt_dict_get(container->children, nz_son->getCname()));
       recursiveGraphExtraction(nz_son, child_container, filter);
     }
@@ -430,7 +430,7 @@ static void recursiveXBTGraphExtraction(xbt_graph_t graph, xbt_dict_t nodes, xbt
 {
   if (not netzone->getChildren()->empty()) {
     //bottom-up recursion
-    for (auto netzone_child : *netzone->getChildren()) {
+    for (auto const& netzone_child : *netzone->getChildren()) {
       container_t child_container =
           static_cast<container_t>(xbt_dict_get(container->children, netzone_child->getCname()));
       recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);
index 54418ed..30e3b08 100644 (file)
@@ -279,14 +279,14 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
              "You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
              src->getCname(), dst->getCname());
 
-  for (auto link: *route)
+  for (auto const& link : *route)
     if (link->isOff())
       failed = 1;
 
   if (sg_network_crosstraffic == 1) {
     back_route = new std::vector<LinkImpl*>();
     dst->routeTo(src, back_route, nullptr);
-    for (auto link: *back_route)
+    for (auto const& link : *back_route)
       if (link->isOff())
         failed = 1;
   }
@@ -302,10 +302,10 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
 
   double bandwidth_bound = -1.0;
   if (sg_weight_S_parameter > 0)
-    for (auto link : *route)
+    for (auto const& link : *route)
       action->weight_ += sg_weight_S_parameter / link->bandwidth();
 
-  for (auto link : *route) {
+  for (auto const& link : *route) {
     double bb       = bandwidthFactor(size) * link->bandwidth();
     bandwidth_bound = (bandwidth_bound < 0.0) ? bb : std::min(bandwidth_bound, bb);
   }
@@ -334,12 +334,12 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
     lmm_update_variable_bound(maxminSystem_, action->getVariable(), (action->latCurrent_ > 0) ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)) : action->rate_);
   }
 
-  for (auto link: *route)
+  for (auto const& link : *route)
     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)
+    for (auto const& link : *back_route)
       lmm_expand(maxminSystem_, link->constraint(), action->getVariable(), .05);
 
     //Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
index 7756239..7d7c324 100644 (file)
@@ -132,7 +132,7 @@ NetworkIBModel::NetworkIBModel() : NetworkSmpiModel()
 
 NetworkIBModel::~NetworkIBModel()
 {
-  for (auto instance : active_nodes)
+  for (auto const& instance : active_nodes)
     delete instance.second;
 }
 
index 668f4ed..d6f78f7 100644 (file)
@@ -35,7 +35,7 @@ namespace simgrid {
   {
     LinkImpl** res = xbt_new(LinkImpl*, (int)links->size());
     int i          = 0;
-    for (auto kv : *links) {
+    for (auto const& kv : *links) {
       res[i] = kv.second;
       i++;
     }
@@ -44,7 +44,7 @@ namespace simgrid {
   /** @brief destructor of the static data */
   void LinkImpl::linksExit()
   {
-    for (auto kv : *links)
+    for (auto const& kv : *links)
       (kv.second)->destroy();
     delete links;
   }
index 34631b5..1374317 100644 (file)
@@ -56,7 +56,7 @@ NetPointNs3::NetPointNs3()
 
 static void clusterCreation_cb(ClusterCreationArgs* cluster)
 {
-  for (int i : *cluster->radicals) {
+  for (int const& i : *cluster->radicals) {
     // Routers don't create a router on the other end of the private link by themselves.
     // We just need this router to be given an ID so we create a temporary NetPointNS3 so that it gets one
     NetPointNs3* host_dst = new NetPointNs3();
@@ -143,6 +143,7 @@ namespace surf {
 NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
   NetPointNs3::EXTENSION_ID = simgrid::kernel::routing::NetPoint::extension_create<NetPointNs3>();
 
+  flowFromSock = xbt_dict_new_homogeneous([](void* p) { delete (SgFlow*)p; });
   ns3_initialize(ns3_tcp_model.get().c_str());
 
   simgrid::kernel::routing::NetPoint::onCreation.connect([](simgrid::kernel::routing::NetPoint* pt) {
@@ -159,7 +160,7 @@ NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
 }
 
 NetworkNS3Model::~NetworkNS3Model() {
-  for (auto addr : IPV4addr)
+  for (auto const& addr : IPV4addr)
     free(addr);
   IPV4addr.clear();
   xbt_dict_free(&flowFromSock);
@@ -226,7 +227,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
       std::vector<LinkImpl*> route = std::vector<LinkImpl*>();
 
       action->src_->routeTo(action->dst_, &route, nullptr);
-      for (auto link : route)
+      for (auto const& link : route)
         TRACE_surf_link_set_utilization(link->cname(), action->getCategory(), (data_delta_sent) / delta, now - delta,
                                         delta);
 
index d7ff3ce..196d193 100644 (file)
@@ -22,7 +22,7 @@ public:
                        e_surf_link_sharing_policy_t policy) override;
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   double nextOccuringEvent(double now) override;
-  bool nextOccuringEventIsIdempotent() {return false;}
+  bool nextOccuringEventIsIdempotent() override { return false; }
   void updateActionsState(double now, double delta) override;
 };
 
@@ -48,7 +48,7 @@ class XBT_PRIVATE NetworkNS3Action : public NetworkAction {
 public:
   NetworkNS3Action(Model* model, double cost, s4u::Host* src, s4u::Host* dst);
 
-  bool isSuspended();
+  bool isSuspended() override;
   int unref() override;
   void suspend() override;
   void resume() override;
index b559d23..9c6f389 100644 (file)
@@ -58,7 +58,7 @@ double NetworkSmpiModel::bandwidthFactor(double size)
     smpi_bw_factor = parse_factor(xbt_cfg_get_string("smpi/bw-factor"));
 
   double current = 1.0;
-  for (const auto& fact : smpi_bw_factor) {
+  for (auto const& fact : smpi_bw_factor) {
     if (size <= fact.factor) {
       XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
       return current;
@@ -76,7 +76,7 @@ double NetworkSmpiModel::latencyFactor(double size)
     smpi_lat_factor = parse_factor(xbt_cfg_get_string("smpi/lat-factor"));
 
   double current = 1.0;
-  for (const auto& fact : smpi_lat_factor) {
+  for (auto const& fact : smpi_lat_factor) {
     if (size <= fact.factor) {
       XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
       return current;
index e675094..55df59e 100644 (file)
@@ -10,9 +10,7 @@
 
 #include <algorithm>
 
-xbt_dict_t flowFromSock = xbt_dict_new_homogeneous([](void *p) {
-  delete (SgFlow*)p;
-}); // ns3::sock -> SgFlow
+xbt_dict_t flowFromSock = nullptr; // ns3::sock -> SgFlow
 
 static void receive_callback(ns3::Ptr<ns3::Socket> socket);
 static void datasent_callback(ns3::Ptr<ns3::Socket> socket, uint32_t dataSent);
index 97befbd..6e102e4 100644 (file)
@@ -310,7 +310,7 @@ void HostEnergy::initWattsRangeList()
   XBT_DEBUG("%s: profile: %s, cores: %d", host->getCname(), all_power_values_str, host->getCoreCount());
 
   int i = 0;
-  for (auto current_power_values_str : all_power_values) {
+  for (auto const& current_power_values_str : all_power_values) {
     /* retrieve the power values associated with the current pstate */
     std::vector<std::string> current_power_values;
     boost::split(current_power_values, current_power_values_str, boost::is_any_of(":"));
@@ -370,7 +370,7 @@ static void onCreation(simgrid::s4u::Host& host)
 
 static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::surf::Action::State previous)
 {
-  for (simgrid::surf::Cpu* cpu : action->cpus()) {
+  for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
     simgrid::s4u::Host* host = cpu->getHost();
     if (host != nullptr) {
 
@@ -464,7 +464,7 @@ void sg_host_energy_update_all()
   simgrid::simix::kernelImmediate([]() {
     std::vector<simgrid::s4u::Host*> list;
     simgrid::s4u::Engine::getInstance()->getHostList(&list);
-    for (auto host : list)
+    for (auto const& host : list)
       if (dynamic_cast<simgrid::s4u::VirtualMachine*>(host) == nullptr) // Ignore virtual machines
         host->extension<HostEnergy>()->update();
   });
index 71ccf35..99e7a39 100644 (file)
@@ -127,7 +127,7 @@ static void onHostChange(simgrid::s4u::Host& host)
 /* This callback is called when an action (computation, idle, ...) terminates */
 static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::surf::Action::State previous)
 {
-  for (simgrid::surf::Cpu* cpu : action->cpus()) {
+  for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
     simgrid::s4u::Host* host = cpu->getHost();
 
     if (host != nullptr) {
index 24129d9..0ee2f30 100644 (file)
@@ -187,7 +187,7 @@ L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
           hostList_->at(i)->routeTo(hostList_->at(j), &route, &lat);
           latency = MAX(latency, lat);
 
-          for (auto link : route)
+          for (auto const& link : route)
             affected_links.insert(link->cname());
         }
       }
@@ -216,7 +216,7 @@ L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
           std::vector<LinkImpl*> route;
           hostList_->at(i)->routeTo(hostList_->at(j), &route, nullptr);
 
-          for (auto link : route)
+          for (auto const& link : route)
             lmm_expand_add(model->getMaxminSystem(), link->constraint(), this->getVariable(),
                            bytes_amount[i * host_nb + j]);
         }
index 474ef71..219c193 100644 (file)
@@ -76,7 +76,7 @@ void sg_platf_new_host(sg_platf_host_cbarg_t args)
 {
   std::map<std::string, std::string> props;
   if (args->properties) {
-    for (auto elm : *args->properties)
+    for (auto const& elm : *args->properties)
       props.insert({elm.first, elm.second});
     delete args->properties;
   }
@@ -129,12 +129,12 @@ void sg_platf_new_link(LinkCreationArgs* link)
   } else {
     names.push_back(link->id);
   }
-  for (auto link_name : names) {
+  for (auto const& link_name : names) {
     simgrid::surf::LinkImpl* l =
         surf_network_model->createLink(link_name.c_str(), link->bandwidth, link->latency, link->policy);
 
     if (link->properties) {
-      for (auto elm : *link->properties)
+      for (auto const& elm : *link->properties)
         l->setProperty(elm.first, elm.second);
       delete link->properties;
     }
@@ -188,7 +188,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
     current_as->hasLimiter_ = 1;
   }
 
-  for (int i : *cluster->radicals) {
+  for (int const& i : *cluster->radicals) {
     std::string host_id = std::string(cluster->prefix) + std::to_string(i) + cluster->suffix;
     std::string link_id = std::string(cluster->id) + "_link_" + std::to_string(i);
 
@@ -200,7 +200,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
     if ((cluster->properties != nullptr) && (not cluster->properties->empty())) {
       host.properties = new std::map<std::string, std::string>;
 
-      for (auto elm : *cluster->properties)
+      for (auto const& elm : *cluster->properties)
         host.properties->insert({elm.first, elm.second});
     }
 
@@ -315,7 +315,7 @@ void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb)
 
 void sg_platf_new_cabinet(CabinetCreationArgs* cabinet)
 {
-  for (int radical : *cabinet->radicals) {
+  for (int const& radical : *cabinet->radicals) {
     std::string hostname = cabinet->prefix + std::to_string(radical) + cabinet->suffix;
     s_sg_platf_host_cbarg_t host;
     memset(&host, 0, sizeof(host));
@@ -375,7 +375,7 @@ void sg_platf_new_storage(StorageCreationArgs* storage)
   auto s = surf_storage_model->createStorage(storage->id, stype->id, storage->content, storage->attach);
 
   if (storage->properties) {
-    for (auto elm : *storage->properties)
+    for (auto const& elm : *storage->properties)
       s->setProperty(elm.first, elm.second);
     delete storage->properties;
   }
@@ -425,7 +425,7 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process)
     // The requested host does not exist. Do a nice message to the user
     std::string msg = std::string("Cannot create process '") + process->function + "': host '" + process->host +
                       "' does not exist\nExisting hosts: '";
-    for (auto kv : simgrid::s4u::host_list) {
+    for (auto const& kv : simgrid::s4u::host_list) {
       simgrid::s4u::Host* host = kv.second;
       msg += host->getName();
       msg += "', '";
index f026497..a27852b 100644 (file)
@@ -17,7 +17,7 @@ extern std::map<std::string, simgrid::surf::StorageType*> storage_types;
 
 static void check_disk_attachment()
 {
-  for (auto s : *simgrid::surf::StorageImpl::storagesMap()) {
+  for (auto const& s : *simgrid::surf::StorageImpl::storagesMap()) {
     simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(s.second->getHost().c_str());
     if (not host_elm)
       surf_parse_error(std::string("Unable to attach storage ") + s.second->cname() + ": host " + s.second->getHost() +
index d459a4d..61e00b9 100644 (file)
@@ -34,8 +34,8 @@ void surf_presolve()
   }
 
   XBT_DEBUG ("Set every models in the right state by updating them to 0.");
-  for (auto model : *all_existing_models)
-      model->updateActionsState(NOW, 0.0);
+  for (auto const& model : *all_existing_models)
+    model->updateActionsState(NOW, 0.0);
 }
 
 double surf_solve(double max_date)
@@ -129,7 +129,7 @@ double surf_solve(double max_date)
   NOW = NOW + time_delta;
 
   // Inform the models of the date change
-  for (auto model : *all_existing_models) {
+  for (auto const& model : *all_existing_models) {
     model->updateActionsState(NOW, time_delta);
   }
   simgrid::s4u::onTimeAdvance(time_delta);
index 39c8b9d..9275ffe 100644 (file)
@@ -137,7 +137,7 @@ std::ifstream* surf_ifsopen(std::string name)
   }
 
   /* search relative files in the path */
-  for (auto path_elm : surf_path) {
+  for (auto const& path_elm : surf_path) {
     std::string buff = path_elm + FILE_DELIM + name;
     fs->open(buff.c_str(), std::ifstream::in);
 
@@ -160,7 +160,7 @@ FILE *surf_fopen(const char *name, const char *mode)
     return fopen(name, mode);
 
   /* search relative files in the path */
-  for (auto path_elm : surf_path) {
+  for (auto const& path_elm : surf_path) {
     std::string buff = path_elm + FILE_DELIM + name;
     file             = fopen(buff.c_str(), mode);
 
@@ -361,17 +361,17 @@ void surf_exit()
 
   sg_host_exit();
   sg_link_exit();
-  for (auto e : storage_types) {
+  for (auto const& e : storage_types) {
     simgrid::surf::StorageType* stype = e.second;
     delete stype->properties;
     delete stype->model_properties;
     delete stype;
   }
-  for (auto s : *simgrid::surf::StorageImpl::storagesMap())
+  for (auto const& s : *simgrid::surf::StorageImpl::storagesMap())
     delete s.second;
   delete simgrid::surf::StorageImpl::storagesMap();
 
-  for (auto model : *all_existing_models)
+  for (auto const& model : *all_existing_models)
     delete model;
   delete all_existing_models;
 
index e9d4f78..df5f1ee 100644 (file)
@@ -177,7 +177,7 @@ tmgr_trace_event_t simgrid::trace_mgr::future_evt_set::pop_leq(double date, doub
 
 void tmgr_finalize()
 {
-  for (auto kv : trace_list)
+  for (auto const& kv : trace_list)
     delete kv.second;
   trace_list.clear();
 }
index 24e202c..823baf8 100644 (file)
@@ -39,7 +39,7 @@ static void trace2vector(const char* str, std::vector<tmgr::DatedValue>* whereto
   simgrid::trace_mgr::trace* trace = tmgr_trace_new_from_string("TheName", str, 0);
   XBT_VERB("---------------------------------------------------------");
   XBT_VERB("data>>\n%s<<data\n", str);
-  for (auto evt : trace->event_list)
+  for (auto const& evt : trace->event_list)
     XBT_VERB("event: d:%lg v:%lg", evt.date_, evt.value_);
 
   MockedResource daResource;
index 055b5fe..0e4d96d 100644 (file)
@@ -118,7 +118,7 @@ void parse_platform_file(const char *file)
     parse_status = surf_parse();
 
     /* connect all traces relative to hosts */
-    for (auto elm : trace_connect_list_host_avail) {
+    for (auto const& elm : trace_connect_list_host_avail) {
       xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
       tmgr_trace_t trace = traces_set_list.at(elm.first);
 
@@ -129,7 +129,7 @@ void parse_platform_file(const char *file)
       cpu->setStateTrace(trace);
     }
 
-    for (auto elm : trace_connect_list_host_speed) {
+    for (auto const& elm : trace_connect_list_host_speed) {
       xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
       tmgr_trace_t trace = traces_set_list.at(elm.first);
 
@@ -140,7 +140,7 @@ void parse_platform_file(const char *file)
       cpu->setSpeedTrace(trace);
     }
 
-    for (auto elm : trace_connect_list_link_avail) {
+    for (auto const& elm : trace_connect_list_link_avail) {
       xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
       tmgr_trace_t trace = traces_set_list.at(elm.first);
 
@@ -149,7 +149,7 @@ void parse_platform_file(const char *file)
       link->setStateTrace(trace);
     }
 
-    for (auto elm : trace_connect_list_link_bw) {
+    for (auto const& elm : trace_connect_list_link_bw) {
       xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
       tmgr_trace_t trace = traces_set_list.at(elm.first);
       sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
@@ -157,7 +157,7 @@ void parse_platform_file(const char *file)
       link->setBandwidthTrace(trace);
     }
 
-    for (auto elm : trace_connect_list_link_lat) {
+    for (auto const& elm : trace_connect_list_link_lat) {
       xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
       tmgr_trace_t trace = traces_set_list.at(elm.first);
       sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
index fd457c9..e1dd4f6 100644 (file)
@@ -64,7 +64,7 @@ void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::stri
       return a->name() < b->name();
   });
   bool first = true;
-  for (auto np : list) {
+  for (auto const& np : list) {
     if (np->isNetZone())
       continue;
 
@@ -114,7 +114,7 @@ static std::vector<int>* explodesRadical(std::string radicals)
   // Make all hosts
   std::vector<std::string> radical_elements;
   boost::split(radical_elements, radicals, boost::is_any_of(","));
-  for (auto group : radical_elements) {
+  for (auto const& group : radical_elements) {
     std::vector<std::string> radical_ends;
     boost::split(radical_ends, group, boost::is_any_of("-"));
     int start = surf_parse_get_int(radical_ends.front());
@@ -799,7 +799,7 @@ void ETag_surfxml_route(){
   route.link_list   = new std::vector<simgrid::surf::LinkImpl*>();
   route.symmetrical = (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES);
 
-  for (auto link: parsed_link_list)
+  for (auto const& link : parsed_link_list)
     route.link_list->push_back(link);
   parsed_link_list.clear();
 
@@ -829,7 +829,7 @@ void ETag_surfxml_zoneRoute()
 
   ASroute.link_list = new std::vector<simgrid::surf::LinkImpl*>();
 
-  for (auto link: parsed_link_list)
+  for (auto const& link : parsed_link_list)
     ASroute.link_list->push_back(link);
   parsed_link_list.clear();
 
@@ -858,7 +858,7 @@ void ETag_surfxml_bypassRoute(){
   route.symmetrical = false;
   route.link_list   = new std::vector<simgrid::surf::LinkImpl*>();
 
-  for (auto link: parsed_link_list)
+  for (auto const& link : parsed_link_list)
     route.link_list->push_back(link);
   parsed_link_list.clear();
 
@@ -882,7 +882,7 @@ void ETag_surfxml_bypassZoneRoute()
   ASroute.src         = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_src);
   ASroute.dst         = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_dst);
   ASroute.link_list   = new std::vector<simgrid::surf::LinkImpl*>();
-  for (auto link: parsed_link_list)
+  for (auto const& link : parsed_link_list)
     ASroute.link_list->push_back(link);
   parsed_link_list.clear();
 
@@ -980,7 +980,7 @@ void STag_surfxml_config()
 
 void ETag_surfxml_config()
 {
-  for (auto elm : *current_property_set) {
+  for (auto const& elm : *current_property_set) {
     if (xbt_cfg_is_default_value(elm.first.c_str())) {
       std::string cfg = elm.first + ":" + elm.second;
       xbt_cfg_set_parse(cfg.c_str());
index 2b1788b..d2f380b 100644 (file)
@@ -51,10 +51,10 @@ const char* false_values[] = {
 
 static bool parseBool(const char* value)
 {
-  for (const char* true_value : true_values)
+  for (const char* const& true_value : true_values)
     if (std::strcmp(true_value, value) == 0)
       return true;
-  for (const char* false_value : false_values)
+  for (const char* const& false_value : false_values)
     if (std::strcmp(false_value, value) == 0)
       return false;
   throw std::range_error("not a boolean");
@@ -299,7 +299,7 @@ protected:
 Config::~Config()
 {
   XBT_DEBUG("Frees cfg set %p", this);
-  for (auto elm : options)
+  for (auto const& elm : options)
     delete elm.second;
 }
 
@@ -344,7 +344,7 @@ void Config::dump(const char *name, const char *indent)
   if (name)
     printf("%s>> Dumping of the config set '%s':\n", indent, name);
 
-  for (auto elm : options)
+  for (auto const& elm : options)
     printf("%s  %s: ()%s) %s", indent, elm.first.c_str(), elm.second->getTypeName(),
            elm.second->getStringValue().c_str());
 
@@ -358,7 +358,7 @@ void Config::showAliases()
 {
   bool old_warn_for_aliases = false;
   std::swap(warn_for_aliases, old_warn_for_aliases);
-  for (auto elm : aliases)
+  for (auto const& elm : aliases)
     printf("   %s: %s\n", elm.first.c_str(), (*this)[elm.first.c_str()].getDescription().c_str());
   std::swap(warn_for_aliases, old_warn_for_aliases);
 }
@@ -366,7 +366,7 @@ void Config::showAliases()
 /** @brief Displays the declared options and their description */
 void Config::help()
 {
-  for (auto elm : options) {
+  for (auto const& elm : options) {
     simgrid::config::ConfigurationElement* variable = this->options.at(elm.first);
     printf("   %s: %s\n", elm.first.c_str(), variable->getDescription().c_str());
     printf("       Type: %s; ", variable->getTypeName());
index 4c2fec8..beee5cd 100644 (file)
@@ -105,7 +105,7 @@ static void handle_action(ReplayAction* action)
   char** c_action     = new char*[action->size() + 1];
   action_fun function = action_funs.at(action->at(1));
   int i               = 0;
-  for (auto arg : *action) {
+  for (auto const& arg : *action) {
     c_action[i] = xbt_strdup(arg.c_str());
     i++;
   }
index 6d8c6d5..948eca2 100644 (file)
@@ -25,7 +25,7 @@ static void master()
   std::vector<simgrid::s4u::ActorPtr>* actor_list = new std::vector<simgrid::s4u::ActorPtr>();
   simgrid::s4u::this_actor::getHost()->actorList(actor_list);
 
-  for (auto actor : *actor_list) {
+  for (auto const& actor : *actor_list) {
     XBT_INFO("Actor (pid=%lu, ppid=%lu, name=%s)", actor->getPid(), actor->getPpid(), actor->getName().c_str());
     if (simgrid::s4u::this_actor::getPid() != actor->getPid())
       actor->kill();
index 4e44320..df64ea9 100644 (file)
@@ -14,7 +14,7 @@ static void display_storage_properties(simgrid::s4u::Storage* storage)
   if (not props->empty()) {
     XBT_INFO("\tProperties of mounted storage: %s", storage->getName());
 
-    for (auto elm : *props) {
+    for (auto const& elm : *props) {
       XBT_INFO("    %s->%s", elm.first.c_str(), elm.second.c_str());
     }
   } else {
@@ -63,7 +63,7 @@ static void display_storage_content(simgrid::s4u::Storage* storage)
   XBT_INFO("Print the content of the storage element: %s", storage->getName());
   std::map<std::string, sg_size_t>* content = storage->getContent();
   if (not content->empty()) {
-    for (auto entry : *content)
+    for (auto const& entry : *content)
       XBT_INFO("\t%s size: %llu bytes", entry.first.c_str(), entry.second);
   } else {
     XBT_INFO("\tNo content.");
@@ -94,7 +94,7 @@ static void dump_platform_storages()
 {
   std::map<std::string, simgrid::s4u::Storage*>* storages = simgrid::s4u::allStorages();
 
-  for (auto storage : *storages) {
+  for (auto const& storage : *storages) {
     XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->getHost()->getCname());
     storage.second->setProperty("other usage", "gpfs");
   }
@@ -105,7 +105,7 @@ static void storage_info(simgrid::s4u::Host* host)
 {
   XBT_INFO("*** Storage info on %s ***", host->getCname());
 
-  for (auto elm : host->getMountedStorages()) {
+  for (auto const& elm : host->getMountedStorages()) {
     const char* mount_name         = elm.first.c_str();
     simgrid::s4u::Storage* storage = elm.second;
     XBT_INFO("\tStorage name: %s, mount name: %s", storage->getName(), mount_name);
index 60bd850..6c30832 100644 (file)
@@ -71,7 +71,7 @@ static void dump_platform()
     }
     if (props && not props->empty()) {
       std::printf(">\n");
-      for (auto kv : *props) {
+      for (auto const& kv : *props) {
         std::printf("    <prop id=\"%s\" value=\"%s\"/>\n", kv.first.c_str(), kv.second.c_str());
       }
       std::printf("  </host>\n");
@@ -88,7 +88,7 @@ static void dump_platform()
               return a->name() < b->name();
             });
 
-  for (auto srcCard : netcardList)
+  for (auto const& srcCard : netcardList)
     if (srcCard->isRouter())
       std::printf("  <router id=\"%s\"/>\n", srcCard->cname());
 
@@ -121,31 +121,31 @@ static void dump_platform()
       simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
       if (not route.empty()) {
         std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->getCname(), host2->getCname());
-        for (auto link : route)
+        for (auto const& link : route)
           std::printf("<link_ctn id=\"%s\"/>", link->cname());
         std::printf("\n  </route>\n");
       }
     }
-    for (auto netcardDst : netcardList) { // to router
+    for (auto const& netcardDst : netcardList) { // to router
       if (netcardDst->isRouter()) {
         std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->getCname(), netcardDst->cname());
         std::vector<simgrid::surf::LinkImpl*> route;
         simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
-        for (auto link : route)
+        for (auto const& link : route)
           std::printf("<link_ctn id=\"%s\"/>", link->cname());
         std::printf("\n  </route>\n");
       }
     }
   }
 
-  for (auto value1 : netcardList) { // Routes from router
+  for (auto const& value1 : netcardList) { // Routes from router
     if (value1->isRouter()) {
-      for (auto value2 : netcardList) { // to router
+      for (auto const& value2 : netcardList) { // to router
         if (value2->isRouter()) {
           std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", value1->cname(), value2->cname());
           std::vector<simgrid::surf::LinkImpl*> route;
           simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, value2, &route, nullptr);
-          for (auto link : route)
+          for (auto const& link : route)
             std::printf("<link_ctn id=\"%s\"/>", link->cname());
           std::printf("\n  </route>\n");
         }
@@ -156,7 +156,7 @@ static void dump_platform()
         std::vector<simgrid::surf::LinkImpl*> route;
         simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
         simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(value1, netcardDst, &route, nullptr);
-        for (auto link : route)
+        for (auto const& link : route)
           std::printf("<link_ctn id=\"%s\"/>", link->cname());
         std::printf("\n  </route>\n");
       }
index a45915e..9858c0c 100644 (file)
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
   xbt_dynar_free(&hosts);
 
   std::printf("NetCards count: %zu\n", netcardList.size());
-  for (auto nc : netcardList)
+  for (auto const& nc : netcardList)
     std::printf("   - Seen: \"%s\". Type: %s\n", nc->cname(),
                 nc->isRouter() ? "router" : (nc->isNetZone() ? "netzone" : (nc->isHost() ? "host" : "buggy")));
 
index 0b0f8af..41e5c97 100644 (file)
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
     double now = surf_get_clock();
     XBT_INFO("Next Event : %g", now);
 
-    for (auto model: *all_existing_models) {
+    for (auto const& model : *all_existing_models) {
       if (surf_model_running_action_set_size(model)) {
         XBT_DEBUG("\t Running that model");
         running = 1;
index 6f4cf6b..58a2304 100644 (file)
@@ -86,7 +86,7 @@ if(SIMGRID_HAVE_MC AND HAVE_GNU_LD AND NOT ${DL_LIBRARY} STREQUAL "")
 endif()
 
 if(SIMGRID_HAVE_NS3)
-  SET(SIMGRID_DEP "${SIMGRID_DEP} -lns${NS3_VERSION}-core${NS3_SUFFIX} -lns${NS3_VERSION}-csma${NS3_SUFFIX} -lns${NS3_VERSION}-point-to-point${NS3_SUFFIX} -lns${NS3_VERSION}-internet${NS3_SUFFIX} -lns${NS3_VERSION}-applications${NS3_SUFFIX}")
+  SET(SIMGRID_DEP "${SIMGRID_DEP} -lns${NS3_VERSION}-core${NS3_SUFFIX} -lns${NS3_VERSION}-csma${NS3_SUFFIX} -lns${NS3_VERSION}-point-to-point${NS3_SUFFIX} -lns${NS3_VERSION}-internet${NS3_SUFFIX} -lns${NS3_VERSION}-network${NS3_SUFFIX} -lns${NS3_VERSION}-applications${NS3_SUFFIX}")
 endif()
 
 if(HAVE_POSIX_GETTIME)