-/* Copyright (c) 2004-2014. The SimGrid Team.
+/* Copyright (c) 2004-2015. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#include "xbt.h"
#include "xbt/lib.h"
+#include "simgrid/forward.h"
#include "simgrid/simix.h"
-#include "simgrid/platf.h"
SG_BEGIN_DECL()
typedef struct s_smx_rvpoint *msg_mailbox_t;
/* ******************************** Environment ************************************ */
-typedef struct As *msg_as_t;
+typedef surf_As *msg_as_t;
/* ******************************** Host ************************************ */
-extern int MSG_HOST_LEVEL;
-
/** @brief Host datatype.
@ingroup m_host_management
some <em>private data</em> that can be only accessed by local
process.
*/
-typedef xbt_dictelm_t msg_host_t;
-typedef s_xbt_dictelm_t s_msg_host_t;
+typedef sg_host_t msg_host_t;
-typedef struct msg_host_priv {
+typedef struct s_msg_host_priv {
int dp_enabled;
xbt_dict_t dp_objs;
double dp_updated_by_deleted_tasks;
int is_migrating;
xbt_dict_t affinity_mask_db;
-
-#ifdef MSG_USE_DEPRECATED
- msg_mailbox_t *mailboxes; /**< the channels */
-#endif
-} s_msg_host_priv_t, *msg_host_priv_t;
-
-static inline msg_host_priv_t MSG_host_priv(msg_host_t host){
- return (msg_host_priv_t )xbt_lib_get_level(host, MSG_HOST_LEVEL);
-}
-
-
+ xbt_dynar_t file_descriptor_table;
+} s_msg_host_priv_t;
/* ******************************** Task ************************************ */
/* ******************************** VM ************************************* */
typedef msg_host_t msg_vm_t;
-typedef msg_host_priv_t msg_vm_priv_t;
-
-static inline msg_vm_priv_t MSG_vm_priv(msg_vm_t vm){
- return (msg_vm_priv_t) xbt_lib_get_level(vm, MSG_HOST_LEVEL);
-}
/** ******************************** File ************************************ */
char* storageId;
char* storage_type;
char* content_type;
+ int desc_id;
void *data;
simdata_file_t simdata;
} s_msg_file_priv_t, *msg_file_priv_t;
*/
typedef struct s_smx_process *msg_process_t;
-#ifdef MSG_USE_DEPRECATED
-
-/* Compatibility typedefs */
-typedef int m_channel_t;
-typedef msg_gpu_task_t m_gpu_task_t;
-typedef msg_host_t m_host_t;
-typedef msg_process_t m_process_t;
-typedef msg_task_t m_task_t;
-typedef s_msg_gpu_task_t s_m_gpu_task_t;
-typedef s_msg_host_t s_m_host_t;
-typedef s_msg_task_t s_m_task_t;
-#endif
-
/** @brief Return code of most MSG functions
@ingroup msg_simulation
@{ */
*
* We allow to link against compiled versions that differ in the patch level.
*/
-#define MSG_init(argc,argv) { \
- int ver_major,ver_minor,ver_patch; \
- sg_version(&ver_major,&ver_minor,&ver_patch); \
- if ((ver_major != SIMGRID_VERSION_MAJOR) || \
- (ver_minor != SIMGRID_VERSION_MINOR)) { \
- fprintf(stderr,"FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, and then linked against SimGrid %d.%d.%d. Please fix this.\n", \
- SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,ver_major,ver_minor,ver_patch); \
- } \
- MSG_init_nocheck(argc,argv); \
- }
+#define MSG_init(argc,argv) do { \
+ sg_version_check(SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH);\
+ MSG_init_nocheck(argc,argv); \
+ } while (0)
XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv);
XBT_PUBLIC(msg_error_t) MSG_main(void);
XBT_PUBLIC(msg_as_t) MSG_environment_as_get_by_name(const char * name);
XBT_PUBLIC(xbt_dict_t) MSG_environment_as_get_routing_sons(msg_as_t as);
XBT_PUBLIC(const char *) MSG_environment_as_get_property_value(msg_as_t as, const char *name);
-XBT_PUBLIC(const char *) MSG_environment_as_get_model(msg_as_t as);
XBT_PUBLIC(xbt_dynar_t) MSG_environment_as_get_hosts(msg_as_t as);
/************************** File handling ***********************************/
XBT_PUBLIC(sg_size_t) MSG_file_tell (msg_file_t fd);
XBT_PUBLIC(void) __MSG_file_get_info(msg_file_t fd);
XBT_PUBLIC(void) __MSG_file_priv_free(msg_file_priv_t priv);
-XBT_PUBLIC(const char *) MSG_file_get_name(msg_file_t storage);
+XBT_PUBLIC(const char *) MSG_file_get_name(msg_file_t file);
XBT_PUBLIC(msg_error_t) MSG_file_move(msg_file_t fd, const char* fullpath);
XBT_PUBLIC(msg_error_t) MSG_file_rcopy(msg_file_t fd, msg_host_t host, const char* fullpath);
XBT_PUBLIC(msg_error_t) MSG_file_rmove(msg_file_t fd, msg_host_t host, const char* fullpath);
/************************** Storage handling ***********************************/
-XBT_PUBLIC(msg_host_t) MSG_get_storage_by_name(const char *name);
XBT_PUBLIC(const char *) MSG_storage_get_name(msg_storage_t storage);
XBT_PUBLIC(sg_size_t) MSG_storage_get_free_size(msg_storage_t storage);
XBT_PUBLIC(sg_size_t) MSG_storage_get_used_size(msg_storage_t storage);
XBT_PUBLIC(void) MSG_as_router_set_property_value(const char* asr, const char *name, char *value,void_f_pvoid_t free_ctn);
/************************** Host handling ***********************************/
+XBT_PUBLIC(msg_host_t) MSG_host_by_name(const char *name);
+#define MSG_get_host_by_name(n) MSG_host_by_name(n) /* Rewrite the old name into the new one transparently */
XBT_PUBLIC(msg_error_t) MSG_host_set_data(msg_host_t host, void *data);
XBT_PUBLIC(void *) MSG_host_get_data(msg_host_t host);
-XBT_PUBLIC(const char *) MSG_host_get_name(msg_host_t host);
+/** \ingroup m_host_management
+ *
+ * \brief Return the name of the #msg_host_t. */
+#define MSG_host_get_name(host) sg_host_get_name(host)
XBT_PUBLIC(void) MSG_host_on(msg_host_t host);
XBT_PUBLIC(void) MSG_host_off(msg_host_t host);
XBT_PUBLIC(msg_host_t) MSG_host_self(void);
-XBT_PUBLIC(int) MSG_get_host_msgload(msg_host_t host);
XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h);
XBT_PUBLIC(int) MSG_host_get_core_number(msg_host_t h);
XBT_PUBLIC(xbt_swag_t) MSG_host_get_process_list(msg_host_t h);
XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h);
XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h);
-XBT_PUBLIC(void) __MSG_host_priv_free(msg_host_priv_t priv);
-XBT_PUBLIC(void) __MSG_host_destroy(msg_host_t host);
XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate);
XBT_PUBLIC(double) MSG_host_get_current_power_peak(msg_host_t h);
XBT_PUBLIC(int) MSG_host_get_nb_pstates(msg_host_t h);
-XBT_PUBLIC(void) MSG_host_set_pstate(msg_host_t h, int pstate);
-XBT_PUBLIC(int) MSG_host_get_pstate(msg_host_t host);
-
-XBT_PUBLIC(double) MSG_host_get_consumed_energy(msg_host_t h);
+#define MSG_host_get_pstate(h) sg_host_get_pstate(h)
+#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate)
+XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
+XBT_PUBLIC(int) MSG_get_host_number(void);
+XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, vm_params_t params);
+XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, vm_params_t params);
+XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
+XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host);
+XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
/*property handlers*/
XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host);
XBT_PUBLIC(void) MSG_create_environment(const char *file);
-XBT_PUBLIC(msg_host_t) MSG_get_host_by_name(const char *name);
-XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
-XBT_PUBLIC(int) MSG_get_host_number(void);
-XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, ws_params_t params);
-XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, ws_params_t params);
-XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
-XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host);
-XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
/************************** Process handling *********************************/
XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
xbt_main_func_t code,
char **argv,
xbt_dict_t
properties);
+XBT_PUBLIC(msg_process_t) MSG_process_attach(
+ const char *name, void *data,
+ msg_host_t host, xbt_dict_t properties);
+XBT_PUBLIC(void) MSG_process_detach(void);
+
XBT_PUBLIC(void) MSG_process_kill(msg_process_t process);
XBT_PUBLIC(int) MSG_process_killall(int reset_PIDs);
XBT_PUBLIC(msg_error_t) MSG_process_migrate(msg_process_t process, msg_host_t host);
XBT_PUBLIC(msg_error_t) MSG_task_cancel(msg_task_t task);
XBT_PUBLIC(msg_error_t) MSG_task_destroy(msg_task_t task);
-XBT_PUBLIC(msg_error_t) MSG_task_receive_from_host(msg_task_t * task, const char *alias,
- msg_host_t host);
-XBT_PUBLIC(msg_error_t) MSG_task_receive_from_host_bounded(msg_task_t * task, const char *alias,
- msg_host_t host, double rate);
-
XBT_PUBLIC(msg_error_t) MSG_task_execute(msg_task_t task);
XBT_PUBLIC(msg_error_t) MSG_parallel_task_execute(msg_task_t task);
XBT_PUBLIC(void) MSG_task_set_priority(msg_task_t task, double priority);
XBT_PUBLIC(void) MSG_action_init(void);
XBT_PUBLIC(void) MSG_action_exit(void);
-#ifdef MSG_USE_DEPRECATED
-
-typedef msg_error_t MSG_error_t;
-
-#define MSG_global_init(argc, argv) MSG_init(argc,argv)
-#define MSG_global_init_args(argc, argv) MSG_init(argc,argv)
-
-/* these are the functions which are deprecated. Do not use them, they may get removed in future releases */
-XBT_PUBLIC(msg_host_t *) MSG_get_host_table(void);
-
-#define MSG_host_is_avail(h) MSG_host_is_on(h)
-
-#define MSG_TIMEOUT_FAILURE MSG_TIMEOUT
-#define MSG_TASK_CANCELLED MSG_TASK_CANCELED
-#define MSG_mailbox_put_with_time_out(mailbox, task, timeout) \
- MSG_mailbox_put_with_timeout(mailbox, task, timeout)
-
-#define MSG_process_change_host(h) MSG_process_migrate(MSG_process_self(),h);
-XBT_PUBLIC(msg_error_t) MSG_get_errno(void);
-
-XBT_PUBLIC(msg_error_t) MSG_clean(void);
-
-XBT_PUBLIC(msg_error_t) MSG_task_get(msg_task_t * task, m_channel_t channel);
-XBT_PUBLIC(msg_error_t) MSG_task_get_with_timeout(msg_task_t * task,
- m_channel_t channel,
- double max_duration);
-XBT_PUBLIC(msg_error_t) MSG_task_get_from_host(msg_task_t * task,
- int channel, msg_host_t host);
-XBT_PUBLIC(msg_error_t) MSG_task_get_ext(msg_task_t * task, int channel,
- double max_duration,
- msg_host_t host);
-XBT_PUBLIC(msg_error_t) MSG_task_put(msg_task_t task, msg_host_t dest,
- m_channel_t channel);
-XBT_PUBLIC(msg_error_t) MSG_task_put_bounded(msg_task_t task,
- msg_host_t dest,
- m_channel_t channel,
- double max_rate);
-XBT_PUBLIC(msg_error_t) MSG_task_put_with_timeout(msg_task_t task,
- msg_host_t dest,
- m_channel_t channel,
- double max_duration);
-XBT_PUBLIC(int) MSG_task_Iprobe(m_channel_t channel);
-XBT_PUBLIC(int) MSG_task_probe_from(m_channel_t channel);
-XBT_PUBLIC(int) MSG_task_probe_from_host(int channel, msg_host_t host);
-
-XBT_PUBLIC(msg_error_t) MSG_set_channel_number(int number);
-XBT_PUBLIC(int) MSG_get_channel_number(void);
-#endif
-
/** @brief Opaque type representing a semaphore
* @ingroup msg_synchro
* @hideinitializer
void MSG_vm_setMemoryUsed(msg_vm_t vm, double size);
void MSG_vm_setCpuUsed(msg_vm_t vm, double inducedLoad);
- // inducedLoad: un pourcentage (>100 si ca charge plus d'un coeur;
- // <100 si c'est pas CPU intensive)
- // Contraintes à poser:
+ // inducedLoad: a percentage (>100 if it loads more than one core;
+ // <100 if it's not CPU intensive)
+ // Required contraints:
// HOST_Power >= CpuUsedVm (\forall VM) + CpuUsedTask (\forall Task)
- // VM_coreAmount >= Load de toutes les tasks
+ // VM_coreAmount >= Load of all tasks
*/
/*
xbt_dynar_t<msg_vm_t> MSG_vm_get_list_from_host(msg_host_t)
xbt_dynar_t<msg_vm_t> MSG_vm_get_list_from_hosts(msg_dynar_t<msg_host_t>)
-+ des fonctions de filtrage sur les dynar
++ filtering functions on dynars
*/
#include "simgrid/instr.h"