Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify link events and rename getRootContainer to getRoot
[simgrid.git] / src / msg / msg_vm.cpp
index 00ea1e8..ba6cbec 100644 (file)
@@ -185,10 +185,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* state = vm_container->type_->byName("MSG_VM_STATE");
+    simgrid::instr::StateType* state = simgrid::instr::Container::byName(vm->getName())->getState("MSG_VM_STATE");
     state->addEntityValue("start", "0 0 1"); // start is blue
-    new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, state, state->getEntityValue("start"));
+    state->pushEvent("start");
   }
 }
 
@@ -293,9 +292,8 @@ static int migration_rx_fun(int argc, char *argv[])
     counter++;
 
     // start link
-    container_t msg            = simgrid::instr::Container::byName(vm->getName());
-    simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName("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());
@@ -307,8 +305,7 @@ static int migration_rx_fun(int argc, char *argv[])
 
     // end link
     msg  = simgrid::instr::Container::byName(vm->getName());
-    type = simgrid::instr::Type::getRootType()->byName("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
@@ -766,10 +763,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* state = vm_container->type_->byName("MSG_VM_STATE");
+    simgrid::instr::StateType* state = simgrid::instr::Container::byName(vm->getName())->getState("MSG_VM_STATE");
     state->addEntityValue("suspend", "1 0 0"); // suspend is red
-    new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, state, state->getEntityValue("suspend"));
+    state->pushEvent("suspend");
   }
 }
 
@@ -782,11 +778,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_->byName("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.