-/* 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
// 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
-/* 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
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;
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());
public void setLoad(int load){
if (load >0) {
this.setBound(this.getSpeed()*load/100);
- // this.getDaemon().setLoad(load);
daemon.resume();
} else{
daemon.suspend();
// 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);
}
/* ../../../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
}
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();
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, "");
}
}
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()
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
}
}
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}});
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());
-/* 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
/* 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
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:
-/* 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
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);
/* 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));
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 */
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:
/** \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
*/
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
// 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.
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),
static_assert(sizeof(simix_global) == sizeof(simgrid::simix::Global*),
"Bad size for simix_global");
- // simix_global_p = REMOTE(simix_global.get());
RemotePtr<simgrid::simix::Global> simix_global_p =
this->read_variable<simgrid::simix::Global*>("simix_global");
// 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
*/
struct _UPT_info {
pid_t pid;
- // Other things;
+ // Other things...
};
/** Get the PID of a `libunwind-ptrace` context
}
}
/* 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;
-/* 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
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
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;
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;
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;
}
-/* 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
* 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)
{
* 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()");
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);
}
}
/* 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);
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;
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;
case SIMIX_FAILED:
simcall->issuer->context->iwannadie = 1;
-// SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
break;
default:
} 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]);
}
}
}
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;
cnst = static_cast<lmm_constraint_t>(_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;
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);
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();
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);
}
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);
//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.
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--;
//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){
//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.
/* 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)
if (not selection || selection[0] == '\0')
return;
- /*printf("Test selection: %s\n", selection); */
-
/* First apply the selection */
while (not done) {
int enabling = 1;
{
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)
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);
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);
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);
count(head, j + 1);
}
- /* xbt_dict_dump(head,(void (*)(void*))&printf); */
traverse(head);
xbt_dict_free(&head);
xbt_dict_free(&head);
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));
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);
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;
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 */
/* 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
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++)
}
/* 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 {
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 {
* 00602000-00603000 rw-p 00002000 00:28 1837264 <complete-path-to-file>
*/
- //fprintf(stderr,"%s", line);
-
/* Wipeout the new line character */
line[read - 1] = '\0';
-/* 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
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) {
/* 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
fseek(data->file,0,SEEK_SET);
}
} else{
- //printf("Splitting\n");
//Split
if(data->file)
fclose(data->file);
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<<pw_base_limit)+(1<<(8*pw_max_limit/10));