Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
start to split msg.h into pieces
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 20 Mar 2018 13:36:28 +0000 (14:36 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 20 Mar 2018 13:36:28 +0000 (14:36 +0100)
include/simgrid/msg.h
include/simgrid/vm.h [new file with mode: 0644]
src/plugins/vm/VmLiveMigration.cpp
src/plugins/vm/s4u_VirtualMachine.cpp
tools/cmake/DefinePackages.cmake

index 8744e26..3a42609 100644 (file)
@@ -10,6 +10,7 @@
 #include <simgrid/host.h>
 #include <simgrid/instr.h>
 #include <simgrid/plugins/live_migration.h>
+#include <simgrid/vm.h>
 #include <xbt/base.h>
 #include <xbt/dict.h>
 #include <xbt/dynar.h>
@@ -72,6 +73,28 @@ typedef struct msg_task *msg_task_t;
 /* ******************************** VM ************************************* */
 typedef sg_vm_t msg_vm_t;
 
+#define MSG_vm_create_core(vm, name) sg_vm_create_core(vm, name)
+#define MSG_vm_create_multicore(vm, name, coreAmount) sg_vm_create_multicore(vm, name, coreAmount)
+XBT_ATTRIB_DEPRECATED_v322("Use sg_vm_create_migratable() from the live migration plugin: "
+                           "v3.22 will drop MSG_vm_create() completely.") XBT_PUBLIC sg_vm_t
+    MSG_vm_create(sg_host_t ind_pm, const char* name, int coreAmount, int ramsize, int mig_netspeed, int dp_intensity);
+
+#define MSG_vm_is_created(vm) sg_vm_is_created(vm)
+#define MSG_vm_is_running(vm) sg_vm_is_running(vm)
+#define MSG_vm_is_suspended(vm) sg_vm_is_suspended(vm)
+
+#define MSG_vm_get_name(vm) sg_vm_get_name(vm)
+#define MSG_vm_set_ramsize(vm, size) sg_vm_set_ramsize(vm, size)
+#define MSG_vm_get_ramsize(vm) sg_vm_get_ramsize(vm)
+#define MSG_vm_set_bound(vm, bound) sg_vm_set_bound(vm, bound)
+#define MSG_vm_get_pm(vm) sg_vm_get_pm(vm)
+
+#define MSG_vm_start(vm) sg_vm_start(vm)
+#define MSG_vm_suspend(vm) sg_vm_suspend(vm)
+#define MSG_vm_resume(vm) sg_vm_resume(vm)
+#define MSG_vm_shutdown(vm) sg_vm_shutdown(vm)
+#define MSG_vm_destroy(vm) sg_vm_destroy(vm)
+
 /* ******************************** File ************************************ */
 typedef sg_file_t msg_file_t;
 
@@ -369,53 +392,6 @@ XBT_PUBLIC msg_bar_t MSG_barrier_init(unsigned int count);
 XBT_PUBLIC void MSG_barrier_destroy(msg_bar_t bar);
 XBT_PUBLIC int MSG_barrier_wait(msg_bar_t bar);
 
-/** @brief Opaque type describing a Virtual Machine.
- *  @ingroup msg_VMs
- *
- * All this is highly experimental and the interface will probably change in the future.
- * Please don't depend on this yet (although testing is welcomed if you feel so).
- * Usual lack of guaranty of any kind applies here, and is even increased.
- *
- */
-
-XBT_PUBLIC int sg_vm_is_created(sg_vm_t vm);
-#define MSG_vm_is_created(vm) sg_vm_is_created(vm)
-XBT_PUBLIC int sg_vm_is_running(sg_vm_t vm);
-#define MSG_vm_is_running(vm) sg_vm_is_running(vm)
-XBT_PUBLIC int sg_vm_is_suspended(sg_vm_t vm);
-#define MSG_vm_is_suspended(vm) sg_vm_is_suspended(vm)
-
-XBT_PUBLIC const char* sg_vm_get_name(sg_vm_t vm);
-#define MSG_vm_get_name(vm) sg_vm_get_name(vm)
-XBT_PUBLIC void sg_vm_set_ramsize(sg_vm_t vm, size_t size);
-#define MSG_vm_set_ramsize(vm, size) sg_vm_set_ramsize(vm, size)
-XBT_PUBLIC size_t sg_vm_get_ramsize(sg_vm_t vm);
-#define MSG_vm_get_ramsize(vm) sg_vm_get_ramsize(vm)
-
-XBT_PUBLIC sg_vm_t sg_vm_create_core(sg_host_t pm, const char* name);
-#define MSG_vm_create_core(vm, name) sg_vm_create_core(vm, name)
-XBT_PUBLIC sg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount);
-#define MSG_vm_create_multicore(vm, name, coreAmount) sg_vm_create_multicore(vm, name, coreAmount)
-
-XBT_ATTRIB_DEPRECATED_v322("Use sg_vm_create_migratable() from the live migration plugin: "
-                           "v3.22 will drop MSG_vm_create() completely.") XBT_PUBLIC msg_vm_t
-    MSG_vm_create(msg_host_t ind_pm, const char* name, int coreAmount, int ramsize, int mig_netspeed, int dp_intensity);
-
-XBT_PUBLIC void sg_vm_start(msg_vm_t vm);
-#define MSG_vm_start(vm) sg_vm_start(vm)
-XBT_PUBLIC void sg_vm_suspend(msg_vm_t vm);
-#define MSG_vm_suspend(vm) sg_vm_suspend(vm)
-XBT_PUBLIC void sg_vm_resume(msg_vm_t vm);
-#define MSG_vm_resume(vm) sg_vm_resume(vm)
-XBT_PUBLIC void sg_vm_shutdown(msg_vm_t vm);
-#define MSG_vm_shutdown(vm) sg_vm_shutdown(vm)
-XBT_PUBLIC void sg_vm_destroy(msg_vm_t vm);
-#define MSG_vm_destroy(vm) sg_vm_destroy(vm)
-XBT_PUBLIC sg_host_t sg_vm_get_pm(sg_vm_t vm);
-#define MSG_vm_get_pm(vm) sg_vm_get_pm(vm)
-XBT_PUBLIC void sg_vm_set_bound(sg_vm_t vm, double bound);
-#define MSG_vm_set_bound(vm, bound) sg_vm_set_bound(vm, bound)
-
 /* ****************************************************************************************** */
 /* Used only by the bindings -- unclean pimple, please ignore if you're not writing a binding */
 XBT_PUBLIC smx_context_t MSG_process_get_smx_ctx(msg_process_t process);
diff --git a/include/simgrid/vm.h b/include/simgrid/vm.h
new file mode 100644 (file)
index 0000000..84478b5
--- /dev/null
@@ -0,0 +1,46 @@
+/* Public interface to the Link datatype                                    */
+
+/* Copyright (c) 2018. 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. */
+
+#ifndef INCLUDE_SIMGRID_VM_H_
+#define INCLUDE_SIMGRID_VM_H_
+
+#include <simgrid/forward.h>
+#include <xbt/base.h>
+
+/* C interface */
+SG_BEGIN_DECL()
+
+/** @brief Opaque type describing a Virtual Machine.
+ *  @ingroup msg_VMs
+ *
+ * All this is highly experimental and the interface will probably change in the future.
+ * Please don't depend on this yet (although testing is welcomed if you feel so).
+ * Usual lack of guaranty of any kind applies here, and is even increased.
+ *
+ */
+
+XBT_PUBLIC int sg_vm_is_created(sg_vm_t vm);
+XBT_PUBLIC int sg_vm_is_running(sg_vm_t vm);
+XBT_PUBLIC int sg_vm_is_suspended(sg_vm_t vm);
+
+XBT_PUBLIC const char* sg_vm_get_name(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_set_ramsize(sg_vm_t vm, size_t size);
+XBT_PUBLIC size_t sg_vm_get_ramsize(sg_vm_t vm);
+
+XBT_PUBLIC sg_vm_t sg_vm_create_core(sg_host_t pm, const char* name);
+XBT_PUBLIC sg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount);
+
+XBT_PUBLIC void sg_vm_start(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_suspend(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_resume(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_shutdown(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_destroy(sg_vm_t vm);
+XBT_PUBLIC sg_host_t sg_vm_get_pm(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_set_bound(sg_vm_t vm, double bound);
+SG_END_DECL()
+
+#endif /* INCLUDE_SIMGRID_VM_H_ */
index e890dd4..baae906 100644 (file)
@@ -6,6 +6,7 @@
 #include <simgrid/plugins/live_migration.h>
 #include <simgrid/s4u.hpp>
 #include <simgrid/s4u/VirtualMachine.hpp>
+#include <simgrid/vm.h>
 #include <src/instr/instr_private.hpp>
 #include <src/plugins/vm/VirtualMachineImpl.hpp>
 #include <src/plugins/vm/VmHostExt.hpp>
@@ -321,7 +322,7 @@ simgrid::s4u::VirtualMachine* sg_vm_create_migratable(simgrid::s4u::Host* pm, co
 
   /* For the moment, intensity_rate is the percentage against the migration bandwidth */
 
-  msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount, static_cast<sg_size_t>(ramsize) * 1024 * 1024);
+  sg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount, static_cast<sg_size_t>(ramsize) * 1024 * 1024);
   sg_vm_set_dirty_page_intensity(vm, dp_intensity / 100.0);
   sg_vm_set_working_set_memory(vm, vm->getRamsize() * 0.9); // assume working set memory is 90% of ramsize
   sg_vm_set_migration_speed(vm, mig_netspeed * 1024 * 1024.0);
index ef0d95c..acc61c3 100644 (file)
@@ -9,6 +9,7 @@
 #include "src/plugins/vm/VmHostExt.hpp"
 #include "src/simix/smx_host_private.hpp"
 #include "src/surf/cpu_cas01.hpp"
+#include <simgrid/vm.h>
 #include <src/plugins/vm/VmLiveMigration.hpp>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_vm, "S4U virtual machines");
@@ -206,14 +207,14 @@ SG_BEGIN_DECL()
 /** @brief Create a new VM object with the default parameters
  * A VM is treated as a host. The name of the VM must be unique among all hosts.
  */
-msg_vm_t sg_vm_create_core(sg_host_t pm, const char* name)
+sg_vm_t sg_vm_create_core(sg_host_t pm, const char* name)
 {
   return sg_vm_create_multicore(pm, name, 1);
 }
 /** @brief Create a new VM object with the default parameters, but with a specified amount of cores
  * A VM is treated as a host. The name of the VM must be unique among all hosts.
  */
-msg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount)
+sg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount)
 {
   xbt_assert(sg_host_by_name(name) == nullptr,
              "Cannot create a VM named %s: this name is already used by an host or a VM", name);
index 0f7325b..7725339 100644 (file)
@@ -675,6 +675,7 @@ set(headers_to_install
   include/simgrid/kernel/future.hpp
   include/simgrid/host.h
   include/simgrid/link.h
+  include/simgrid/vm.h
   include/simgrid/s4u/forward.hpp
   include/simgrid/s4u/Activity.hpp
   include/simgrid/s4u/Actor.hpp