#include "simgrid/s4u/Actor.hpp"
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
+#include "simgrid/s4u/VirtualMachine.hpp"
#include "src/surf/network_interface.hpp"
#include "src/surf/xml/platf_private.hpp"
#include "surf/surf.hpp"
root->type_->getOrCreateLinkType("MIGRATE_LINK", mpi, mpi);
mpi->getOrCreateStateType("MIGRATE_STATE");
}
-
- if (TRACE_vm_is_enabled()) {
- simgrid::instr::ContainerType* msg_vm = container->type_->getOrCreateContainerType("MSG_VM");
- simgrid::instr::StateType* state = msg_vm->getOrCreateStateType("MSG_VM_STATE");
- state->addEntityValue("suspend", "1 0 1");
- state->addEntityValue("sleep", "1 1 0");
- state->addEntityValue("receive", "1 0 0");
- state->addEntityValue("send", "0 0 1");
- state->addEntityValue("task_execute", "0 1 1");
- root->type_->getOrCreateLinkType("MSG_VM_LINK", msg_vm, msg_vm);
- root->type_->getOrCreateLinkType("MSG_VM_ACTOR_LINK", msg_vm, msg_vm);
- }
}
static void instr_netpoint_on_creation(simgrid::kernel::routing::NetPoint* netpoint)
counter++;
}
+static void instr_vm_on_creation(simgrid::s4u::Host& host)
+{
+ container_t container = new simgrid::instr::HostContainer(host, currentContainer.back());
+ container_t root = simgrid::instr::Container::getRoot();
+ simgrid::instr::ContainerType* msg_vm = container->type_->getOrCreateContainerType("VM");
+ simgrid::instr::StateType* state = msg_vm->getOrCreateStateType("VM_STATE");
+ state->addEntityValue("suspend", "1 0 1");
+ state->addEntityValue("sleep", "1 1 0");
+ state->addEntityValue("receive", "1 0 0");
+ state->addEntityValue("send", "0 0 1");
+ state->addEntityValue("task_execute", "0 1 1");
+ root->type_->getOrCreateLinkType("VM_LINK", msg_vm, msg_vm);
+ root->type_->getOrCreateLinkType("VM_ACTOR_LINK", msg_vm, msg_vm);
+}
+
+static void instr_vm_on_start(simgrid::s4u::VirtualMachine& vm)
+{
+ simgrid::instr::Container::byName(vm.get_name())->getState("VM_STATE")->pushEvent("start");
+}
+
+static void instr_vm_on_started(simgrid::s4u::VirtualMachine& vm)
+{
+ simgrid::instr::Container::byName(vm.get_name())->getState("VM_STATE")->popEvent();
+}
+
+static void instr_vm_on_suspend(simgrid::s4u::VirtualMachine& vm)
+{
+ simgrid::instr::Container::byName(vm.get_name())->getState("VM_STATE")->pushEvent("suspend");
+}
+
+static void instr_vm_on_resume(simgrid::s4u::VirtualMachine& vm)
+{
+ simgrid::instr::Container::byName(vm.get_name())->getState("VM_STATE")->popEvent();
+}
+
+static void instr_vm_on_destruction(simgrid::s4u::Host& host)
+{
+ simgrid::instr::Container::byName(host.get_name())->removeFromParent();
+}
+
void instr_define_callbacks()
{
// always need the callbacks to zones (we need only the root zone), to create the rootContainer and the rootType
simgrid::s4u::Actor::on_migration_start.connect(instr_actor_on_migration_start);
simgrid::s4u::Actor::on_migration_end.connect(instr_actor_on_migration_end);
}
+
+ if (TRACE_vm_is_enabled()) {
+ simgrid::s4u::Host::onCreation.connect(instr_vm_on_creation);
+ simgrid::s4u::VirtualMachine::on_start.connect(instr_vm_on_start);
+ simgrid::s4u::VirtualMachine::on_started.connect(instr_vm_on_started);
+ simgrid::s4u::VirtualMachine::on_suspend.connect(instr_vm_on_suspend);
+ simgrid::s4u::VirtualMachine::on_resume.connect(instr_vm_on_resume);
+ simgrid::s4u::Host::onDestruction.connect(instr_vm_on_destruction);
+ }
}
/*
* user categories support
*/
static void recursiveNewVariableType(std::string new_typename, std::string color, simgrid::instr::Type* root)
{
- if (root->get_name() == "HOST" || root->get_name() == "MSG_VM")
+ if (root->get_name() == "HOST" || root->get_name() == "VM")
root->getOrCreateVariableType(std::string("p") + new_typename, color);
if (root->get_name() == "LINK")