-/* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2013-2020. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
static void add_active_exec(s4u::Actor const&, s4u::Exec const& task)
{
- s4u::VirtualMachine* vm = dynamic_cast<s4u::VirtualMachine*>(task.get_host());
+ const s4u::VirtualMachine* vm = dynamic_cast<s4u::VirtualMachine*>(task.get_host());
if (vm != nullptr) {
VirtualMachineImpl* vm_impl = vm->get_impl();
vm_impl->active_tasks_ = vm_impl->active_tasks_ + 1;
static void remove_active_exec(s4u::Actor const&, s4u::Exec const& task)
{
- s4u::VirtualMachine* vm = dynamic_cast<s4u::VirtualMachine*>(task.get_host());
+ const s4u::VirtualMachine* vm = dynamic_cast<s4u::VirtualMachine*>(task.get_host());
if (vm != nullptr) {
VirtualMachineImpl* vm_impl = vm->get_impl();
vm_impl->active_tasks_ = vm_impl->active_tasks_ - 1;
static void add_active_activity(kernel::activity::ActivityImpl const& act)
{
- s4u::VirtualMachine* vm = get_vm_from_activity(act);
+ const s4u::VirtualMachine* vm = get_vm_from_activity(act);
if (vm != nullptr) {
VirtualMachineImpl *vm_impl = vm->get_impl();
vm_impl->active_tasks_ = vm_impl->active_tasks_ + 1;
static void remove_active_activity(kernel::activity::ActivityImpl const& act)
{
- s4u::VirtualMachine* vm = get_vm_from_activity(act);
+ const s4u::VirtualMachine* vm = get_vm_from_activity(act);
if (vm != nullptr) {
VirtualMachineImpl *vm_impl = vm->get_impl();
vm_impl->active_tasks_ = vm_impl->active_tasks_ - 1;
/* iterate for all virtual machines */
for (s4u::VirtualMachine* const& ws_vm : VirtualMachineImpl::allVms_) {
- kernel::resource::Cpu* cpu = ws_vm->pimpl_cpu;
+ const kernel::resource::Cpu* cpu = ws_vm->pimpl_cpu;
double solved_value =
ws_vm->get_impl()->action_->get_variable()->get_value(); // this is X1 in comment above, what
VirtualMachineImpl::VirtualMachineImpl(simgrid::s4u::VirtualMachine* piface, simgrid::s4u::Host* host_PM,
int core_amount, size_t ramsize)
- : HostImpl(piface), physical_host_(host_PM), core_amount_(core_amount), user_bound_(std::numeric_limits<double>::max()), ramsize_(ramsize)
+ : HostImpl(piface), physical_host_(host_PM), core_amount_(core_amount), ramsize_(ramsize)
{
/* Register this VM to the list of all VMs */
allVms_.push_back(piface);
action_->suspend();
- for (auto& actor : get_all_actors()) {
- XBT_DEBUG("suspend %s", actor->get_cname());
- actor->suspend();
+ for (auto& actor : actor_list_) {
+ XBT_DEBUG("suspend %s", actor.get_cname());
+ actor.suspend();
}
XBT_DEBUG("suspend all actors on the VM done done");
action_->resume();
- for (auto& actor : get_all_actors()) {
- XBT_DEBUG("resume %s", actor->get_cname());
- actor->resume();
+ for (auto& actor : actor_list_) {
+ XBT_DEBUG("resume %s", actor.get_cname());
+ actor.resume();
}
vm_state_ = s4u::VirtualMachine::state::RUNNING;
XBT_DEBUG("shutdown VM %s, that contains %zu actors", piface_->get_cname(), get_actor_count());
- for (auto& actor : get_all_actors()) {
- XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", actor->get_cname(), actor->get_host()->get_cname(),
+ for (auto& actor : actor_list_) {
+ XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", actor.get_cname(), actor.get_host()->get_cname(),
issuer->get_cname());
- issuer->kill(actor->get_impl());
+ issuer->kill(&actor);
}
set_state(s4u::VirtualMachine::state::DESTROYED);