Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define simgrid::xbt::Path to manage file names.
[simgrid.git] / src / msg / msg_vm.cpp
index cf9f09f..00ea1e8 100644 (file)
@@ -171,7 +171,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 +185,10 @@ 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);
+    container_t vm_container    = simgrid::instr::Container::byName(vm->getName());
+    simgrid::instr::Type* state = vm_container->type_->byName("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"));
   }
 }
 
@@ -289,27 +289,25 @@ 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");
+    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);
 
     // 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");
+    type = simgrid::instr::Type::getRootType()->byName("MSG_VM_LINK");
     new simgrid::instr::EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
   }
 
@@ -768,10 +766,10 @@ 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);
+    container_t vm_container    = simgrid::instr::Container::byName(vm->getName());
+    simgrid::instr::Type* state = vm_container->type_->byName("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"));
   }
 }
 
@@ -786,7 +784,7 @@ void MSG_vm_resume(msg_vm_t vm)
 
   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::Type* type = vm_container->type_->byName("MSG_VM_STATE");
     new simgrid::instr::PopStateEvent(MSG_get_clock(), vm_container, type);
   }
 }