From: Martin Quinson Date: Sun, 27 Aug 2017 22:23:23 +0000 (+0200) Subject: Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid X-Git-Tag: v3_17~204 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1847d1441271d076b3de449c8853031ea208ce8f?hp=17a5f55527a7fd22835025e89f1e8f75aed15849 Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid --- diff --git a/examples/java/app/bittorrent/Common.java b/examples/java/app/bittorrent/Common.java index 0eb1eaa0e1..b7f7718606 100644 --- a/examples/java/app/bittorrent/Common.java +++ b/examples/java/app/bittorrent/Common.java @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2014, 2016. The SimGrid Team. +/* Copyright (c) 2006-2014, 2016-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -18,7 +18,7 @@ class Common { public static final int MESSAGE_SIZE = 1; /* Information message size */ public static final int MAXIMUM_PEERS = 50; /* Max number of peers sent by the tracker to clients */ public static final int TRACKER_QUERY_INTERVAL = 1000; /* Interval of time where the peer should send a request to the tracker */ - public static final double TRACKER_COMM_SIZE = 0.01; /* Communication size for a task to the tracker */ + public static final double TRACKER_COMM_SIZE = 1; /* Communication size for a task to the tracker */ public static final int GET_PEERS_TIMEOUT = 10000; /* Timeout for the get peers data */ public static final int TIMEOUT_MESSAGE = 10; public static final int TRACKER_RECEIVE_TIMEOUT = 10; diff --git a/examples/java/io/storage/Client.java b/examples/java/io/storage/Client.java index 480ff86ebc..2239ffb89e 100644 --- a/examples/java/io/storage/Client.java +++ b/examples/java/io/storage/Client.java @@ -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() { + 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 +} diff --git a/examples/s4u/app-bittorrent/s4u_bittorrent.cpp b/examples/s4u/app-bittorrent/s4u_bittorrent.cpp index cbc093b293..e45b1e7f8d 100644 --- a/examples/s4u/app-bittorrent/s4u_bittorrent.cpp +++ b/examples/s4u/app-bittorrent/s4u_bittorrent.cpp @@ -23,7 +23,7 @@ int main(int argc, char* argv[]) std::vector 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"); diff --git a/examples/s4u/app-bittorrent/s4u_bittorrent.hpp b/examples/s4u/app-bittorrent/s4u_bittorrent.hpp index 4b02ab2f16..a3b296a2af 100644 --- a/examples/s4u/app-bittorrent/s4u_bittorrent.hpp +++ b/examples/s4u/app-bittorrent/s4u_bittorrent.hpp @@ -17,7 +17,7 @@ /** Interval of time where the peer should send a request to the tracker */ #define TRACKER_QUERY_INTERVAL 1000 /** Communication size for a task to the tracker */ -#define TRACKER_COMM_SIZE 0.01 +#define TRACKER_COMM_SIZE 1 #define GET_PEERS_TIMEOUT 10000 #define TIMEOUT_MESSAGE 10 #define TRACKER_RECEIVE_TIMEOUT 10 diff --git a/examples/s4u/app-bittorrent/s4u_peer.cpp b/examples/s4u/app-bittorrent/s4u_peer.cpp index 79157bc9a5..431f433b30 100644 --- a/examples/s4u/app-bittorrent/s4u_peer.cpp +++ b/examples/s4u/app-bittorrent/s4u_peer.cpp @@ -18,7 +18,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_bt_peer, "Messages specific for the peers"); #define FILE_PIECES 10UL #define PIECES_BLOCKS 5UL #define BLOCK_SIZE 16384 -static const unsigned long int FILE_SIZE = FILE_PIECES * PIECES_BLOCKS * BLOCK_SIZE; /** Number of blocks asked by each request */ #define BLOCKS_REQUESTED 2 @@ -58,7 +57,7 @@ Peer::Peer(std::vector args) Peer::~Peer() { - for (auto peer : connected_peers) + for (auto const& peer : connected_peers) delete peer.second; delete[] pieces_count; } @@ -103,7 +102,7 @@ bool Peer::getPeersFromTracker() try { TrackerAnswer* answer = static_cast(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; @@ -118,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(); @@ -152,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(); } @@ -221,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; @@ -547,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; @@ -581,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; @@ -618,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; diff --git a/examples/s4u/app-bittorrent/s4u_tracker.hpp b/examples/s4u/app-bittorrent/s4u_tracker.hpp index 6aff63d9c6..bebc397d15 100644 --- a/examples/s4u/app-bittorrent/s4u_tracker.hpp +++ b/examples/s4u/app-bittorrent/s4u_tracker.hpp @@ -22,10 +22,10 @@ public: }; class TrackerAnswer { - 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* peers; // the peer list the peer has asked for. public: - explicit TrackerAnswer(int interval) : interval(interval) { peers = new std::set; } + explicit TrackerAnswer(int /*interval*/) /*: interval(interval)*/ { peers = new std::set; } TrackerAnswer(const TrackerAnswer&) = delete; ~TrackerAnswer() { delete peers; }; void addPeer(int peer) { peers->insert(peer); } diff --git a/examples/s4u/app-masterworker/s4u_app-masterworker.cpp b/examples/s4u/app-masterworker/s4u_app-masterworker.cpp index 04102b739c..c0ce006b50 100644 --- a/examples/s4u/app-masterworker/s4u_app-masterworker.cpp +++ b/examples/s4u/app-masterworker/s4u_app-masterworker.cpp @@ -41,17 +41,15 @@ public: number_of_tasks, mailbox->getName()); /* - Send the computation amount to the @ref worker */ - mailbox->put(static_cast(&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(&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(mailbox->get()); - xbt_assert(comp_size != nullptr, "MSG_task_get failed"); - if (*comp_size < 0) { /* - Exit if 'finalize' is received */ + double* task = static_cast(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); } } }; diff --git a/examples/s4u/app-masterworker/s4u_app-masterworker.tesh b/examples/s4u/app-masterworker/s4u_app-masterworker.tesh index ff2092d8bc..f9b20df3fa 100644 --- a/examples/s4u/app-masterworker/s4u_app-masterworker.tesh +++ b/examples/s4u/app-masterworker/s4u_app-masterworker.tesh @@ -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 diff --git a/examples/s4u/app-token-ring/s4u_app-token-ring.cpp b/examples/s4u/app-token-ring/s4u_app-token-ring.cpp index ead05bfbef..a5c3d7fa4a 100644 --- a/examples/s4u/app-token-ring/s4u_app-token-ring.cpp +++ b/examples/s4u/app-token-ring/s4u_app-token-ring.cpp @@ -63,7 +63,7 @@ int main(int argc, char** argv) int id = 0; std::vector 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++; diff --git a/examples/s4u/dht-chord/s4u_dht-chord.cpp b/examples/s4u/dht-chord/s4u_dht-chord.cpp index 1a9db78bf2..6bd3cc8368 100644 --- a/examples/s4u/dht-chord/s4u_dht-chord.cpp +++ b/examples/s4u/dht-chord/s4u_dht-chord.cpp @@ -30,7 +30,7 @@ static void chord_init() std::vector list; simgrid::s4u::Engine::getInstance()->getHostList(&list); - for (auto host : list) + for (auto const& host : list) host->extension_set(new HostChord(host)); } diff --git a/examples/s4u/io/s4u_io.cpp b/examples/s4u/io/s4u_io.cpp index 8c60b637d0..789bf1cdb0 100644 --- a/examples/s4u/io/s4u_io.cpp +++ b/examples/s4u/io/s4u_io.cpp @@ -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; diff --git a/examples/simdag/test/sd_test.cpp b/examples/simdag/test/sd_test.cpp index 3b3de64480..f5fad58579 100644 --- a/examples/simdag/test/sd_test.cpp +++ b/examples/simdag/test/sd_test.cpp @@ -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 *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)); } diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index dd4dcc811c..c972fe0de5 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -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); diff --git a/include/simgrid/s4u/Host.hpp b/include/simgrid/s4u/Host.hpp index 30c932e298..b27c954e0c 100644 --- a/include/simgrid/s4u/Host.hpp +++ b/include/simgrid/s4u/Host.hpp @@ -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 * whereto); diff --git a/include/xbt/signal.hpp b/include/xbt/signal.hpp index 508822cf2b..d5ad826fa2 100644 --- a/include/xbt/signal.hpp +++ b/include/xbt/signal.hpp @@ -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() diff --git a/src/bindings/java/JavaContext.cpp b/src/bindings/java/JavaContext.cpp index c796b18c0d..7865d16d6d 100644 --- a/src/bindings/java/JavaContext.cpp +++ b/src/bindings/java/JavaContext.cpp @@ -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(process->context)->resume(); } } diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index 11342f25b4..09d41702e3 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -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); } diff --git a/src/bindings/java/jmsg_as.cpp b/src/bindings/java/jmsg_as.cpp index cd344be661..41ed0b39b8 100644 --- a/src/bindings/java/jmsg_as.cpp +++ b/src/bindings/java/jmsg_as.cpp @@ -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(host->extension(JAVA_HOST_LEVEL)); if (not jhost) { jname = env->NewStringUTF(host->getCname()); diff --git a/src/bindings/java/jmsg_host.cpp b/src/bindings/java/jmsg_host.cpp index 28804e76e9..a255e2e147 100644 --- a/src/bindings/java/jmsg_host.cpp +++ b/src/bindings/java/jmsg_host.cpp @@ -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); diff --git a/src/bindings/java/jmsg_vm.cpp b/src/bindings/java/jmsg_vm.cpp index b570d72103..76b0dcec4b 100644 --- a/src/bindings/java/jmsg_vm.cpp +++ b/src/bindings/java/jmsg_vm.cpp @@ -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()); } } diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index f0ca4380da..cddfe8aaa4 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -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); diff --git a/src/include/xbt/parmap.hpp b/src/include/xbt/parmap.hpp index 24affcc830..dd5037f7aa 100644 --- a/src/include/xbt/parmap.hpp +++ b/src/include/xbt/parmap.hpp @@ -62,25 +62,25 @@ private: class Synchro { public: explicit Synchro(Parmap& 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. * diff --git a/src/instr/instr_config.cpp b/src/instr/instr_config.cpp index 9a14d50624..a3318319cf 100644 --- a/src/instr/instr_config.cpp +++ b/src/instr/instr_config.cpp @@ -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 diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index 24b187f70a..a65032c113 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -35,7 +35,7 @@ static xbt_dynar_t instr_set_to_dynar(std::set* 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 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); } diff --git a/src/instr/instr_paje_trace.cpp b/src/instr/instr_paje_trace.cpp index cd2a3ceb7c..6e9df5552f 100644 --- a/src/instr/instr_paje_trace.cpp +++ b/src/instr/instr_paje_trace.cpp @@ -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::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 *buf); void buffer_debug(std::vector *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(""); diff --git a/src/instr/jedule/jedule.cpp b/src/instr/jedule/jedule.cpp index 4f7841fe43..3138d6a45f 100644 --- a/src/instr/jedule/jedule.cpp +++ b/src/instr/jedule/jedule.cpp @@ -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, " \n"); - for (auto elm: this->meta_info) + for (auto const& elm : this->meta_info) fprintf(file, " \n",elm.first,elm.second); fprintf(file, " \n"); } @@ -42,8 +42,8 @@ void Jedule::writeOutput(FILE *file) { fprintf(file, " \n"); fprintf(file, " \n"); - for (auto event :this->event_set) - event->print(file); + for (auto const& event : this->event_set) + event->print(file); fprintf(file, " \n"); fprintf(file, "\n"); diff --git a/src/instr/jedule/jedule_events.cpp b/src/instr/jedule/jedule_events.cpp index afe12f3cac..01ca092499 100644 --- a/src/instr/jedule/jedule_events.cpp +++ b/src/instr/jedule/jedule_events.cpp @@ -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, " \n"); - for (auto subset: *this->resource_subsets) { + for (auto const& subset : *this->resource_subsets) { fprintf(jed_file, "