Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix conflict - Adrien
[simgrid.git] / src / msg / msg_vm.c
index be8e935..71a614d 100644 (file)
@@ -157,11 +157,9 @@ void MSG_vm_shutdown(msg_vm_t vm)
   /* msg_vm_t equals to msg_host_t */
   simcall_vm_shutdown(vm);
 
-  /* taka: not yet confirmed */
-  #ifdef HAVE_TRACING
-  TRACE_msg_vm_kill(vm);
-  #endif
-
+  // #ifdef HAVE_TRACING
+  // TRACE_msg_vm_(vm);
+  // #endif
 }
 
 
@@ -223,25 +221,31 @@ void MSG_vm_shutdown(msg_vm_t vm)
 //  vm->location = destination;
 //}
 //
-///** @brief Immediately suspend the execution of all processes within the given VM.
-// *  @ingroup msg_VMs
-// *
-// * No suspension cost occurs. If you want to simulate this too, you want to
-// * use a \ref MSG_file_write() before or after, depending on the exact semantic
-// * of VM suspend to you.
-// */
-//void MSG_vm_suspend(msg_vm_t vm) {
-//  unsigned int cpt;
-//  msg_process_t process;
-//  xbt_dynar_foreach(vm->processes,cpt,process) {
-//    XBT_DEBUG("suspend process %s of host %s",MSG_process_get_name(process),MSG_host_get_name(MSG_process_get_host(process)));
-//    MSG_process_suspend(process);
-//  }
-//
-//  #ifdef HAVE_TRACING
-//  TRACE_msg_vm_suspend(vm);
-//  #endif
-//}
+
+/** @brief Immediately suspend the execution of all processes within the given VM.
+ *  @ingroup msg_VMs
+ *
+ * No suspension cost occurs. If you want to simulate this too, you want to
+ * use a \ref MSG_file_write() before or after, depending on the exact semantic
+ * of VM suspend to you.
+ */
+void MSG_vm_suspend(msg_vm_t vm)
+{
+  simcall_vm_suspend(vm);
+
+  #ifdef HAVE_TRACING
+  TRACE_msg_vm_suspend(vm);
+  #endif
+#if 0
+  unsigned int cpt;
+  msg_process_t process;
+  xbt_dynar_foreach(vm->processes,cpt,process) {
+    XBT_DEBUG("suspend process %s of host %s",MSG_process_get_name(process),MSG_host_get_name(MSG_process_get_host(process)));
+    MSG_process_suspend(process);
+  }
+#endif
+}
+
 //
 //
 ///** @brief Immediately resumes the execution of all processes within the given VM.
@@ -289,28 +293,32 @@ void MSG_vm_shutdown(msg_vm_t vm)
 //  xbt_dynar_free(&new_processes);
 //}
 //
-///** @brief Destroy a msg_vm_t.
-// *  @ingroup msg_VMs
-// */
-//void MSG_vm_destroy(msg_vm_t vm)
-//{
-//  simcall_vm_destroy(vm);
-//
-//#if 0
-//  unsigned int cpt;
-//  msg_process_t process;
-//  xbt_dynar_foreach(vm->processes,cpt,process) {
-//    //FIXME: Slow ?
-//    simdata_process_t simdata = simcall_process_get_data(process);
-//    simdata->vm = NULL;
-//  }
-//
-//  #ifdef HAVE_TRACING
-//  TRACE_msg_vm_end(vm);
-//  #endif
-//
-//
-//  xbt_dynar_free(&vm->processes);
-//  xbt_free(vm);
-//#endif
-//}
+
+/** @brief Destroy a VM. Destroy the VM object from the simulation.
+ *  @ingroup msg_VMs
+ */
+void MSG_vm_destroy(msg_vm_t vm)
+{
+  /* First, terminate all processes on the VM */
+  simcall_vm_shutdown(vm);
+
+  /* Then, destroy the VM object */
+  simcall_vm_destroy(vm);
+
+  #ifdef HAVE_TRACING
+  TRACE_msg_vm_end(vm);
+  #endif
+
+#if 0
+  unsigned int cpt;
+  msg_process_t process;
+  xbt_dynar_foreach(vm->processes,cpt,process) {
+    //FIXME: Slow ?
+    simdata_process_t simdata = simcall_process_get_data(process);
+    simdata->vm = NULL;
+  }
+
+  xbt_dynar_free(&vm->processes);
+  xbt_free(vm);
+#endif
+}