Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move back MSG_host_* macros to msg.h
[simgrid.git] / include / simgrid / msg.h
index 1199057..2cfefb7 100644 (file)
@@ -3,20 +3,21 @@
 /* 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 MSG_H
-#define MSG_H
-
-#include "simgrid/forward.h"
-#include "simgrid/host.h"
-#include "simgrid/plugins/live_migration.h"
-
-#include "xbt/base.h"
-#include "xbt/dict.h"
-#include "xbt/dynar.h"
+#ifndef SIMGRID_MSG_H
+#define SIMGRID_MSG_H
+
+#include <simgrid/forward.h>
+#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>
 
 #ifdef __cplusplus
-#include "simgrid/simix.h"
 #include <map>
+#include <simgrid/simix.h>
 namespace simgrid {
 namespace msg {
 class Comm;
@@ -31,24 +32,40 @@ SG_BEGIN_DECL()
 
 /* *************************** Network Zones ******************************** */
 #define msg_as_t msg_netzone_t /* portability macro */
-typedef s4u_NetZone* msg_netzone_t;
+typedef sg_netzone_t msg_netzone_t;
 
 /* ******************************** Host ************************************ */
 
-/** @brief Host datatype.
-    @ingroup m_host_management
-
-    A <em>location</em> (or <em>host</em>) is any possible place where
-    a process may run. Thus it is represented as a <em>physical
-    resource with computing capabilities</em>, some <em>mailboxes</em>
-    to enable running process to communicate with remote ones, and
-    some <em>private data</em> that can be only accessed by local
-    process.
- */
 typedef sg_host_t msg_host_t;
 
-
-XBT_PUBLIC_DATA(int) sg_storage_max_file_descriptors;
+#define MSG_get_host_number() sg_host_count()
+#define MSG_get_host_by_name(n) sg_host_by_name(n) /* Rewrite the old name into the new one transparently */
+
+#define MSG_hosts_as_dynar() sg_hosts_as_dynar()
+
+#define MSG_host_by_name(name) sg_host_by_name(name)
+#define MSG_host_get_name(host) sg_host_get_name(host)
+#define MSG_host_get_data(host) sg_host_user(host)
+#define MSG_host_set_data(host, data) sg_host_user_set(host, data)
+#define MSG_host_get_mounted_storage_list(host) sg_host_get_mounted_storage_list(host)
+#define MSG_host_get_attached_storage_list(host) host_get_attached_storage_list(host)
+#define MSG_host_get_speed(host) sg_host_speed(host)
+#define MSG_host_get_power_peak_at(host, pstate_index) sg_host_get_pstate_speed(host, pstate_index)
+#define MSG_host_get_core_number(host) sg_host_core_count(host)
+#define MSG_host_self() sg_host_self()
+#define MSG_host_get_nb_pstates(host) sg_host_get_nb_pstates(host)
+#define MSG_host_get_pstate(h) sg_host_get_pstate(h)
+#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate)
+#define MSG_host_on(h) sg_host_turn_on(h)
+#define MSG_host_off(h) sg_host_turn_off(h)
+#define MSG_host_is_on(h) sg_host_is_on(h)
+#define MSG_host_is_off(h) sg_host_is_off(h)
+#define MSG_host_get_properties(host) sg_host_get_properties(host)
+#define MSG_host_get_property_value(host, name) sg_host_get_property_value(host, name)
+#define MSG_host_set_property_value(host, name, value) sg_host_set_property_value(host, name, value)
+#define MSG_host_get_process_list(host, whereto) sg_host_get_actor_list(host, whereto)
+
+XBT_PUBLIC_DATA int sg_storage_max_file_descriptors;
 /* ******************************** Task ************************************ */
 
 typedef struct s_simdata_task_t* simdata_task_t;
@@ -73,6 +90,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;
 
@@ -158,13 +197,20 @@ XBT_PUBLIC double MSG_get_clock();
 XBT_PUBLIC unsigned long int MSG_get_sent_msg();
 
 /************************** Net Zones ***********************************/
-XBT_PUBLIC msg_netzone_t MSG_zone_get_root();
-XBT_PUBLIC const char* MSG_zone_get_name(msg_netzone_t zone);
-XBT_PUBLIC msg_netzone_t MSG_zone_get_by_name(const char* name);
-XBT_PUBLIC void MSG_zone_get_sons(msg_netzone_t zone, xbt_dict_t whereto);
-XBT_PUBLIC const char* MSG_zone_get_property_value(msg_netzone_t as, const char* name);
-XBT_PUBLIC void MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value);
-XBT_PUBLIC void MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto);
+XBT_PUBLIC sg_netzone_t sg_zone_get_root();
+#define MSG_zone_get_root() sg_zone_get_root()
+XBT_PUBLIC const char* sg_zone_get_name(sg_netzone_t zone);
+#define MSG_zone_get_name(zone) sg_zone_get_name(zone)
+XBT_PUBLIC sg_netzone_t sg_zone_get_by_name(const char* name);
+#define MSG_zone_get_by_name(name) sg_zone_get_by_name(name)
+XBT_PUBLIC void sg_zone_get_sons(sg_netzone_t zone, xbt_dict_t whereto);
+#define MSG_zone_get_sons(zone, whereto) sg_zone_get_sons(zone, whereto)
+XBT_PUBLIC const char* sg_zone_get_property_value(sg_netzone_t as, const char* name);
+#define MSG_zone_get_property_value(zone, name) sg_zone_get_property_value(zone, name)
+XBT_PUBLIC void sg_zone_set_property_value(sg_netzone_t netzone, const char* name, char* value);
+#define MSG_zone_set_property_value(zone, name, value) sg_zone_set_property_value(zone, name, value)
+XBT_PUBLIC void sg_zone_get_hosts(sg_netzone_t zone, xbt_dynar_t whereto);
+#define MSG_zone_get_hosts(zone, whereto) sg_zone_get_hosts(zone, whereto)
 
 /************************** Storage handling ***********************************/
 XBT_PUBLIC const char* sg_storage_get_name(sg_storage_t storage);
@@ -191,16 +237,12 @@ XBT_PUBLIC sg_size_t sg_storage_write(sg_storage_t storage, sg_size_t size);
 #define MSG_storage_write(storage, size) sg_storage_write(storage, size)
 
 /************************** Host handling ***********************************/
-XBT_PUBLIC void MSG_host_get_process_list(msg_host_t h, xbt_dynar_t whereto);
-
 XBT_ATTRIB_DEPRECATED_v320("Use MSG_host_get_speed(): v3.20 will drop MSG_host_get_current_power_peak() "
                            "completely.") static inline double MSG_host_get_current_power_peak(msg_host_t host)
 {
   return MSG_host_get_speed(host);
 }
 
-XBT_PUBLIC double MSG_host_get_power_peak_at(msg_host_t h, int pstate);
-
 XBT_PUBLIC void MSG_create_environment(const char* file);
 
 /************************** Process handling *********************************/
@@ -367,55 +409,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)
-
-#include "simgrid/instr.h"
-
 /* ****************************************************************************************** */
 /* 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);