const char *name = nullptr; /* the name of the task */
if (jflopsAmount < 0) {
- jxbt_throw_illegal(env, bprintf("Task flopsAmount (%f) cannot be negative", (double) jflopsAmount));
+ jxbt_throw_illegal(env, bprintf("Task flopsAmount (%f) cannot be negative", static_cast<double>(jflopsAmount)));
return;
}
if (jbytesAmount < 0) {
- jxbt_throw_illegal(env, bprintf("Task bytesAmount (%f) cannot be negative", (double) jbytesAmount));
+ jxbt_throw_illegal(env, bprintf("Task bytesAmount (%f) cannot be negative", static_cast<double>(jbytesAmount)));
return;
}
}
/* create the task */
- task = MSG_task_create(name, (double) jflopsAmount, (double) jbytesAmount, nullptr);
+ task = MSG_task_create(name, static_cast<double>(jflopsAmount), static_cast<double>(jbytesAmount), nullptr);
if (jname)
env->ReleaseStringUTFChars(jname, name);
/* sets the task name */
return;
}
- host_count = (int) env->GetArrayLength(jhosts);
+ host_count = static_cast<int>(env->GetArrayLength(jhosts));
hosts = xbt_new0(msg_host_t, host_count);
computeDurations = xbt_new0(double, host_count);
jxbt_throw_notbound(env, "task", jtask);
return;
}
- MSG_task_set_priority(task, (double) priority);
+ MSG_task_set_priority(task, static_cast<double>(priority));
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setFlopsAmount (JNIEnv *env, jobject jtask, jdouble computationAmount)
jxbt_throw_notbound(env, "task", jtask);
return;
}
- MSG_task_set_flops_amount(task, (double) computationAmount);
+ MSG_task_set_flops_amount(task, static_cast<double>(computationAmount));
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBytesAmount (JNIEnv *env, jobject jtask, jdouble dataSize)
return;
}
env->SetDoubleField(jtask, jtask_field_Task_messageSize, dataSize);
- MSG_task_set_bytes_amount(task, (double) dataSize);
+ MSG_task_set_bytes_amount(task, static_cast<double>(dataSize));
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_send(JNIEnv * env,jobject jtask, jstring jalias, jdouble jtimeout)
/* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
- rv = MSG_task_send_with_timeout(task, alias, (double) jtimeout);
+ rv = MSG_task_send_with_timeout(task, alias, static_cast<double>(jtimeout));
env->ReleaseStringUTFChars(jalias, alias);
if (rv != MSG_OK) {
/* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
- rv = MSG_task_send_with_timeout_bounded(task, alias, (double) jtimeout, (double) maxrate);
+ rv = MSG_task_send_with_timeout_bounded(task, alias, static_cast<double>(jtimeout), static_cast<double>(maxrate));
env->ReleaseStringUTFChars(jalias, alias);
if (rv != MSG_OK) {
jobject jhost)
{
msg_task_t task = nullptr;
-
msg_host_t host = nullptr;
- jobject jtask_global, jtask_local;
if (jhost) {
host = jhost_get_native(env, jhost);
jmsg_throw_status(env,rv);
return nullptr;
}
- jtask_global = (jobject) MSG_task_get_data(task);
+ jobject jtask_global = (jobject) MSG_task_get_data(task);
/* Convert the global ref into a local ref so that the JVM can free the stuff */
- jtask_local = env->NewLocalRef(jtask_global);
+ jobject jtask_local = env->NewLocalRef(jtask_global);
env->DeleteGlobalRef(jtask_global);
MSG_task_set_data(task, nullptr);
*task = nullptr;
msg_host_t host = nullptr;
- jobject jtask_global, jtask_local;
- const char *alias;
if (jhost) {
host = jhost_get_native(env, jhost);
}
}
- alias = env->GetStringUTFChars(jalias, 0);
- rv = MSG_task_receive_ext_bounded(task, alias, (double) jtimeout, host, (double) rate);
+ const char *alias = env->GetStringUTFChars(jalias, 0);
+ rv = MSG_task_receive_ext_bounded(task, alias, static_cast<double>(jtimeout), host, static_cast<double>(rate));
if (env->ExceptionOccurred())
return nullptr;
if (rv != MSG_OK) {
jmsg_throw_status(env,rv);
return nullptr;
}
- jtask_global = (jobject) MSG_task_get_data(*task);
+ jobject jtask_global = (jobject) MSG_task_get_data(*task);
/* Convert the global ref into a local ref so that the JVM can free the stuff */
- jtask_local = env->NewLocalRef(jtask_global);
+ jobject jtask_local = env->NewLocalRef(jtask_global);
env->DeleteGlobalRef(jtask_global);
MSG_task_set_data(*task, nullptr);
}
const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
- msg_comm_t comm = MSG_task_irecv_bounded(task, mailbox, (double)rate);
+ msg_comm_t comm = MSG_task_irecv_bounded(task, mailbox, static_cast<double>(rate));
env->ReleaseStringUTFChars(jmailbox, mailbox);
env->SetLongField(jcomm, jtask_field_Comm_bind, (jlong) (uintptr_t)(comm));
/* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
- MSG_task_dsend_bounded(task, alias, msg_task_cancel_on_failed_dsend,(double)maxrate);
+ MSG_task_dsend_bounded(task, alias, msg_task_cancel_on_failed_dsend,static_cast<double>(maxrate));
env->ReleaseStringUTFChars(jalias, alias);
}
JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Task_listen(JNIEnv * env, jclass cls, jstring jalias)
{
- const char *alias;
- int rv;
-
- alias = env->GetStringUTFChars(jalias, 0);
- rv = MSG_task_listen(alias);
+ const char *alias = env->GetStringUTFChars(jalias, 0);
+ int rv = MSG_task_listen(alias);
env->ReleaseStringUTFChars(jalias, alias);
return (jboolean) rv;
JNIEXPORT jint JNICALL Java_org_simgrid_msg_Task_listenFrom(JNIEnv * env, jclass cls, jstring jalias)
{
- int rv;
const char *alias = env->GetStringUTFChars(jalias, 0);
- rv = MSG_task_listen_from(alias);
+ int rv = MSG_task_listen_from(alias);
env->ReleaseStringUTFChars(jalias, alias);
return (jint) rv;
link.policy = cluster->sharing_policy;
sg_platf_new_link(&link);
- surf::LinkImpl *linkUp, *linkDown;
+ surf::LinkImpl *linkUp;
+ surf::LinkImpl *linkDown;
if (link.policy == SURF_LINK_FULLDUPLEX) {
char* tmp_link = bprintf("%s_UP", link_id);
linkUp = surf::LinkImpl::byName(tmp_link);
void DijkstraZone::seal()
{
xbt_node_t node = nullptr;
- unsigned int cursor2, cursor;
+ unsigned int cursor2;
+ unsigned int cursor;
/* Create the topology graph */
if (!routeGraph_)
xbt_node_t DijkstraZone::routeGraphNewNode(int id, int graph_id)
{
- xbt_node_t node = nullptr;
- graph_node_data_t data = nullptr;
- graph_node_map_element_t elm = nullptr;
-
- data = xbt_new0(struct graph_node_data, 1);
+ graph_node_data_t data = xbt_new0(struct graph_node_data, 1);
data->id = id;
data->graph_id = graph_id;
- node = xbt_graph_new_node(routeGraph_, data);
- elm = xbt_new0(struct graph_node_map_element, 1);
+ xbt_node_t node = xbt_graph_new_node(routeGraph_, data);
+ graph_node_map_element_t elm = xbt_new0(struct graph_node_map_element, 1);
elm->node = node;
xbt_dict_set_ext(graphNodeMap_, (char*)(&id), sizeof(int), (xbt_dictelm_t)elm, nullptr);
/* apply dijkstra using the indexes from the graph's node array */
while (xbt_heap_size(pqueue) > 0) {
- int* v_id = (int*)xbt_heap_pop(pqueue);
+ int* v_id = static_cast<int*>(xbt_heap_pop(pqueue));
xbt_node_t v_node = xbt_dynar_get_as(nodes, *v_id, xbt_node_t);
xbt_edge_t edge = nullptr;
unsigned int cursor;
}
/* compose route path with links */
- NetPoint *gw_src = nullptr, *gw_dst, *prev_gw_src, *first_gw = nullptr;
+ NetPoint *gw_src = nullptr;
+ NetPoint *gw_dst;
+ NetPoint *prev_gw_src;
+ NetPoint *first_gw = nullptr;
NetPoint *gw_dst_net_elm = nullptr, *prev_gw_src_net_elm = nullptr;
for (int v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
XBT_DEBUG("Resolve route from '%s' to '%s'", src->cname(), dst->cname());
/* Find how src and dst are interconnected */
- NetZoneImpl *common_ancestor, *src_ancestor, *dst_ancestor;
+ NetZoneImpl *common_ancestor;
+ NetZoneImpl *src_ancestor;
+ NetZoneImpl *dst_ancestor;
find_common_ancestors(src, dst, &common_ancestor, &src_ancestor, &dst_ancestor);
XBT_DEBUG("elements_father: common ancestor '%s' src ancestor '%s' dst ancestor '%s'", common_ancestor->name(),
src_ancestor->name(), dst_ancestor->name());
XBT_DEBUG("get_route_and_latency %s -> %s", my_src->cname(), my_dst->cname());
- xbt_node_t current, previous;
- const char *previous_name, *current_name;
+ xbt_node_t current;
+ xbt_node_t previous;
+ const char *previous_name;
+ const char *current_name;
if (route->gw_src) {
previous = new_xbt_graph_node(graph, route->gw_src->cname(), nodes);
inline unsigned int* rankId_to_coords(int rankId, xbt_dynar_t dimensions)
{
- unsigned int i = 0, cur_dim_size = 1, dim_size_product = 1;
+ unsigned int cur_dim_size = 1;
+ unsigned int dim_size_product = 1;
unsigned int* coords = (unsigned int*)malloc(xbt_dynar_length(dimensions) * sizeof(unsigned int));
- for (i = 0; i < xbt_dynar_length(dimensions); i++) {
+ for (unsigned int i = 0; i < xbt_dynar_length(dimensions); i++) {
cur_dim_size = xbt_dynar_get_as(dimensions, i, int);
coords[i] = (rankId / dim_size_product) % cur_dim_size;
dim_size_product *= cur_dim_size;
* Each rank creates @a dimensions-1 links
*/
int neighbor_rank_id = 0; // The other node the link connects
- int current_dimension = 0, // which dimension are we currently in?
+ int current_dimension = 0; // which dimension are we currently in?
// we need to iterate over all dimensions
// and create all links there
- dim_product = 1; // Needed to calculate the next neighbor_id
+ int dim_product = 1; // Needed to calculate the next neighbor_id
for (unsigned int j = 0; j < xbt_dynar_length(dimensions_); j++) {
s_sg_platf_link_cbarg_t link;
memset(&link, 0, sizeof(link));
current_dimension = xbt_dynar_get_as(dimensions_, j, int);
- neighbor_rank_id = (((int)rank / dim_product) % current_dimension == current_dimension - 1)
+ neighbor_rank_id = ((static_cast<int>(rank) / dim_product) % current_dimension == current_dimension - 1)
? rank - (current_dimension - 1) * dim_product
: rank + dim_product;
// name of neighbor is not right for non contiguous cluster radicals (as id != rank in this case)
* Dimension based routing routes through each dimension consecutively
* TODO Change to dynamic assignment
*/
- unsigned int j, cur_dim, dim_product = 1;
+ unsigned int cur_dim;
+ unsigned int dim_product = 1;
unsigned int current_node = src->id();
unsigned int next_node = 0;
/*
// false means: next -> cur
while (current_node != dst->id()) {
dim_product = 1; // First, we will route in x-dimension
- for (j = 0; j < xbt_dynar_length(dimensions_); j++) {
+ for (unsigned int j = 0; j < xbt_dynar_length(dimensions_); j++) {
cur_dim = xbt_dynar_get_as(dimensions_, j, int);
// current_node/dim_product = position in current dimension
/* For the moment, intensity_rate is the percentage against the migration bandwidth */
double host_speed = MSG_host_get_speed(pm);
- double update_speed = ((double)dp_intensity/100) * mig_netspeed;
+ double update_speed = (static_cast<double>(dp_intensity)/100) * mig_netspeed;
msg_vm_t vm = MSG_vm_create_core(pm, name);
s_vm_params_t params;
memset(¶ms, 0, sizeof(params));
- params.ramsize = (sg_size_t)ramsize * 1024 * 1024;
+ params.ramsize = static_cast<sg_size_t>(ramsize) * 1024 * 1024;
params.devsize = 0;
params.skip_stage2 = 0;
params.max_downtime = 0.03;
params.dp_rate = (update_speed * 1024 * 1024) / host_speed;
params.dp_cap = params.ramsize * 0.9; // assume working set memory is 90% of ramsize
- params.mig_speed = (double)mig_netspeed * 1024 * 1024; // mig_speed
+ params.mig_speed = static_cast<double>(mig_netspeed) * 1024 * 1024; // mig_speed
XBT_DEBUG("dp rate %f migspeed : %f intensity mem : %d, updatespeed %f, hostspeed %f", params.dp_rate,
params.mig_speed, dp_intensity, update_speed, host_speed);
vm->pimpl_vm_->resume();
});
- {
- // Now the VM is running on the new host (the migration is completed) (even if the SRC crash)
- vm->pimpl_vm_->isMigrating = false;
- XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", ms->vm->cname(), ms->src_pm->cname(), ms->dst_pm->cname());
-
- if (TRACE_msg_vm_is_enabled()) {
- static long long int counter = 0;
- char key[INSTR_DEFAULT_STR_SIZE];
- snprintf(key, INSTR_DEFAULT_STR_SIZE, "%lld", counter++);
-
- // start link
- container_t msg = PJ_container_get(vm->cname());
- type_t type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
- new_pajeStartLink(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
-
- // destroy existing container of this vm
- container_t existing_container = PJ_container_get(vm->cname());
- PJ_container_remove_from_parent(existing_container);
- PJ_container_free(existing_container);
-
- // create new container on the new_host location
- PJ_container_new(vm->cname(), INSTR_MSG_VM, PJ_container_get(ms->dst_pm->cname()));
-
- // end link
- msg = PJ_container_get(vm->cname());
- type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
- new_pajeEndLink(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
- }
+
+ // Now the VM is running on the new host (the migration is completed) (even if the SRC crash)
+ vm->pimpl_vm_->isMigrating = false;
+ XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", ms->vm->cname(), ms->src_pm->cname(), ms->dst_pm->cname());
+
+ if (TRACE_msg_vm_is_enabled()) {
+ static long long int counter = 0;
+ char key[INSTR_DEFAULT_STR_SIZE];
+ snprintf(key, INSTR_DEFAULT_STR_SIZE, "%lld", counter);
+ counter++;
+
+ // start link
+ container_t msg = PJ_container_get(vm->cname());
+ type_t type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
+ new_pajeStartLink(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
+
+ // destroy existing container of this vm
+ container_t existing_container = PJ_container_get(vm->cname());
+ PJ_container_remove_from_parent(existing_container);
+ PJ_container_free(existing_container);
+
+ // create new container on the new_host location
+ PJ_container_new(vm->cname(), INSTR_MSG_VM, PJ_container_get(ms->dst_pm->cname()));
+
+ // end link
+ msg = PJ_container_get(vm->cname());
+ type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
+ new_pajeEndLink(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
}
+
// Inform the SRC that the migration has been correctly performed
- {
- char *task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 4);
- msg_task_t task = MSG_task_create(task_name, 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
- // TODO What does it mean ? What should we do ?
- MSG_task_destroy(task);
- } else if(ret == MSG_TRANSFER_FAILURE){
- // The SRC has crashed, this is not a problem has the VM has been correctly migrated on the DST node
- MSG_task_destroy(task);
- }
- xbt_free(task_name);
+ char *task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 4);
+ msg_task_t task = MSG_task_create(task_name, 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
+ // TODO What does it mean ? What should we do ?
+ MSG_task_destroy(task);
+ } else if(ret == MSG_TRANSFER_FAILURE){
+ // The SRC has crashed, this is not a problem has the VM has been correctly migrated on the DST node
+ MSG_task_destroy(task);
}
+ xbt_free(task_name);
XBT_DEBUG("mig: rx_done");
return 0;
{
sg_size_t sent = 0;
char *task_name = get_mig_task_name(vm, src_pm, dst_pm, stage);
- msg_task_t task = MSG_task_create(task_name, 0, (double)size, nullptr);
+ msg_task_t task = MSG_task_create(task_name, 0, static_cast<double>(size), nullptr);
/* TODO: clean up */
if (ret == MSG_OK) {
sent = size;
} else if (ret == MSG_TIMEOUT) {
- sg_size_t remaining = (sg_size_t)MSG_task_get_remaining_communication(task);
+ sg_size_t remaining = static_cast<sg_size_t>(MSG_task_get_remaining_communication(task));
sent = size - remaining;
XBT_VERB("timeout (%lf s) in sending_migration_data, remaining %llu bytes of %llu", timeout, remaining, size);
}
/* FIXME: why try-and-catch is used here? */
if(ret == MSG_HOST_FAILURE){
- //XBT_DEBUG("SRC host failed during migration of %s (stage %d)", sg_host_name(vm), stage);
+ XBT_DEBUG("SRC host failed during migration of %s (stage %d)", vm->cname(), stage);
MSG_task_destroy(task);
THROWF(host_error, 0, "SRC host failed during migration of %s (stage %d)", vm->cname(), stage);
}else if(ret == MSG_TRANSFER_FAILURE){
- //XBT_DEBUG("DST host failed during migration of %s (stage %d)", sg_host_name(vm), stage);
+ XBT_DEBUG("DST host failed during migration of %s (stage %d)", vm->cname(), stage);
MSG_task_destroy(task);
THROWF(host_error, 0, "DST host failed during migration of %s (stage %d)", vm->cname(), stage);
}
updated_size = dp_cap;
}
- return (sg_size_t) updated_size;
+ return static_cast<sg_size_t>(updated_size);
}
static int migration_tx_fun(int argc, char *argv[])
XBT_DEBUG("mig: tx_start");
// Note that the ms structure has been allocated in do_migration and hence should be freed in the same function ;)
- migration_session *ms = (migration_session *) MSG_process_get_data(MSG_process_self());
+ migration_session *ms = static_cast<migration_session *>(MSG_process_get_data(MSG_process_self()));
s_vm_params_t params;
static_cast<simgrid::s4u::VirtualMachine*>(ms->vm)->parameters(¶ms);
double mig_timeout = 10000000.0;
- double remaining_size = (double) (ramsize + devsize);
+ double remaining_size = static_cast<double>(ramsize + devsize);
double threshold = 0.0;
/* check parameters */
try {
XBT_DEBUG("Stage 3: Gonna send %f", remaining_size);
- send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, (sg_size_t)remaining_size, ms->mbox, 3, 0, mig_speed, -1);
+ send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, static_cast<sg_size_t>(remaining_size), ms->mbox, 3, 0,
+ mig_speed, -1);
}
catch(xbt_ex& e) {
//hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
action_->suspend();
- smx_actor_t smx_process, smx_process_safe;
+ smx_actor_t smx_process;
+ smx_actor_t smx_process_safe;
xbt_swag_foreach_safe(smx_process, smx_process_safe, process_list) {
XBT_DEBUG("suspend %s", smx_process->name.c_str());
SIMIX_process_suspend(smx_process, issuer);
action_->resume();
- smx_actor_t smx_process, smx_process_safe;
+ smx_actor_t smx_process;
+ smx_actor_t smx_process_safe;
xbt_swag_foreach_safe(smx_process, smx_process_safe, process_list) {
XBT_DEBUG("resume %s", smx_process->cname());
SIMIX_process_resume(smx_process);
xbt_swag_t process_list = piface_->extension<simgrid::simix::Host>()->process_list;
XBT_DEBUG("shutdown VM %s, that contains %d processes", piface_->cname(), xbt_swag_size(process_list));
- smx_actor_t smx_process, smx_process_safe;
+ smx_actor_t smx_process;
+ smx_actor_t smx_process_safe;
xbt_swag_foreach_safe(smx_process, smx_process_safe, process_list) {
XBT_DEBUG("kill %s", smx_process->cname());
SIMIX_process_kill(smx_process, issuer);
double* flops_amount, double* bytes_amount, double amount, double rate,
double timeout)
{
- int i,j;
/* checking for infinite values */
- for (i = 0 ; i < host_nb ; ++i) {
+ for (int i = 0 ; i < host_nb ; ++i) {
xbt_assert(std::isfinite(flops_amount[i]), "flops_amount[%d] is not finite!", i);
if (bytes_amount != nullptr) {
- for (j = 0 ; j < host_nb ; ++j) {
+ for (int j = 0 ; j < host_nb ; ++j) {
xbt_assert(std::isfinite(bytes_amount[i + host_nb * j]),
"bytes_amount[%d+%d*%d] is not finite!", i, host_nb, j);
}
*/
void SIMIX_create_environment(const char *file)
{
- double start = 0, end = 0;
+ double start = 0;
+ double end = 0;
if(XBT_LOG_ISENABLED(simix_environment, xbt_log_priority_debug))
start = xbt_os_time();
try {
*/
static void install_segvhandler()
{
- stack_t stack, old_stack;
+ stack_t stack;
+ stack_t old_stack;
stack.ss_sp = sigsegv_stack;
stack.ss_size = sizeof sigsegv_stack;
stack.ss_flags = 0;
sigaltstack(&old_stack, nullptr);
}
- struct sigaction action, old_action;
+ struct sigaction action;
+ struct sigaction old_action;
action.sa_sigaction = &segvhandler;
action.sa_flags = SA_ONSTACK | SA_RESETHAND | SA_SIGINFO;
sigemptyset(&action.sa_mask);
*/
double CpuTiTgmr::integrate(double a, double b)
{
- double first_chunk;
- double middle_chunk;
- double last_chunk;
int a_index;
- int b_index;
if ((a < 0.0) || (a > b)) {
xbt_die("Error, invalid integration interval [%.2f,%.2f]. "
else
a_index = static_cast<int> (ceil(a / lastTime_));
- b_index = static_cast<int> (floor(b / lastTime_));
+ int b_index = static_cast<int> (floor(b / lastTime_));
if (a_index > b_index) { /* Same chunk */
return trace_->integrateSimple(a - (a_index - 1) * lastTime_, b - (b_index) * lastTime_);
}
- first_chunk = trace_->integrateSimple(a - (a_index - 1) * lastTime_, lastTime_);
- middle_chunk = (b_index - a_index) * total_;
- last_chunk = trace_->integrateSimple(0.0, b - (b_index) * lastTime_);
+ double first_chunk = trace_->integrateSimple(a - (a_index - 1) * lastTime_, lastTime_);
+ double middle_chunk = (b_index - a_index) * total_;
+ double last_chunk = trace_->integrateSimple(0.0, b - (b_index) * lastTime_);
XBT_DEBUG("first_chunk=%.2f middle_chunk=%.2f last_chunk=%.2f\n", first_chunk, middle_chunk, last_chunk);
double CpuTiTrace::integrateSimplePoint(double a)
{
double integral = 0;
- int ind;
double a_aux = a;
- ind = binarySearch(timePoints_, a, 0, nbPoints_ - 1);
+ int ind = binarySearch(timePoints_, a, 0, nbPoints_ - 1);
integral += integral_[ind];
+
XBT_DEBUG("a %f ind %d integral %f ind + 1 %f ind %f time +1 %f time %f",
a, ind, integral, integral_[ind + 1], integral_[ind], timePoints_[ind + 1], timePoints_[ind]);
double_update(&a_aux, timePoints_[ind], sg_maxmin_precision*sg_surf_precision);