1 /* Copyright (c) 2004-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include "simgrid/forward.h"
11 #include "simgrid/simix.h"
19 typedef simgrid::msg::Comm sg_msg_Comm;
21 typedef struct msg_Comm sg_msg_Comm;
26 /* *************************** Network Zones ******************************** */
27 #define msg_as_t msg_netzone_t /* portability macro */
28 typedef s4u_NetZone* msg_netzone_t;
30 /* ******************************** Host ************************************ */
32 /** @brief Host datatype.
33 @ingroup m_host_management
35 A <em>location</em> (or <em>host</em>) is any possible place where
36 a process may run. Thus it is represented as a <em>physical
37 resource with computing capabilities</em>, some <em>mailboxes</em>
38 to enable running process to communicate with remote ones, and
39 some <em>private data</em> that can be only accessed by local
42 typedef sg_host_t msg_host_t;
45 XBT_PUBLIC_DATA(int) sg_storage_max_file_descriptors;
46 /* ******************************** Task ************************************ */
48 typedef struct simdata_task *simdata_task_t;
50 typedef struct msg_task {
51 char *name; /**< @brief task name if any */
52 simdata_task_t simdata; /**< @brief simulator data */
53 void *data; /**< @brief user data */
54 long long int counter; /* task unique identifier for instrumentation */
55 char *category; /* task category for instrumentation */
58 /** @brief Task datatype.
59 @ingroup m_task_management
61 A <em>task</em> may then be defined by a <em>computing
62 amount</em>, a <em>message size</em> and some <em>private
65 typedef struct msg_task *msg_task_t;
67 /* ******************************** VM ************************************* */
68 typedef msg_host_t msg_vm_t;
70 /* ******************************** File ************************************ */
71 typedef sg_file_t msg_file_t;
73 /* ******************************** Storage ************************************ */
75 /** @brief Storage datatype.
76 * @ingroup msg_storage_management
78 * You should consider this as an opaque object.
80 typedef sg_storage_t msg_storage_t;
83 * \brief @brief Communication action.
84 * \ingroup msg_task_usage
86 * Object representing an ongoing communication between processes. Such beast is usually obtained by using #MSG_task_isend, #MSG_task_irecv or friends.
88 typedef sg_msg_Comm* msg_comm_t;
90 /** \brief Default value for an uninitialized #msg_task_t.
91 \ingroup m_task_management
93 #define MSG_TASK_UNINITIALIZED NULL
95 /* ****************************** Process *********************************** */
97 /** @brief Process datatype.
98 @ingroup m_process_management
100 A process may be defined as a <em>code</em>, with some
101 <em>private data</em>, executing in a <em>location</em>.
103 You should not access directly to the fields of the pointed
104 structure, but always use the provided API to interact with
107 typedef s4u_Actor* msg_process_t;
109 /** @brief Return code of most MSG functions
110 @ingroup msg_simulation
112 /* Keep these code as binary values: java bindings manipulate | of these values */
114 MSG_OK = 0, /**< @brief Everything is right. Keep on going this way ! */
115 MSG_TIMEOUT = 1, /**< @brief nothing good happened before the timer you provided elapsed */
116 MSG_TRANSFER_FAILURE = 2, /**< @brief There has been a problem during you task
117 transfer. Either the network is down or the remote host has been
119 MSG_HOST_FAILURE = 4, /**< @brief System shutdown. The host on which you are
120 running has just been rebooted. Free your datastructures and
122 MSG_TASK_CANCELED = 8 /**< @brief Canceled task. This task has been canceled by somebody!*/
126 /************************** Global ******************************************/
127 XBT_PUBLIC(void) MSG_config(const char *key, const char *value);
128 /** \ingroup msg_simulation
129 * \brief Initialize the MSG internal data.
132 * It also check that the link-time and compile-time versions of SimGrid do
133 * match, so you should use this version instead of the #MSG_init_nocheck
134 * function that does the same initializations, but without this check.
136 * We allow to link against compiled versions that differ in the patch level.
138 #define MSG_init(argc,argv) do { \
139 sg_version_check(SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH);\
140 MSG_init_nocheck(argc,argv); \
143 XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv);
144 XBT_PUBLIC(msg_error_t) MSG_main();;
145 XBT_PUBLIC(void) MSG_function_register(const char *name,
146 xbt_main_func_t code);
147 XBT_PUBLIC(void) MSG_function_register_default(xbt_main_func_t code);
148 XBT_PUBLIC(void) MSG_launch_application(const char *file);
149 /*Bypass the parser */
150 XBT_PUBLIC(void) MSG_set_function(const char *host_id,
151 const char *function_name,
152 xbt_dynar_t arguments);
154 XBT_PUBLIC(double) MSG_get_clock();
155 XBT_PUBLIC(unsigned long int) MSG_get_sent_msg();
157 /************************** Net Zones ***********************************/
158 XBT_PUBLIC(msg_netzone_t) MSG_zone_get_root();
159 XBT_PUBLIC(const char*) MSG_zone_get_name(msg_netzone_t zone);
160 XBT_PUBLIC(msg_netzone_t) MSG_zone_get_by_name(const char* name);
161 XBT_PUBLIC(void) MSG_zone_get_sons(msg_netzone_t zone, xbt_dict_t whereto);
162 XBT_PUBLIC(const char*) MSG_zone_get_property_value(msg_netzone_t as, const char* name);
163 XBT_PUBLIC(void) MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value);
164 XBT_PUBLIC(void) MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto);
166 /* Deprecated forms of the previous functions */
167 static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_root since v3.16")
168 msg_netzone_t MSG_environment_get_routing_root() {
169 return MSG_zone_get_root();
171 static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_name since v3.16")
172 const char* MSG_environment_as_get_name(msg_netzone_t zone) {
173 return MSG_zone_get_name(zone);
175 static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_by_name since v3.16")
176 msg_netzone_t MSG_environment_as_get_by_name(const char* name) {
177 return MSG_zone_get_by_name(name);
179 static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_sons since v3.16")
180 xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t zone) {
181 xbt_dict_t res = xbt_dict_new_homogeneous(NULL);
182 MSG_zone_get_sons(zone, res);
185 static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_property_value since v3.16")
186 const char* MSG_environment_as_get_property_value(msg_netzone_t zone, const char* name) {
187 return MSG_zone_get_property_value(zone, name);
189 static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_set_property_value since v3.16")
190 void MSG_environment_as_set_property_value(msg_netzone_t zone, const char* name, char* value) {
191 MSG_zone_set_property_value(zone, name, value);
193 static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_hosts since v3.16")
194 xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t zone) {
195 xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), NULL);
196 MSG_zone_get_hosts(zone, res);
200 /************************** File handling ***********************************/
201 XBT_PUBLIC(sg_size_t) MSG_file_read(msg_file_t fd, sg_size_t size);
202 XBT_PUBLIC(sg_size_t) MSG_file_write(msg_file_t fd, sg_size_t size);
203 XBT_PUBLIC(msg_file_t) MSG_file_open(const char* fullpath, void* data);
204 XBT_PUBLIC(void*) MSG_file_get_data(msg_file_t fd);
205 XBT_PUBLIC(msg_error_t) MSG_file_set_data(msg_file_t fd, void * data);
206 XBT_PUBLIC(int) MSG_file_close(msg_file_t fd);
207 XBT_PUBLIC(sg_size_t) MSG_file_get_size(msg_file_t fd);
208 XBT_PUBLIC(void) MSG_file_dump(msg_file_t fd);
209 XBT_PUBLIC(msg_error_t) MSG_file_unlink(msg_file_t fd);
210 XBT_PUBLIC(msg_error_t) MSG_file_seek(msg_file_t fd, sg_offset_t offset, int origin);
211 XBT_PUBLIC(sg_size_t) MSG_file_tell (msg_file_t fd);
212 XBT_PUBLIC(const char *) MSG_file_get_name(msg_file_t file);
213 XBT_PUBLIC(msg_error_t) MSG_file_move(msg_file_t fd, const char* fullpath);
214 XBT_PUBLIC(msg_error_t) MSG_file_rcopy(msg_file_t fd, msg_host_t host, const char* fullpath);
215 XBT_PUBLIC(msg_error_t) MSG_file_rmove(msg_file_t fd, msg_host_t host, const char* fullpath);
216 /************************** Storage handling ***********************************/
217 XBT_PUBLIC(const char *) MSG_storage_get_name(msg_storage_t storage);
218 XBT_PUBLIC(sg_size_t) MSG_storage_get_free_size(msg_storage_t storage);
219 XBT_PUBLIC(sg_size_t) MSG_storage_get_used_size(msg_storage_t storage);
220 XBT_PUBLIC(msg_storage_t) MSG_storage_get_by_name(const char *name);
221 XBT_PUBLIC(xbt_dict_t) MSG_storage_get_properties(msg_storage_t storage);
222 XBT_PUBLIC(void) MSG_storage_set_property_value(msg_storage_t storage, const char* name, char* value);
223 XBT_PUBLIC(const char *)MSG_storage_get_property_value(msg_storage_t storage, const char *name);
224 XBT_PUBLIC(xbt_dynar_t) MSG_storages_as_dynar();
225 XBT_PUBLIC(msg_error_t) MSG_storage_set_data(msg_storage_t host, void *data);
226 XBT_PUBLIC(void *) MSG_storage_get_data(msg_storage_t storage);
227 XBT_PUBLIC(xbt_dict_t) MSG_storage_get_content(msg_storage_t storage);
228 XBT_PUBLIC(sg_size_t) MSG_storage_get_size(msg_storage_t storage);
229 XBT_PUBLIC(const char *) MSG_storage_get_host(msg_storage_t storage);
231 /************************** Host handling ***********************************/
232 XBT_PUBLIC(msg_host_t) MSG_host_by_name(const char *name);
233 #define MSG_get_host_by_name(n) MSG_host_by_name(n) /* Rewrite the old name into the new one transparently */
234 XBT_PUBLIC(msg_error_t) MSG_host_set_data(msg_host_t host, void *data);
235 XBT_PUBLIC(void *) MSG_host_get_data(msg_host_t host);
236 /** \ingroup m_host_management
238 * \brief Return the name of the #msg_host_t. */
239 #define MSG_host_get_name(host) sg_host_get_name(host)
240 XBT_PUBLIC(void) MSG_host_on(msg_host_t host);
241 XBT_PUBLIC(void) MSG_host_off(msg_host_t host);
242 XBT_PUBLIC(msg_host_t) MSG_host_self();
243 XBT_PUBLIC(double) MSG_host_get_speed(msg_host_t h);
244 XBT_PUBLIC(int) MSG_host_get_core_number(msg_host_t h);
245 XBT_PUBLIC(void) MSG_host_get_process_list(msg_host_t h, xbt_dynar_t whereto);
246 XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h);
247 XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h);
249 XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h); /* deprecated */
251 XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate);
252 #define MSG_host_get_current_power_peak(h) MSG_host_get_speed(h) /* deprecated */
253 XBT_PUBLIC(int) MSG_host_get_nb_pstates(msg_host_t h);
254 #define MSG_host_get_pstate(h) sg_host_get_pstate(h) /* deprecated */
255 #define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate) /* deprecated */
256 XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar();
257 XBT_PUBLIC(int) MSG_get_host_number();
258 XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
259 XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host);
260 XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
262 /*property handlers*/
263 XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host);
264 XBT_PUBLIC(const char *) MSG_host_get_property_value(msg_host_t host,
266 XBT_PUBLIC(void) MSG_host_set_property_value(msg_host_t host, const char* name, char* value);
268 XBT_PUBLIC(void) MSG_create_environment(const char *file);
270 /************************** Process handling *********************************/
271 XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
272 xbt_main_func_t code,
273 void *data, msg_host_t host);
274 XBT_PUBLIC(msg_process_t)
275 MSG_process_create_with_arguments(const char* name, xbt_main_func_t code, void* data, msg_host_t host, int argc,
277 XBT_PUBLIC(msg_process_t)
278 MSG_process_create_with_environment(const char* name, xbt_main_func_t code, void* data, msg_host_t host, int argc,
279 char** argv, xbt_dict_t properties);
281 XBT_PUBLIC(msg_process_t) MSG_process_attach(const char* name, void* data, msg_host_t host, xbt_dict_t properties);
282 XBT_PUBLIC(void) MSG_process_detach();
284 XBT_PUBLIC(void) MSG_process_kill(msg_process_t process);
285 XBT_PUBLIC(int) MSG_process_killall(int reset_PIDs);
286 XBT_PUBLIC(msg_error_t) MSG_process_migrate(msg_process_t process, msg_host_t host);
287 XBT_PUBLIC(void) MSG_process_yield();
289 XBT_PUBLIC(void *) MSG_process_get_data(msg_process_t process);
290 XBT_PUBLIC(msg_error_t) MSG_process_set_data(msg_process_t process,
292 XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup);
293 XBT_PUBLIC(msg_host_t) MSG_process_get_host(msg_process_t process);
294 XBT_PUBLIC(msg_process_t) MSG_process_from_PID(int PID);
295 XBT_PUBLIC(int) MSG_process_get_PID(msg_process_t process);
296 XBT_PUBLIC(int) MSG_process_get_PPID(msg_process_t process);
297 XBT_PUBLIC(const char *) MSG_process_get_name(msg_process_t process);
298 XBT_PUBLIC(int) MSG_process_self_PID();
299 XBT_PUBLIC(int) MSG_process_self_PPID();
300 XBT_PUBLIC(const char*) MSG_process_self_name();
301 XBT_PUBLIC(msg_process_t) MSG_process_self();
302 XBT_PUBLIC(xbt_dynar_t) MSG_processes_as_dynar();
303 XBT_PUBLIC(int) MSG_process_get_number();
305 XBT_PUBLIC(msg_error_t) MSG_process_set_kill_time(msg_process_t process, double kill_time);
307 /*property handlers*/
308 XBT_PUBLIC(xbt_dict_t) MSG_process_get_properties(msg_process_t process);
309 XBT_PUBLIC(const char *) MSG_process_get_property_value(msg_process_t
313 XBT_PUBLIC(msg_error_t) MSG_process_suspend(msg_process_t process);
314 XBT_PUBLIC(msg_error_t) MSG_process_resume(msg_process_t process);
315 XBT_PUBLIC(int) MSG_process_is_suspended(msg_process_t process);
316 XBT_PUBLIC(void) MSG_process_on_exit(int_f_pvoid_pvoid_t fun, void *data);
317 XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_restart);
319 XBT_PUBLIC(void) MSG_process_daemonize(msg_process_t process);
320 XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process);
321 XBT_PUBLIC(void) MSG_process_ref(msg_process_t process);
322 XBT_PUBLIC(void) MSG_process_unref(msg_process_t process);
324 /************************** Task handling ************************************/
325 XBT_PUBLIC(msg_task_t) MSG_task_create(const char *name,
327 double bytes_amount, void *data);
328 XBT_PUBLIC(msg_task_t) MSG_parallel_task_create(const char *name,
330 const msg_host_t * host_list,
331 double *flops_amount,
332 double *bytes_amount,
334 XBT_PUBLIC(void *) MSG_task_get_data(msg_task_t task);
335 XBT_PUBLIC(void) MSG_task_set_data(msg_task_t task, void *data);
336 XBT_PUBLIC(void) MSG_task_set_copy_callback(void (*callback) (
337 msg_task_t task, msg_process_t src, msg_process_t dst));
338 XBT_PUBLIC(msg_process_t) MSG_task_get_sender(msg_task_t task);
339 XBT_PUBLIC(msg_host_t) MSG_task_get_source(msg_task_t task);
340 XBT_PUBLIC(const char *) MSG_task_get_name(msg_task_t task);
341 XBT_PUBLIC(void) MSG_task_set_name(msg_task_t task, const char *name);
342 XBT_PUBLIC(msg_error_t) MSG_task_cancel(msg_task_t task);
343 XBT_PUBLIC(msg_error_t) MSG_task_destroy(msg_task_t task);
345 XBT_PUBLIC(msg_error_t) MSG_task_execute(msg_task_t task);
346 XBT_PUBLIC(msg_error_t) MSG_parallel_task_execute(msg_task_t task);
347 XBT_PUBLIC(msg_error_t) MSG_parallel_task_execute_with_timeout(msg_task_t task, double timeout);
348 XBT_PUBLIC(void) MSG_task_set_priority(msg_task_t task, double priority);
349 XBT_PUBLIC(void) MSG_task_set_bound(msg_task_t task, double bound);
351 XBT_PUBLIC(msg_error_t) MSG_process_join(msg_process_t process, double timeout);
352 XBT_PUBLIC(msg_error_t) MSG_process_sleep(double nb_sec);
354 XBT_PUBLIC(void) MSG_task_set_flops_amount(msg_task_t task,
355 double flops_amount);
356 XBT_PUBLIC(double) MSG_task_get_flops_amount(msg_task_t task);
357 XBT_PUBLIC(void) MSG_task_set_bytes_amount(msg_task_t task,
358 double bytes_amount);
360 XBT_PUBLIC(double) MSG_task_get_remaining_communication(msg_task_t task);
361 XBT_PUBLIC(int) MSG_task_is_latency_bounded(msg_task_t task);
362 XBT_PUBLIC(double) MSG_task_get_bytes_amount(msg_task_t task);
365 XBT_PUBLIC(msg_error_t)
366 MSG_task_receive_ext(msg_task_t * task, const char *alias, double timeout,
369 XBT_PUBLIC(msg_error_t)
370 MSG_task_receive_with_timeout(msg_task_t * task, const char *alias,
373 XBT_PUBLIC(msg_error_t)
374 MSG_task_receive(msg_task_t * task, const char *alias);
375 #define MSG_task_recv(t,a) MSG_task_receive(t,a)
379 XBT_PUBLIC(msg_error_t)
380 MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, double timeout,
381 msg_host_t host, double rate);
383 XBT_PUBLIC(msg_error_t) MSG_task_receive_with_timeout_bounded(msg_task_t * task, const char *alias, double timeout, double rate);
384 XBT_PUBLIC(msg_error_t) MSG_task_receive_bounded(msg_task_t * task, const char *alias,double rate);
385 #define MSG_task_recv_bounded(t,a,r) MSG_task_receive_bounded(t,a,r)
387 XBT_PUBLIC(msg_comm_t) MSG_task_isend(msg_task_t task, const char *alias);
388 XBT_PUBLIC(msg_comm_t) MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate);
389 XBT_PUBLIC(msg_comm_t) MSG_task_isend_with_matching(msg_task_t task, const char *alias,
390 int (*match_fun)(void*,void*, smx_activity_t), void *match_data);
392 XBT_PUBLIC(void) MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup);
393 XBT_PUBLIC(void) MSG_task_dsend_bounded(msg_task_t task, const char *alias, void_f_pvoid_t cleanup, double maxrate);
394 XBT_PUBLIC(msg_comm_t) MSG_task_irecv(msg_task_t * task, const char *alias);
395 XBT_PUBLIC(msg_comm_t) MSG_task_irecv_bounded(msg_task_t * task, const char *alias, double rate);
396 XBT_PUBLIC(int) MSG_comm_test(msg_comm_t comm);
397 XBT_PUBLIC(int) MSG_comm_testany(xbt_dynar_t comms);
398 XBT_PUBLIC(void) MSG_comm_destroy(msg_comm_t comm);
399 XBT_PUBLIC(msg_error_t) MSG_comm_wait(msg_comm_t comm, double timeout);
400 XBT_PUBLIC(void) MSG_comm_waitall(msg_comm_t * comm, int nb_elem, double timeout);
401 XBT_PUBLIC(int) MSG_comm_waitany(xbt_dynar_t comms);
402 XBT_PUBLIC(msg_task_t) MSG_comm_get_task(msg_comm_t comm);
403 XBT_PUBLIC(msg_error_t) MSG_comm_get_status(msg_comm_t comm);
405 XBT_PUBLIC(int) MSG_task_listen(const char *alias);
406 XBT_PUBLIC(msg_error_t) MSG_task_send_with_timeout(msg_task_t task, const char *alias, double timeout);
407 XBT_PUBLIC(msg_error_t) MSG_task_send_with_timeout_bounded(msg_task_t task, const char *alias, double timeout, double maxrate);
408 XBT_PUBLIC(msg_error_t) MSG_task_send(msg_task_t task, const char *alias);
409 XBT_PUBLIC(msg_error_t) MSG_task_send_bounded(msg_task_t task, const char *alias, double rate);
410 XBT_PUBLIC(int) MSG_task_listen_from(const char *alias);
411 XBT_PUBLIC(void) MSG_task_set_category (msg_task_t task, const char *category);
412 XBT_PUBLIC(const char *) MSG_task_get_category (msg_task_t task);
414 /************************** Mailbox handling ************************************/
416 /* @brief MSG_mailbox_set_async - set a mailbox as eager
417 * Sets the mailbox to a permanent receiver mode. Messages sent to this mailbox will then be sent just after the send
418 * is issued, without waiting for the corresponding receive.
419 * This call should be done before issuing any receive, and on the receiver's side only
420 * @param alias The alias of the mailbox to modify.
422 XBT_PUBLIC(void) MSG_mailbox_set_async(const char *alias);
424 /************************** Action handling **********************************/
425 XBT_PUBLIC(msg_error_t) MSG_action_trace_run(char *path);
426 XBT_PUBLIC(void) MSG_action_init();
427 XBT_PUBLIC(void) MSG_action_exit();
429 /** @brief Opaque type representing a semaphore
430 * @ingroup msg_synchro
433 typedef struct s_smx_sem *msg_sem_t; // Yeah that's a rename of the smx_sem_t which doesnt require smx_sem_t to be declared here
434 XBT_PUBLIC(msg_sem_t) MSG_sem_init(int initial_value);
435 XBT_PUBLIC(void) MSG_sem_acquire(msg_sem_t sem);
436 XBT_PUBLIC(msg_error_t) MSG_sem_acquire_timeout(msg_sem_t sem, double timeout);
437 XBT_PUBLIC(void) MSG_sem_release(msg_sem_t sem);
438 XBT_PUBLIC(int) MSG_sem_get_capacity(msg_sem_t sem);
439 XBT_PUBLIC(void) MSG_sem_destroy(msg_sem_t sem);
440 XBT_PUBLIC(int) MSG_sem_would_block(msg_sem_t sem);
442 /** @brief Opaque type representing a barrier identifier
443 * @ingroup msg_synchro
447 #define MSG_BARRIER_SERIAL_PROCESS -1
448 typedef struct s_msg_bar* msg_bar_t;
449 XBT_PUBLIC(msg_bar_t) MSG_barrier_init( unsigned int count);
450 XBT_PUBLIC(void) MSG_barrier_destroy(msg_bar_t bar);
451 XBT_PUBLIC(int) MSG_barrier_wait(msg_bar_t bar);
453 /** @brief Opaque type describing a Virtual Machine.
456 * All this is highly experimental and the interface will probably change in the future.
457 * Please don't depend on this yet (although testing is welcomed if you feel so).
458 * Usual lack of guaranty of any kind applies here, and is even increased.
462 XBT_PUBLIC(int) MSG_vm_is_created(msg_vm_t vm);
463 XBT_PUBLIC(int) MSG_vm_is_running(msg_vm_t vm);
464 XBT_PUBLIC(int) MSG_vm_is_migrating(msg_vm_t vm);
465 XBT_PUBLIC(int) MSG_vm_is_suspended(msg_vm_t vm);
467 #define MSG_vm_get_name(vm) MSG_host_get_name(vm)
469 XBT_PUBLIC(void) MSG_vm_get_params(msg_vm_t vm, vm_params_t params);
470 XBT_PUBLIC(void) MSG_vm_set_params(msg_vm_t vm, vm_params_t params);
472 // TODO add VDI later
473 XBT_PUBLIC(msg_vm_t) MSG_vm_create_core(msg_host_t location, const char *name);
474 XBT_PUBLIC(msg_vm_t) MSG_vm_create_multicore(msg_host_t pm, const char* name, int coreAmount);
476 MSG_vm_create(msg_host_t ind_pm, const char* name, int coreAmount, int ramsize, int mig_netspeed, int dp_intensity);
478 XBT_PUBLIC(void) MSG_vm_destroy(msg_vm_t vm);
480 XBT_PUBLIC(void) MSG_vm_start(msg_vm_t vm);
482 /* Shutdown the guest operating system. */
483 XBT_PUBLIC(void) MSG_vm_shutdown(msg_vm_t vm);
485 XBT_PUBLIC(void) MSG_vm_migrate(msg_vm_t vm, msg_host_t destination);
487 /* Suspend the execution of the VM, but keep its state on memory. */
488 XBT_PUBLIC(void) MSG_vm_suspend(msg_vm_t vm);
489 XBT_PUBLIC(void) MSG_vm_resume(msg_vm_t vm);
491 XBT_PUBLIC(msg_host_t) MSG_vm_get_pm(msg_vm_t vm);
492 XBT_PUBLIC(void) MSG_vm_set_bound(msg_vm_t vm, double bound);
495 #include "simgrid/instr.h"
497 /* ****************************************************************************************** */
498 /* Used only by the bindings -- unclean pimple, please ignore if you're not writing a binding */
499 XBT_PUBLIC(smx_context_t) MSG_process_get_smx_ctx(msg_process_t process);
502 /* Functions renamed in 3.14 */
503 #define MSG_mailbox_get_head(m) MSG_mailbox_front(m)
509 XBT_PUBLIC(msg_process_t)
510 MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data, msg_host_t host,
511 xbt_dict_t properties);