From: Arnaud Giersch Date: Wed, 4 Oct 2017 16:43:57 +0000 (+0200) Subject: Remove lines of commented code spotted by sonar. X-Git-Tag: v3_17~23 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c2f951e38bdf2b8639bf42b78b69c1530510b6f0 Remove lines of commented code spotted by sonar. --- diff --git a/examples/java/app/bittorrent/Connection.java b/examples/java/app/bittorrent/Connection.java index 668283a762..1bd47ebb92 100644 --- a/examples/java/app/bittorrent/Connection.java +++ b/examples/java/app/bittorrent/Connection.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 @@ -32,7 +32,6 @@ public class Connection { // Add a new value to the peer speed average public void addSpeedValue(double speed) { peerSpeed = peerSpeed * 0.55 + speed * 0.45; - // peerSpeed = (peerSpeed * messagesCount + speed) / (++messagesCount); } @Override diff --git a/examples/java/app/bittorrent/Peer.java b/examples/java/app/bittorrent/Peer.java index 94d0a68cf8..43be4d4bda 100644 --- a/examples/java/app/bittorrent/Peer.java +++ b/examples/java/app/bittorrent/Peer.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 @@ -384,14 +384,12 @@ public class Peer extends Process { if (currentPieces.size() >= (Common.FILE_PIECES - pieces)) { return; } -// if (pieces < 3) { - do { - currentPiece = stream.randInt(0,Common.FILE_PIECES - 1); - } while (!(bitfield[currentPiece] == '0' && !currentPieces.contains(currentPiece))); -// } -// else { - //TODO trivial min algorithm. -// } + + //TODO: trivial min algorithm when pieces >= 3 + do { + currentPiece = stream.randInt(0,Common.FILE_PIECES - 1); + } while (!(bitfield[currentPiece] == '0' && !currentPieces.contains(currentPiece))); + currentPieces.add(currentPiece); Msg.debug("New interested piece: " + currentPiece); assert currentPiece >= 0 && currentPiece < Common.FILE_PIECES; diff --git a/examples/java/cloud/masterworker/Master.java b/examples/java/cloud/masterworker/Master.java index ea80d77a67..b005c1f2e3 100644 --- a/examples/java/cloud/masterworker/Master.java +++ b/examples/java/cloud/masterworker/Master.java @@ -55,16 +55,6 @@ public class Master extends Process { Msg.verb("Sleep long enough for everyone to be done with previous batch of work"); waitFor(1000*step - Msg.getClock()); - /* Msg.info("Add one more process per VM."); - for (int i = 0; i < vms.size(); i++) { - VM vm = vms.get(i); - Worker worker = new Worker(vm,i + vms.size()); - worker.start(); - } - - workBatch(workersCount * 2); - */ - Msg.verb("Migrate everyone to "+hosts[3].getName()); for (VM vm : vms) { Msg.verb("Migrate "+vm.getName()+" to "+hosts[3].getName()); diff --git a/examples/java/cloud/migration/XVM.java b/examples/java/cloud/migration/XVM.java index ded5e443b1..414c98096e 100644 --- a/examples/java/cloud/migration/XVM.java +++ b/examples/java/cloud/migration/XVM.java @@ -28,7 +28,6 @@ public class XVM extends VM { public void setLoad(int load){ if (load >0) { this.setBound(this.getSpeed()*load/100); - // this.getDaemon().setLoad(load); daemon.resume(); } else{ daemon.suspend(); diff --git a/examples/java/dht/chord/Node.java b/examples/java/dht/chord/Node.java index 2ef023c1d2..94e8112ae8 100644 --- a/examples/java/dht/chord/Node.java +++ b/examples/java/dht/chord/Node.java @@ -332,7 +332,6 @@ public class Node extends Process { // Performs a find successor request to a random id. private void randomLookup() { int dest = 1337; - //Msg.info("Making a lookup request for id " + dest); findSuccessor(dest); } diff --git a/examples/smpi/mc/only_send_deterministic.c b/examples/smpi/mc/only_send_deterministic.c index 8c9108c2dd..34aca4cc8a 100644 --- a/examples/smpi/mc/only_send_deterministic.c +++ b/examples/smpi/mc/only_send_deterministic.c @@ -1,6 +1,6 @@ /* ../../../smpi_script/bin/smpirun -hostfile hostfile_send_deterministic -platform ../../platforms/cluster.xml -np 3 --cfg=smpi/send-is-detached-thresh:0 gdb\ --args\ ./send_deterministic */ -/* Copyright (c) 2009-2015. The SimGrid Team. +/* Copyright (c) 2009-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -33,15 +33,11 @@ int main(int argc, char **argv) } if (rank == 0) { - //printf("MPI_ISend / MPI_IRecv Test \n"); - for (int i = 0; i < size - 1; i++) { MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status); - //printf("Message received from %d\n", recv_buff); } }else{ MPI_Send(&rank, 1, MPI_INT, 0, 42, MPI_COMM_WORLD); - //printf("Sent %d to rank 0\n", rank); } MPI_Finalize(); diff --git a/src/bindings/java/jmsg_process.cpp b/src/bindings/java/jmsg_process.cpp index 000d1d4c4a..ec8c032c43 100644 --- a/src/bindings/java/jmsg_process.cpp +++ b/src/bindings/java/jmsg_process.cpp @@ -217,13 +217,6 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep(JNIEnv *env, jclass cl if (rv != MSG_OK) { XBT_DEBUG("Something during the MSG_process_sleep invocation was wrong, trigger a HostFailureException"); - //jmsg_throw_status(env,rv); - - // adsein, the code above as been replaced by the code below. Indeed, according to the documentation, a sleep can only - // trigger a host_failure exception. When the sleep crashes due to a host shutdown, the exception thrown by smx_context_java.c - // is a cancelled_error, see bindings/java/smx_context_java.c, function void smx_ctx_java_stop(smx_context_t context) and src/msg/msg_gos.c - // function msg_error_t MSG_process_sleep(double nb_sec) - jxbt_throw_host_failure(env, ""); } } diff --git a/src/bindings/java/jtrace.cpp b/src/bindings/java/jtrace.cpp index c33ba631d6..667c7b4255 100644 --- a/src/bindings/java/jtrace.cpp +++ b/src/bindings/java/jtrace.cpp @@ -178,16 +178,25 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSet env->ReleaseStringUTFChars(jvar, variable); } /* Missing calls -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableAdd (JNIEnv *, jclass, jstring, jstring, jdouble); -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableSub (JNIEnv *env, jclass cls, jstring, jstring, jdouble); -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableSetWithTime (JNIEnv *, jclass, jdouble, jstring, jstring, jdouble); -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableAddWithTime (JNIEnv *, jclass, jdouble, jstring, jstring, jdouble); -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableSubWithTime (JNIEnv *, jclass, jdouble, jstring, jstring, jdouble); -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableAdd (JNIEnv *, jclass, jstring, jstring, jstring, jdouble); -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSub (JNIEnv *, jclass, jstring, jstring, jstring, jdouble); -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSetWithTime (JNIEnv *env, jclass cls, jdouble, jstring, jstring, jstring, jdouble); -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcdstVariableAddWithTime (JNIEnv *env, jclass cls, jdouble, jstring, jstring, jstring, jdouble); -JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSubWithTime (JNIEnv *env, jclass cls, jdouble, jstring, jstring, jstring, jdouble); + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableAdd(JNIEnv *, jclass, jstring, jstring, jdouble) + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableSub(JNIEnv *env, jclass cls, jstring, jstring, + jdouble) + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableSetWithTime(JNIEnv *, jclass, jdouble, jstring, + jstring, jdouble) + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableAddWithTime(JNIEnv *, jclass, jdouble, jstring, + jstring, jdouble) + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkVariableSubWithTime(JNIEnv *, jclass, jdouble, jstring, + jstring, jdouble) + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableAdd(JNIEnv *, jclass, jstring, jstring, + jstring, jdouble) + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSub(JNIEnv *, jclass, jstring, jstring, + jstring, jdouble) + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSetWithTime(JNIEnv *env, jclass cls, jdouble, + jstring, jstring, jstring, jdouble) + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcdstVariableAddWithTime(JNIEnv *env, jclass cls, jdouble, + jstring, jstring, jstring, jdouble) + JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSubWithTime(JNIEnv *env, jclass cls, jdouble, + jstring, jstring, jstring, jdouble) */ SG_END_DECL() diff --git a/src/kernel/context/ContextRaw.cpp b/src/kernel/context/ContextRaw.cpp index 244fdd448a..8e83fa50b5 100644 --- a/src/kernel/context/ContextRaw.cpp +++ b/src/kernel/context/ContextRaw.cpp @@ -270,7 +270,7 @@ RawContextFactory::RawContextFactory() raw_workers_context = xbt_new(RawContext*, nthreads); raw_maestro_context = nullptr; #endif - // TODO, if(SIMIX_context_get_parallel_threshold() > 1) => choose dynamically + // TODO: choose dynamically when SIMIX_context_get_parallel_threshold() > 1 } } diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index b3b83dfac4..75bd500027 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -64,8 +64,8 @@ void TorusZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int linkDown = linkUp; } /* - * Add the link to its appropriate position; - * note that position rankId*(xbt_dynar_length(dimensions)+has_loopback?+has_limiter?) + * Add the link to its appropriate position. + * Note that position rankId*(xbt_dynar_length(dimensions)+has_loopback?+has_limiter?) * holds the link "rankId->rankId" */ privateLinks_.insert({position + j, {linkUp, linkDown}}); diff --git a/src/mc/ChunkedData.cpp b/src/mc/ChunkedData.cpp index b60f9386ff..c3a635749c 100644 --- a/src/mc/ChunkedData.cpp +++ b/src/mc/ChunkedData.cpp @@ -38,17 +38,15 @@ ChunkedData::ChunkedData(PageStore& store, AddressSpace& as, xbt_assert(simgrid::mc::mmu::split(page.address()).second == 0, "Not at the beginning of a page"); - /* Adding another copy (and a syscall) will probably slow things a lot. - TODO, optimize this somehow (at least by grouping the syscalls) - if needed. Either: - - reduce the number of syscalls; - - let the application snapshot itself; - - move the segments in shared memory (this will break `fork` however). - */ - - as.read_bytes( - buffer.data(), xbt_pagesize, page, - simgrid::mc::ProcessIndexDisabled); + /* Adding another copy (and a syscall) will probably slow things a lot. + TODO, optimize this somehow (at least by grouping the syscalls) + if needed. Either: + - reduce the number of syscalls + - let the application snapshot itself + - move the segments in shared memory (this will break `fork` however) + */ + + as.read_bytes(buffer.data(), xbt_pagesize, page, simgrid::mc::ProcessIndexDisabled); pagenos_[i] = store_->store_page(buffer.data()); diff --git a/src/mc/ObjectInformation.cpp b/src/mc/ObjectInformation.cpp index 015a60b345..78d557f3d9 100644 --- a/src/mc/ObjectInformation.cpp +++ b/src/mc/ObjectInformation.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2015. The SimGrid Team. +/* Copyright (c) 2014-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -17,7 +17,7 @@ namespace mc { /* For an executable object, addresses are virtual address * (there is no offset) i.e. - * \f$\text{virtual address} = \{dwarf address}\f$; + * \f$\text{virtual address} = \{dwarf address}\f$ * * For a shared object, the addreses are offset from the begining * of the shared object (the base address of the mapped shared diff --git a/src/mc/PageStore.cpp b/src/mc/PageStore.cpp index a2e49930c9..b258b16f5b 100644 --- a/src/mc/PageStore.cpp +++ b/src/mc/PageStore.cpp @@ -155,9 +155,9 @@ std::size_t PageStore::store_page(void* page) xbt_assert(top_index_ <= this->capacity_, "top_index is not consistent"); // First, we check if a page with the same content is already in the page store: - // 1. compute the hash of the page; - // 2. find pages with the same hash using `hash_index_`; - // 3. find a page with the same content. + // 1. compute the hash of the page + // 2. find pages with the same hash using `hash_index_` + // 3. find a page with the same content hash_type hash = mc_hash_page(page); // Try to find a duplicate in set of pages with the same hash: diff --git a/src/mc/RegionSnapshot.cpp b/src/mc/RegionSnapshot.cpp index 104e8ffc46..c1206077bb 100644 --- a/src/mc/RegionSnapshot.cpp +++ b/src/mc/RegionSnapshot.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2015. The SimGrid Team. +/* Copyright (c) 2007-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -81,8 +81,8 @@ RegionSnapshot dense_region( void *start_addr, void* permanent_addr, size_t size) { // When KSM support is enables, we allocate memory using mmap: - // * we don't want to advise bits of the heap as mergable; - // * mmap gives data aligned on page boundaries which is merge friendly. + // * we don't want to advise bits of the heap as mergable + // * mmap gives data aligned on page boundaries which is merge friendly simgrid::mc::Buffer data; if (_sg_mc_ksm) data = Buffer::mmap(size); diff --git a/src/mc/checker/CommunicationDeterminismChecker.cpp b/src/mc/checker/CommunicationDeterminismChecker.cpp index 1b405a1e89..5f7b401d4b 100644 --- a/src/mc/checker/CommunicationDeterminismChecker.cpp +++ b/src/mc/checker/CommunicationDeterminismChecker.cpp @@ -390,7 +390,6 @@ void CommunicationDeterminismChecker::restoreState() /* Restore the initial state */ simgrid::mc::session->restoreInitialState(); - // int n = xbt_dynar_length(incomplete_communications_pattern); unsigned n = MC_smx_get_maxpid(); assert(n == xbt_dynar_length(incomplete_communications_pattern)); assert(n == xbt_dynar_length(initial_communications_pattern)); diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index eef1ca8e65..03f96aec94 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -441,7 +441,6 @@ int mmalloc_compare_heap( XBT_DEBUG("Block %zu not found (size_used = %zu, addr = %p)", i1, heapinfo1->busy_block.busy_size, addr_block1); i1 = state.heaplimit + 1; nb_diff1++; - //i1++; } } else { /* Fragmented block */ @@ -1339,40 +1338,34 @@ static int compare_areas_with_type(simgrid::mc::StateComparator& state, pointer_level++; - // Some cases are not handled here: - // * the pointers lead to different areas (one to the heap, the other to the RW segment ...); - // * a pointer leads to the read-only segment of the current object; - // * a pointer lead to a different ELF object. - - if (addr_pointed1 > process->heap_address - && addr_pointed1 < mc_snapshot_get_heap_end(snapshot1)) { - if (not(addr_pointed2 > process->heap_address && addr_pointed2 < mc_snapshot_get_heap_end(snapshot2))) - return 1; - // The pointers are both in the heap: - return simgrid::mc::compare_heap_area(state, - process_index, addr_pointed1, addr_pointed2, snapshot1, - snapshot2, nullptr, type->subtype, pointer_level); - } + // Some cases are not handled here: + // * the pointers lead to different areas (one to the heap, the other to the RW segment ...) + // * a pointer leads to the read-only segment of the current object + // * a pointer lead to a different ELF object + + if (addr_pointed1 > process->heap_address && addr_pointed1 < mc_snapshot_get_heap_end(snapshot1)) { + if (not(addr_pointed2 > process->heap_address && addr_pointed2 < mc_snapshot_get_heap_end(snapshot2))) + return 1; + // The pointers are both in the heap: + return simgrid::mc::compare_heap_area(state, process_index, addr_pointed1, addr_pointed2, snapshot1, snapshot2, + nullptr, type->subtype, pointer_level); + } else if (region1->contain(simgrid::mc::remote(addr_pointed1))) { // The pointers are both in the current object R/W segment: - else if (region1->contain(simgrid::mc::remote(addr_pointed1))) { - if (not region2->contain(simgrid::mc::remote(addr_pointed2))) - return 1; - if (not type->type_id) - return (addr_pointed1 != addr_pointed2); - else - return compare_areas_with_type(state, process_index, - addr_pointed1, snapshot1, region1, - addr_pointed2, snapshot2, region2, - type->subtype, pointer_level); - } + if (not region2->contain(simgrid::mc::remote(addr_pointed2))) + return 1; + if (not type->type_id) + return (addr_pointed1 != addr_pointed2); + else + return compare_areas_with_type(state, process_index, addr_pointed1, snapshot1, region1, addr_pointed2, + snapshot2, region2, type->subtype, pointer_level); + } else { // TODO, We do not handle very well the case where // it belongs to a different (non-heap) region from the current one. - else - return (addr_pointed1 != addr_pointed2); - + return (addr_pointed1 != addr_pointed2); + } break; } case DW_TAG_structure_type: diff --git a/src/mc/mc_dwarf.cpp b/src/mc/mc_dwarf.cpp index 8be805343d..c7a785bcaa 100644 --- a/src/mc/mc_dwarf.cpp +++ b/src/mc/mc_dwarf.cpp @@ -623,7 +623,7 @@ static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* info, Dwarf_Die /** \brief Create a MC type object from a DIE * * \param info current object info object - * \param DIE (for a given type); + * \param DIE (for a given type) * \param unit compilation unit of the current DIE * \return MC representation of the type */ @@ -671,7 +671,7 @@ static simgrid::mc::Type MC_dwarf_die_to_type( if (type.type == DW_TAG_pointer_type) type.byte_size = sizeof(void*); - // Computation of the byte_size; + // Computation of the byte_size if (dwarf_hasattr_integrate(die, DW_AT_byte_size)) type.byte_size = MC_dwarf_attr_integrate_uint(die, DW_AT_byte_size, 0); else if (type.type == DW_TAG_array_type @@ -1189,8 +1189,8 @@ void MC_load_dwarf(simgrid::mc::ObjectInformation* info) // If there was no DWARF in the file, try to find it in a separate file. // Different methods might be used to store the DWARF informations: - // * GNU NT_GNU_BUILD_ID; - // * .gnu_debuglink. + // * GNU NT_GNU_BUILD_ID + // * .gnu_debuglink // See https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html // for reference of what we are doing. diff --git a/src/mc/mc_request.cpp b/src/mc/mc_request.cpp index 8879e90691..59ccaa9f5a 100644 --- a/src/mc/mc_request.cpp +++ b/src/mc/mc_request.cpp @@ -235,8 +235,6 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid case SIMCALL_COMM_IRECV: { size_t* remote_size = simcall_comm_irecv__get__dst_buff_size(req); - - // size_t size = size_pointer ? *size_pointer : 0; size_t size = 0; if (remote_size) mc_model_checker->process().read_bytes(&size, sizeof(size), diff --git a/src/mc/mc_smx.cpp b/src/mc/mc_smx.cpp index cd22b6b26c..c37252a531 100644 --- a/src/mc/mc_smx.cpp +++ b/src/mc/mc_smx.cpp @@ -97,7 +97,6 @@ void RemoteClient::refresh_simix() static_assert(sizeof(simix_global) == sizeof(simgrid::simix::Global*), "Bad size for simix_global"); - // simix_global_p = REMOTE(simix_global.get()); RemotePtr simix_global_p = this->read_variable("simix_global"); diff --git a/src/mc/mc_unw.cpp b/src/mc/mc_unw.cpp index 7566b5a809..85b6129a3f 100644 --- a/src/mc/mc_unw.cpp +++ b/src/mc/mc_unw.cpp @@ -251,9 +251,6 @@ void UnwindContext::initialize(simgrid::mc::RemoteClient* process, unw_context_t // We don't really need support for FR registers as they are caller saved // and probably never use those fields as libunwind-x86_64 does not read // FP registers from the unw_context_t - // but we fix the pointer in order to avoid dangling pointers: - // context->context_.uc_mcontext.fpregs = &(context->context.__fpregs_mem); - // Let's ignore this and see what happens: this->unwindContext_.uc_mcontext.fpregs = nullptr; # endif diff --git a/src/mc/mc_unw_vmread.cpp b/src/mc/mc_unw_vmread.cpp index 48d822c2e2..97b56468a8 100644 --- a/src/mc/mc_unw_vmread.cpp +++ b/src/mc/mc_unw_vmread.cpp @@ -28,7 +28,7 @@ */ struct _UPT_info { pid_t pid; - // Other things; + // Other things... }; /** Get the PID of a `libunwind-ptrace` context diff --git a/src/msg/msg_io.cpp b/src/msg/msg_io.cpp index 715622867d..1566e850a9 100644 --- a/src/msg/msg_io.cpp +++ b/src/msg/msg_io.cpp @@ -158,7 +158,6 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) } } /* Write file on local or remote host */ - // sg_size_t offset = fd->tell(); sg_size_t write_size = fd->write(size); // TODO readd attached_host return write_size; diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index c385ac7087..1829b63a2a 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015. The SimGrid Team. +/* Copyright (c) 2012-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -318,7 +318,6 @@ static int migration_rx_fun(int argc, char *argv[]) std::string task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 4); msg_task_t task = MSG_task_create(task_name.c_str(), 0, 0, nullptr); msg_error_t ret = MSG_task_send(task, ms->mbox_ctl); - // xbt_assert(ret == MSG_OK); if(ret == MSG_HOST_FAILURE){ // The DST has crashed, this is a problem has the VM since we are not sure whether SRC is considering that the VM // has been correctly migrated on the DST node @@ -375,7 +374,6 @@ static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug double clock = MSG_get_clock(); - // total += calc_updated_pages(key, vm, dp, remaining, clock); total += get_computed(key, vm, dp, remaining, clock); dp->prev_remaining = remaining; @@ -433,7 +431,6 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task) if (vm->pimpl_vm_->dp_enabled) { double remaining = MSG_task_get_flops_amount(task); double clock = MSG_get_clock(); - // double updated = calc_updated_pages(key, host, dp, remaining, clock); double updated = get_computed(key, vm, dp, remaining, clock); // was host instead of vm vm->pimpl_vm_->dp_updated_by_deleted_tasks += updated; @@ -499,8 +496,6 @@ static sg_size_t get_updated_size(double computed, double dp_rate, double dp_cap double updated_size = computed * dp_rate; XBT_DEBUG("updated_size %f dp_rate %f", updated_size, dp_rate); if (updated_size > dp_cap) { - // XBT_INFO("mig-stage2.%d: %f bytes updated, but cap it with the working set size %f", stage2_round, updated_size, - // dp_cap); updated_size = dp_cap; } diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index b60dfc3e1d..f672a50553 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2015. The SimGrid Team. +/* Copyright (c) 2013-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -41,8 +41,7 @@ std::deque VirtualMachineImpl::allVms_; * The total CPU share these processes get is smaller than that of the VM process gets on a host operating system. * FIXME: add a configuration flag for this */ -// const double virt_overhead = 0.95; -const double virt_overhead = 1; +const double virt_overhead = 1; // 0.95 static void hostStateChange(s4u::Host& host) { diff --git a/src/simdag/sd_global.cpp b/src/simdag/sd_global.cpp index 9fe80207d0..88656c0d29 100644 --- a/src/simdag/sd_global.cpp +++ b/src/simdag/sd_global.cpp @@ -173,7 +173,7 @@ void SD_init_nocheck(int *argc, char **argv) * Do --help on any simgrid binary to see the list of currently existing configuration variables, and * see Section @ref options. * - * Example: SD_config("host/model","default"); + * Example: SD_config("host/model","default") */ void SD_config(const char *key, const char *value){ xbt_assert(sd_global,"ERROR: Please call SD_init() before using SD_config()"); diff --git a/src/simix/popping.cpp b/src/simix/popping.cpp index 91a79b1091..6afbc1cc3a 100644 --- a/src/simix/popping.cpp +++ b/src/simix/popping.cpp @@ -25,9 +25,11 @@ void SIMIX_simcall_answer(smx_simcall_t simcall) simcall->issuer->name.c_str(), simcall->issuer); simcall->issuer->simcall.call = SIMCALL_NONE; /* This check should be useless and slows everyone. Reactivate if you see something weird in process scheduling. */ - // if (std::find(begin(simix_global->process_to_run), end(simix_global->process_to_run), simcall->issuer) != - // end(simix_global->process_to_run)) - // DIE_IMPOSSIBLE; + if (0) { + if (std::find(begin(simix_global->process_to_run), end(simix_global->process_to_run), simcall->issuer) != + end(simix_global->process_to_run)) + DIE_IMPOSSIBLE; + } simix_global->process_to_run.push_back(simcall->issuer); } } diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 7975425ad0..591cf58a0c 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -315,7 +315,8 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_activity_t synchro, do /* otherwise set up a waiting timeout on the right side */ if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING) { SIMIX_comm_finish(synchro); - } else { /* if (timeout >= 0) { we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host fails */ + } else { /* we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host + fails */ surf_action_t sleep = simcall->issuer->host->pimpl_cpu->sleep(timeout); sleep->setData(&*synchro); @@ -546,7 +547,6 @@ void SIMIX_comm_finish(smx_activity_t synchro) case SIMIX_SRC_HOST_FAILURE: if (simcall->issuer == comm->src_proc) simcall->issuer->context->iwannadie = 1; - // SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); else SMX_EXCEPTION(simcall->issuer, network_error, 0, "Remote peer failed"); break; @@ -554,7 +554,6 @@ void SIMIX_comm_finish(smx_activity_t synchro) case SIMIX_DST_HOST_FAILURE: if (simcall->issuer == comm->dst_proc) simcall->issuer->context->iwannadie = 1; - // SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); else SMX_EXCEPTION(simcall->issuer, network_error, 0, "Remote peer failed"); break; diff --git a/src/simix/smx_synchro.cpp b/src/simix/smx_synchro.cpp index 66f332c15e..c47d04c882 100644 --- a/src/simix/smx_synchro.cpp +++ b/src/simix/smx_synchro.cpp @@ -79,7 +79,6 @@ void SIMIX_synchro_finish(smx_activity_t synchro) case SIMIX_FAILED: simcall->issuer->context->iwannadie = 1; -// SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); break; default: diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index 5b05ac59db..24ba70485b 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -128,8 +128,6 @@ void smpi_bench_end() } else { for (unsigned int i = 0; i < counter_data.size(); i++) { counter_data[i].second += event_values[i]; - // XBT_DEBUG("[%i] PAPI: Counter %s: Value is now %lli (got increment by %lli\n", smpi_process()->index(), - // counter_data[i].first.c_str(), counter_data[i].second, event_values[i]); } } } diff --git a/src/surf/lagrange.cpp b/src/surf/lagrange.cpp index 7e70a86b1f..0f671f5d37 100644 --- a/src/surf/lagrange.cpp +++ b/src/surf/lagrange.cpp @@ -242,8 +242,6 @@ void lagrange_solve(lmm_system_t sys) if (var->bound >= 0) { XBT_DEBUG("Working on var (%p)", var); var->new_mu = new_mu(var); -/* dual_updated += (fabs(var->new_mu-var->mu)>dichotomy_min_error); */ -/* XBT_DEBUG("dual_updated (%d) : %1.20f",dual_updated,fabs(var->new_mu-var->mu)); */ XBT_DEBUG("Updating mu : var->mu (%p) : %1.20f -> %1.20f", var, var->mu, var->new_mu); var->mu = var->new_mu; @@ -259,8 +257,6 @@ void lagrange_solve(lmm_system_t sys) cnst = static_cast(_cnst); XBT_DEBUG("Working on cnst (%p)", cnst); cnst->new_lambda = dichotomy(cnst->lambda, partial_diff_lambda, cnst, dichotomy_min_error); -/* dual_updated += (fabs(cnst->new_lambda-cnst->lambda)>dichotomy_min_error); */ -/* XBT_DEBUG("dual_updated (%d) : %1.20f",dual_updated,fabs(cnst->new_lambda-cnst->lambda)); */ XBT_DEBUG("Updating lambda : cnst->lambda (%p) : %1.20f -> %1.20f", cnst, cnst->lambda, cnst->new_lambda); cnst->lambda = cnst->new_lambda; @@ -291,10 +287,6 @@ void lagrange_solve(lmm_system_t sys) if (not __check_feasible(cnst_list, var_list, 0)) overall_modification = 1.0; XBT_DEBUG("Iteration %d: overall_modification : %f", iteration, overall_modification); - /* if(not dual_updated) { */ - /* XBT_WARN("Could not improve the convergence at iteration %d. Drop it!",iteration); */ - /* break; */ - /* } */ } __check_feasible(cnst_list, var_list, 1); @@ -391,25 +383,20 @@ static double dichotomy(double init, double diff(double, void *), void *var_cnst min = middle; overall_error = max_diff - middle_diff; min_diff = middle_diff; -/* SHOW_EXPR(overall_error); */ } else if (middle_diff > 0) { XBT_CDEBUG(surf_lagrange_dichotomy, "Decreasing max"); max = middle; overall_error = max_diff - middle_diff; max_diff = middle_diff; -/* SHOW_EXPR(overall_error); */ } else { overall_error = 0; -/* SHOW_EXPR(overall_error); */ } } else if (fabs(min_diff) < 1e-20) { max = min; overall_error = 0; -/* SHOW_EXPR(overall_error); */ } else if (fabs(max_diff) < 1e-20) { min = max; overall_error = 0; -/* SHOW_EXPR(overall_error); */ } else if (min_diff > 0 && max_diff < 0) { XBT_CWARN(surf_lagrange_dichotomy, "The impossible happened, partial_diff(min) > 0 && partial_diff(max) < 0"); xbt_abort(); @@ -541,7 +528,6 @@ double func_reno_fpi(lmm_variable_t var, double x) 2.0 / (3.0 * var->sharing_weight * var->sharing_weight); if (res_fpi <= 0.0) return 0.0; -/* xbt_assert(res_fpi>0.0,"Don't call me with stupid values!"); */ return sqrt(res_fpi); } diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index 02c65df32b..baac10522e 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -767,7 +767,6 @@ void lmm_solve(lmm_system_t sys) xbt_swag_foreach(_cnst, cnst_list) { lmm_constraint_t cnst = (lmm_constraint_t)_cnst; xbt_swag_t elem_list = &(cnst->enabled_element_set); - //XBT_DEBUG("Variable set : %d", xbt_swag_size(elem_list)); xbt_swag_foreach(_elem, elem_list) { lmm_variable_t var = ((lmm_element_t)_elem)->variable; xbt_assert(var->sharing_weight > 0.0); @@ -852,7 +851,6 @@ void lmm_solve(lmm_system_t sys) //If no variable could reach its bound, deal iteratively the constraints usage ( at worst one constraint is // saturated at each cycle) var->value = min_usage / var->sharing_weight; - // XBT_DEBUG("Setting %p (%d) value to %f\n", var, var->id_int, var->value); XBT_DEBUG("Setting var (%d) value to %f\n", var->id_int, var->value); } else { //If there exist a variable that can reach its bound, only update it (and other with the same bound) for now. @@ -884,9 +882,6 @@ void lmm_solve(lmm_system_t sys) int index = (cnst->cnst_light-cnst_light_tab); XBT_DEBUG("index: %d \t cnst_light_num: %d \t || usage: %f remaining: %f bound: %f ", index,cnst_light_num, cnst->usage, cnst->remaining, cnst->bound); - //XBT_DEBUG("index: %d \t cnst_light_num: %d \t || \t cnst: %p \t cnst->cnst_light: %p " - // "\t cnst_light_tab: %p usage: %f remaining: %f bound: %f ", index,cnst_light_num, - // cnst, cnst->cnst_light, cnst_light_tab, cnst->usage, cnst->remaining, cnst->bound); cnst_light_tab[index]=cnst_light_tab[cnst_light_num-1]; cnst_light_tab[index].cnst->cnst_light = &cnst_light_tab[index]; cnst_light_num--; @@ -1045,7 +1040,6 @@ void lmm_enable_var(lmm_system_t sys, lmm_variable_t var){ //When used within lmm_on_disabled_var, we would get an assertion fail, because transiently there can be variables // that are staged and could be activated. //Anyway, caller functions all call lmm_check_concurrency() in the end. - // lmm_check_concurrency(sys); } void lmm_disable_var(lmm_system_t sys, lmm_variable_t var){ @@ -1114,7 +1108,6 @@ void lmm_on_disabled_var(lmm_system_t sys, lmm_constraint_t cnstr){ //We could get an assertion fail, because transiently there can be variables that are staged and could be activated. //And we need to go through all constraints of the disabled var before getting back a coherent state. //Anyway, caller functions all call lmm_check_concurrency() in the end. - // lmm_check_concurrency(sys); } /* \brief update the weight of a variable, and enable/disable it. diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index d2f380be0c..3947248782 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -519,7 +519,6 @@ void xbt_cfg_set_parse(const char *options) /* Pass the following blank chars */ *(option++) = '\0'; while (option - name < (len - 1) && (*option == ' ' || *option == '\n' || *option == '\t')) { - /* fprintf(stderr,"Ignore a blank char.\n"); */ option++; } if (option - name == len - 1) diff --git a/src/xbt/cunit.cpp b/src/xbt/cunit.cpp index 9da7c7ea5f..87c869c4f4 100644 --- a/src/xbt/cunit.cpp +++ b/src/xbt/cunit.cpp @@ -469,8 +469,6 @@ static void apply_selection(char *selection) if (not selection || selection[0] == '\0') return; - /*printf("Test selection: %s\n", selection); */ - /* First apply the selection */ while (not done) { int enabling = 1; diff --git a/src/xbt/dict.cpp b/src/xbt/dict.cpp index 485641c1d9..2d2520d758 100644 --- a/src/xbt/dict.cpp +++ b/src/xbt/dict.cpp @@ -622,7 +622,6 @@ static void debugged_remove(xbt_dict_t head, const char* key) { xbt_test_add("Remove '%s'", key); xbt_dict_remove(head, key); - /* xbt_dict_dump(head,(void (*)(void*))&printf); */ } static void traverse(xbt_dict_t head) @@ -766,8 +765,6 @@ XBT_TEST_UNIT("basic", test_dict_basic, "Basic usage: change, retrieve and trave xbt_test_add("Traverse the resulting dictionary"); traverse(head); - /* xbt_dict_dump(head,(void (*)(void*))&printf); */ - xbt_test_add("Free the dictionary twice"); xbt_dict_free(&head); xbt_dict_free(&head); @@ -895,7 +892,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") xbt_test_log("Fill the struct, count its elems and frees the structure"); xbt_test_log("using 1000 elements with %d chars long randomized keys.", SIZEOFKEY); xbt_dict_t head = xbt_dict_new_homogeneous(free); - /* if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); */ for (int j = 0; j < 1000; j++) { char* data = nullptr; char* key = (char*)xbt_malloc(SIZEOFKEY); @@ -904,7 +900,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") for (int k = 0; k < SIZEOFKEY - 1; k++) key[k] = rand() % ('z' - 'a') + 'a'; key[SIZEOFKEY - 1] = '\0'; - /* printf("[%d %s]\n",j,key); */ data = (char*) xbt_dict_get_or_null(head, key); } while (data != nullptr); @@ -914,7 +909,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") count(head, j + 1); } - /* xbt_dict_dump(head,(void (*)(void*))&printf); */ traverse(head); xbt_dict_free(&head); xbt_dict_free(&head); @@ -928,7 +922,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") snprintf(key,10, "%d", j); xbt_dict_set(head, key, key, nullptr); } - /*xbt_dict_dump(head,(void (*)(void*))&printf); */ xbt_test_add("Count the elements (retrieving the key and data for each)"); xbt_test_log("There is %d elements", countelems(head)); @@ -936,7 +929,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") xbt_test_add("Search my %d elements 20 times", NB_ELM); char* key = (char*)xbt_malloc(10); for (int i = 0; i < 20; i++) { - /* if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); */ for (int j = 0; j < NB_ELM; j++) { snprintf(key,10, "%d", j); void* data = xbt_dict_get(head, key); diff --git a/src/xbt/dynar.cpp b/src/xbt/dynar.cpp index 4c44eb35d9..63bbc4450c 100644 --- a/src/xbt/dynar.cpp +++ b/src/xbt/dynar.cpp @@ -729,7 +729,6 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers") for (int cpt = 0; cpt < NB_ELEM; cpt++) *(int *) xbt_dynar_get_ptr(d, cpt) = cpt; - /* xbt_dynar_set(d,cpt,&cpt); */ for (int cpt = 0; cpt < NB_ELEM; cpt++) *(int *) xbt_dynar_get_ptr(d, cpt) = cpt; diff --git a/src/xbt/log.c b/src/xbt/log.c index 04772a3afa..a3a3918741 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -281,8 +281,9 @@ void xbt_log_init(int *argc, char **argv) int j = 1; /* uncomment to set the LOG category to debug directly */ - // _XBT_LOGV(log).threshold = xbt_log_priority_debug; - + if (0) { + _XBT_LOGV(log).threshold = xbt_log_priority_debug; + } xbt_log_connect_categories(); /* Set logs and init log submodule */ diff --git a/src/xbt/mallocator.c b/src/xbt/mallocator.c index fa9f5828e8..e3a0319599 100644 --- a/src/xbt/mallocator.c +++ b/src/xbt/mallocator.c @@ -1,6 +1,6 @@ /* mallocator - recycle objects to avoid malloc() / free() */ -/* Copyright (c) 2006-2014. The SimGrid Team. +/* Copyright (c) 2006-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -154,8 +154,6 @@ void *xbt_mallocator_get(xbt_mallocator_t m) if (m->current_size <= 0) { /* No object is ready yet. Create a bunch of them to try to group the * mallocs on the same memory pages (to help the cache lines) */ - - /* XBT_DEBUG("Create a new object for mallocator %p (size:%d/%d)", m, m->current_size, m->max_size); */ int i; int amount = MIN(m->max_size / 2, 1000); for (i = 0; i < amount; i++) @@ -164,7 +162,6 @@ void *xbt_mallocator_get(xbt_mallocator_t m) } /* there is at least an available object, now */ - /* XBT_DEBUG("Reuse an old object for mallocator %p (size:%d/%d)", m, m->current_size, m->max_size); */ object = m->objects[--m->current_size]; lock_release(m); } else { @@ -202,14 +199,11 @@ void xbt_mallocator_release(xbt_mallocator_t m, void *object) lock_acquire(m); if (m->current_size < m->max_size) { /* there is enough place to push the object */ - /* XBT_DEBUG("Store deleted object in mallocator %p for further use (size:%d/%d)", - m, m->current_size, m->max_size); */ m->objects[m->current_size++] = object; lock_release(m); } else { lock_release(m); /* otherwise we don't have a choice, we must free the object */ - /* XBT_DEBUG("Free deleted object: mallocator %p is full (size:%d/%d)", m, m->current_size, m->max_size); */ m->free_f(object); } } else { diff --git a/src/xbt/memory_map.cpp b/src/xbt/memory_map.cpp index 73e2d8d487..ed7ee9d53b 100644 --- a/src/xbt/memory_map.cpp +++ b/src/xbt/memory_map.cpp @@ -187,8 +187,6 @@ XBT_PRIVATE std::vector get_memory_map(pid_t pid) * 00602000-00603000 rw-p 00002000 00:28 1837264 */ - //fprintf(stderr,"%s", line); - /* Wipeout the new line character */ line[read - 1] = '\0'; diff --git a/src/xbt/swag.c b/src/xbt/swag.c index e10514e663..9d3af40cc0 100644 --- a/src/xbt/swag.c +++ b/src/xbt/swag.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2014. The SimGrid Team. +/* Copyright (c) 2004-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -212,7 +212,6 @@ XBT_TEST_UNIT("basic", test_swag_basic, "Basic usage") xbt_test_assert(xbt_swag_remove(NULL, setB) == NULL); xbt_test_assert(xbt_swag_remove(obj1, setB) == obj1); - /* xbt_test_assert(xbt_swag_remove(obj2, setB) == obj2); */ xbt_test_add("Traverse set A"); xbt_swag_foreach(obj, setA) { diff --git a/src/xbt/xbt_log_appender_file.c b/src/xbt/xbt_log_appender_file.c index 2e938d1afa..472a314d62 100644 --- a/src/xbt/xbt_log_appender_file.c +++ b/src/xbt/xbt_log_appender_file.c @@ -1,6 +1,6 @@ /* file_appender - a dumb log appender which simply prints to a file */ -/* Copyright (c) 2007-2014. The SimGrid Team. +/* Copyright (c) 2007-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -53,7 +53,6 @@ static void open_append2_file(xbt_log_append2_file_t data){ fseek(data->file,0,SEEK_SET); } } else{ - //printf("Splitting\n"); //Split if(data->file) fclose(data->file); diff --git a/teshsuite/surf/maxmin_bench/maxmin_bench.cpp b/teshsuite/surf/maxmin_bench/maxmin_bench.cpp index a002dc066c..6bb1b1eea3 100644 --- a/teshsuite/surf/maxmin_bench/maxmin_bench.cpp +++ b/teshsuite/surf/maxmin_bench/maxmin_bench.cpp @@ -167,7 +167,7 @@ int main(int argc, char **argv) unsigned int nb_var= TestClasses[testclass][1]; unsigned int pw_base_limit= TestClasses[testclass][2]; unsigned int pw_max_limit= TestClasses[testclass][3]; - unsigned int max_share=2; //1<<(pw_base_limit/2+1); + unsigned int max_share = 2; // 1<<(pw_base_limit/2+1) //If you want to test concurrency, you need nb_elem >> 2^pw_base_limit: unsigned int nb_elem= (1<