X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bfb1e611d8d12a8d6b3611449c067ee0a39893ec..10420d9401da7efa11b764267dff07a0f24bf978:/src/msg/msg_vm.cpp diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index cf9f09fecd..8826c7e4bd 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -114,12 +114,14 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char* name, int coreAmount, int rams msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount); s_vm_params_t params; - memset(¶ms, 0, sizeof(params)); - params.ramsize = static_cast(ramsize) * 1024 * 1024; - params.devsize = 0; - params.skip_stage2 = 0; + params.ncpus = 0; + params.ramsize = static_cast(ramsize) * 1024 * 1024; + params.overcommit = 0; + params.devsize = 0; + params.skip_stage1 = 0; + params.skip_stage2 = 0; params.max_downtime = 0.03; - params.mig_speed = static_cast(mig_netspeed) * 1024 * 1024; // mig_speed + params.mig_speed = static_cast(mig_netspeed) * 1024 * 1024; // mig_speed params.dp_intensity = static_cast(dp_intensity) / 100; params.dp_cap = params.ramsize * 0.9; // assume working set memory is 90% of ramsize @@ -171,7 +173,7 @@ void MSG_vm_destroy(msg_vm_t vm) if (TRACE_msg_vm_is_enabled()) { container_t container = simgrid::instr::Container::byName(vm->getName()); - PJ_container_remove_from_parent(container); + container->removeFromParent(); delete container; } } @@ -185,10 +187,9 @@ void MSG_vm_start(msg_vm_t vm) { vm->start(); if (TRACE_msg_vm_is_enabled()) { - container_t vm_container = simgrid::instr::Container::byName(vm->getName()); - simgrid::instr::Type* type = vm_container->type_->getChild("MSG_VM_STATE"); - simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate("start", "0 0 1", type); // start is blue - new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, type, val); + simgrid::instr::StateType* state = simgrid::instr::Container::byName(vm->getName())->getState("MSG_VM_STATE"); + state->addEntityValue("start", "0 0 1"); // start is blue + state->pushEvent("start"); } } @@ -289,28 +290,24 @@ static int migration_rx_fun(int argc, char *argv[]) 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); + std::string key = std::to_string(counter); counter++; // start link - container_t msg = simgrid::instr::Container::byName(vm->getName()); - simgrid::instr::Type* type = PJ_type_get_root()->getChild("MSG_VM_LINK"); - new simgrid::instr::StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); + container_t msg = simgrid::instr::Container::byName(vm->getName()); + simgrid::instr::Container::getRoot()->getLink("MSG_VM_LINK")->startEvent(msg, "M", key); // destroy existing container of this vm container_t existing_container = simgrid::instr::Container::byName(vm->getName()); - PJ_container_remove_from_parent(existing_container); + existing_container->removeFromParent(); delete existing_container; // create new container on the new_host location - new simgrid::instr::Container(vm->getCname(), simgrid::instr::INSTR_MSG_VM, - simgrid::instr::Container::byName(ms->dst_pm->getName())); + new simgrid::instr::Container(vm->getCname(), "MSG_VM", simgrid::instr::Container::byName(ms->dst_pm->getName())); // end link msg = simgrid::instr::Container::byName(vm->getName()); - type = PJ_type_get_root()->getChild("MSG_VM_LINK"); - new simgrid::instr::EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); + simgrid::instr::Container::getRoot()->getLink("MSG_VM_LINK")->endEvent(msg, "M", key); } // Inform the SRC that the migration has been correctly performed @@ -339,7 +336,7 @@ static void start_dirty_page_tracking(msg_vm_t vm) for (auto const& elm : vm->pimpl_vm_->dp_objs) { dirty_page_t dp = elm.second; - double remaining = MSG_task_get_flops_amount(dp->task); + double remaining = MSG_task_get_remaining_work_ratio(dp->task); dp->prev_clock = MSG_get_clock(); dp->prev_remaining = remaining; XBT_DEBUG("%s@%s remaining %f", elm.first.c_str(), vm->getCname(), remaining); @@ -768,10 +765,9 @@ void MSG_vm_suspend(msg_vm_t vm) XBT_DEBUG("vm_suspend done"); if (TRACE_msg_vm_is_enabled()) { - container_t vm_container = simgrid::instr::Container::byName(vm->getName()); - simgrid::instr::Type* type = vm_container->type_->getChild("MSG_VM_STATE"); - simgrid::instr::Value* val = simgrid::instr::Value::byNameOrCreate("suspend", "1 0 0", type); // suspend is red - new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, type, val); + simgrid::instr::StateType* state = simgrid::instr::Container::byName(vm->getName())->getState("MSG_VM_STATE"); + state->addEntityValue("suspend", "1 0 0"); // suspend is red + state->pushEvent("suspend"); } } @@ -784,11 +780,8 @@ void MSG_vm_resume(msg_vm_t vm) { vm->pimpl_vm_->resume(); - if (TRACE_msg_vm_is_enabled()) { - container_t vm_container = simgrid::instr::Container::byName(vm->getName()); - simgrid::instr::Type* type = vm_container->type_->getChild("MSG_VM_STATE"); - new simgrid::instr::PopStateEvent(MSG_get_clock(), vm_container, type); - } + if (TRACE_msg_vm_is_enabled()) + simgrid::instr::Container::byName(vm->getName())->getState("MSG_VM_STATE")->popEvent(); } /** @brief Get the physical host of a given VM.