1 /* libsmx.c - public interface to simix */
3 /* These functions are the only ones that are visible from the higher levels */
4 /* (most of them simply add some documentation to the generated simcall body) */
6 /* This is somehow the "libc" of SimGrid */
8 /* Copyright (c) 2010-2015. The SimGrid Team.
9 * All rights reserved. */
11 /* This program is free software; you can redistribute it and/or modify it
12 * under the terms of the license (GNU LGPL) which comes with this package. */
14 #include <cmath> /* std::isfinite() */
18 #include <xbt/functional.hpp>
20 #include <simgrid/simix/blocking_simcall.hpp>
22 #include "src/mc/mc_replay.h"
23 #include "smx_private.h"
24 #include "src/mc/mc_forward.hpp"
27 #include "src/simix/smx_host_private.h"
28 #include "src/kernel/activity/SynchroComm.hpp"
29 #include "src/surf/virtual_machine.hpp"
32 #include <simgrid/simix.hpp>
34 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
36 #include "popping_bodies.cpp"
38 void simcall_call(smx_actor_t process)
40 if (process != simix_global->maestro_process) {
41 XBT_DEBUG("Yield process '%s' on simcall %s (%d)", process->name.c_str(),
42 SIMIX_simcall_name(process->simcall.call), (int)process->simcall.call);
43 SIMIX_process_yield(process);
45 SIMIX_simcall_handle(&process->simcall, 0);
52 * \ingroup simix_host_management
53 * \brief Returns a dict of the properties assigned to a router or AS.
55 * \param name The name of the router or AS
56 * \return The properties
58 xbt_dict_t simcall_asr_get_properties(const char *name)
60 return simcall_BODY_asr_get_properties(name);
64 * \ingroup simix_process_management
65 * \brief Creates a synchro that executes some computation of an host.
67 * This function creates a SURF action and allocates the data necessary
68 * to create the SIMIX synchro. It can raise a host_error exception if the host crashed.
70 * \param name Name of the execution synchro to create
71 * \param flops_amount amount Computation amount (in flops)
72 * \param priority computation priority
74 * \return A new SIMIX execution synchronization
76 smx_activity_t simcall_execution_start(const char *name,
78 double priority, double bound)
80 /* checking for infinite values */
81 xbt_assert(std::isfinite(flops_amount), "flops_amount is not finite!");
82 xbt_assert(std::isfinite(priority), "priority is not finite!");
84 return simcall_BODY_execution_start(name, flops_amount, priority, bound);
88 * \ingroup simix_process_management
89 * \brief Creates a synchro that may involve parallel computation on
90 * several hosts and communication between them.
92 * \param name Name of the execution synchro to create
93 * \param host_nb Number of hosts where the synchro will be executed
94 * \param host_list Array (of size host_nb) of hosts where the synchro will be executed
95 * \param flops_amount Array (of size host_nb) of computation amount of hosts (in bytes)
96 * \param bytes_amount Array (of size host_nb * host_nb) representing the communication
97 * amount between each pair of hosts
98 * \param amount the SURF action amount
99 * \param rate the SURF action rate
100 * \return A new SIMIX execution synchronization
102 smx_activity_t simcall_execution_parallel_start(const char *name,
104 sg_host_t *host_list,
105 double *flops_amount,
106 double *bytes_amount,
111 /* checking for infinite values */
112 for (i = 0 ; i < host_nb ; ++i) {
113 xbt_assert(std::isfinite(flops_amount[i]), "flops_amount[%d] is not finite!", i);
114 if (bytes_amount != nullptr) {
115 for (j = 0 ; j < host_nb ; ++j) {
116 xbt_assert(std::isfinite(bytes_amount[i + host_nb * j]),
117 "bytes_amount[%d+%d*%d] is not finite!", i, host_nb, j);
122 xbt_assert(std::isfinite(amount), "amount is not finite!");
123 xbt_assert(std::isfinite(rate), "rate is not finite!");
125 return simcall_BODY_execution_parallel_start(name, host_nb, host_list,
133 * \ingroup simix_process_management
134 * \brief Cancels an execution synchro.
136 * This functions stops the execution. It calls a surf function.
137 * \param execution The execution synchro to cancel
139 void simcall_execution_cancel(smx_activity_t execution)
141 simcall_BODY_execution_cancel(execution);
145 * \ingroup simix_process_management
146 * \brief Changes the priority of an execution synchro.
148 * This functions changes the priority only. It calls a surf function.
149 * \param execution The execution synchro
150 * \param priority The new priority
152 void simcall_execution_set_priority(smx_activity_t execution, double priority)
154 /* checking for infinite values */
155 xbt_assert(std::isfinite(priority), "priority is not finite!");
157 simcall_BODY_execution_set_priority(execution, priority);
161 * \ingroup simix_process_management
162 * \brief Changes the capping (the maximum CPU utilization) of an execution synchro.
164 * This functions changes the capping only. It calls a surf function.
165 * \param execution The execution synchro
166 * \param bound The new bound
168 void simcall_execution_set_bound(smx_activity_t execution, double bound)
170 simcall_BODY_execution_set_bound(execution, bound);
174 * \ingroup simix_host_management
175 * \brief Waits for the completion of an execution synchro and destroy it.
177 * \param execution The execution synchro
179 e_smx_state_t simcall_execution_wait(smx_activity_t execution)
181 return (e_smx_state_t) simcall_BODY_execution_wait(execution);
186 * \ingroup simix_vm_management
187 * \brief Create a VM on the given physical host.
189 * \param name VM name
190 * \param host Physical host
192 * \return The host object of the VM
194 sg_host_t simcall_vm_create(const char *name, sg_host_t phys_host)
196 return simgrid::simix::kernelImmediate([&] {
197 surf_vm_model->createVM(name, phys_host);
198 sg_host_t host = sg_host_by_name(name);
199 SIMIX_host_create(host);
206 * \ingroup simix_vm_management
207 * \brief Start the given VM to the given physical host
211 void simcall_vm_start(sg_host_t vm)
213 simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_start, vm));
217 * \ingroup simix_vm_management
218 * \brief Get the state of the given VM
221 * \return The state of the VM
223 int simcall_vm_get_state(sg_host_t vm)
225 return simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_get_state, vm));
229 * \ingroup simix_vm_management
230 * \brief Get the name of the physical host on which the given VM runs.
233 * \return The name of the physical host
235 void *simcall_vm_get_pm(sg_host_t vm)
237 return simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_get_pm, vm));
240 void simcall_vm_set_bound(sg_host_t vm, double bound)
242 simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_set_bound, vm, bound));
246 * \ingroup simix_vm_management
247 * \brief Migrate the given VM to the given physical host
250 * \param host Destination physical host
252 void simcall_vm_migrate(sg_host_t vm, sg_host_t host)
254 simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_migrate, vm, host));
258 * \ingroup simix_vm_management
259 * \brief Suspend the given VM
263 void simcall_vm_suspend(sg_host_t vm)
265 simcall_BODY_vm_suspend(vm);
269 * \ingroup simix_vm_management
270 * \brief Resume the given VM
274 void simcall_vm_resume(sg_host_t vm)
276 simcall_BODY_vm_resume(vm);
280 * \ingroup simix_vm_management
281 * \brief Save the given VM
285 void simcall_vm_save(sg_host_t vm)
287 simcall_BODY_vm_save(vm);
291 * \ingroup simix_vm_management
292 * \brief Restore the given VM
296 void simcall_vm_restore(sg_host_t vm)
298 simcall_BODY_vm_restore(vm);
302 * \ingroup simix_vm_management
303 * \brief Shutdown the given VM
307 void simcall_vm_shutdown(sg_host_t vm)
309 simcall_BODY_vm_shutdown(vm);
313 * \ingroup simix_vm_management
314 * \brief Destroy the given VM
318 void simcall_vm_destroy(sg_host_t vm)
320 simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_destroy, vm));
324 * \ingroup simix_vm_management
325 * \brief Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration
326 * The simcall actually invokes the following calls:
327 * simcall_vm_migrate(vm, dst_pm);
328 * simcall_vm_resume(vm);
330 * It is called at the end of the migration_rx_fun function from msg/msg_vm.c
332 * \param vm VM to migrate
333 * \param src_pm Source physical host
334 * \param dst_pmt Destination physical host
336 void simcall_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm)
338 simgrid::simix::kernelImmediate(std::bind(
339 SIMIX_vm_migratefrom_resumeto, vm, src_pm, dst_pm));
343 * \ingroup simix_process_management
344 * \brief Kills a SIMIX process.
346 * This function simply kills a process.
348 * \param process poor victim
350 void simcall_process_kill(smx_actor_t process)
352 simcall_BODY_process_kill(process);
356 * \ingroup simix_process_management
357 * \brief Kills all SIMIX processes.
359 void simcall_process_killall(int reset_pid)
361 simcall_BODY_process_killall(reset_pid);
365 * \ingroup simix_process_management
366 * \brief Cleans up a SIMIX process.
367 * \param process poor victim (must have already been killed)
369 void simcall_process_cleanup(smx_actor_t process)
371 simcall_BODY_process_cleanup(process);
375 * \ingroup simix_process_management
376 * \brief Migrates an agent to another location.
378 * This function changes the value of the host on which \a process is running.
380 * \param process the process to migrate
381 * \param dest name of the new host
383 void simcall_process_set_host(smx_actor_t process, sg_host_t dest)
385 simcall_BODY_process_set_host(process, dest);
388 void simcall_process_join(smx_actor_t process, double timeout)
390 simcall_BODY_process_join(process, timeout);
394 * \ingroup simix_process_management
395 * \brief Suspends a process.
397 * This function suspends the process by suspending the synchro
398 * it was waiting for completion.
400 * \param process a SIMIX process
402 void simcall_process_suspend(smx_actor_t process)
404 xbt_assert(process, "Invalid parameters");
406 simcall_BODY_process_suspend(process);
410 * \ingroup simix_process_management
411 * \brief Resumes a suspended process.
413 * This function resumes a suspended process by resuming the synchro
414 * it was waiting for completion.
416 * \param process a SIMIX process
418 void simcall_process_resume(smx_actor_t process)
420 simcall_BODY_process_resume(process);
424 * \ingroup simix_process_management
425 * \brief Returns the amount of SIMIX processes in the system
427 * Maestro internal process is not counted, only user code processes are
429 int simcall_process_count()
431 return simgrid::simix::kernelImmediate(SIMIX_process_count);
435 * \ingroup simix_process_management
436 * \brief Return the user data of a #smx_actor_t.
437 * \param process a SIMIX process
438 * \return the user data of this process
440 void* simcall_process_get_data(smx_actor_t process)
442 return SIMIX_process_get_data(process);
446 * \ingroup simix_process_management
447 * \brief Set the user data of a #smx_actor_t.
449 * This functions sets the user data associated to \a process.
450 * \param process SIMIX process
451 * \param data User data
453 void simcall_process_set_data(smx_actor_t process, void *data)
455 simgrid::simix::kernelImmediate(std::bind(SIMIX_process_set_data, process, data));
459 * \ingroup simix_process_management
460 * \brief Set the kill time of a process.
462 void simcall_process_set_kill_time(smx_actor_t process, double kill_time)
465 if (kill_time <= SIMIX_get_clock() || simix_global->kill_process_function == nullptr)
467 XBT_DEBUG("Set kill time %f for process %s(%s)",
468 kill_time, process->name.c_str(), sg_host_get_name(process->host));
469 process->kill_timer = SIMIX_timer_set(kill_time, [=] {
470 simix_global->kill_process_function(process);
471 process->kill_timer=nullptr;
475 * \ingroup simix_process_management
476 * \brief Get the kill time of a process (or 0 if unset).
478 double simcall_process_get_kill_time(smx_actor_t process) {
479 return SIMIX_timer_get_date(process->kill_timer);
483 * \ingroup simix_process_management
484 * \brief Returns true if the process is suspended .
486 * This checks whether a process is suspended or not by inspecting the task on which it was waiting for the completion.
487 * \param process SIMIX process
488 * \return 1, if the process is suspended, else 0.
490 int simcall_process_is_suspended(smx_actor_t process)
492 return simcall_BODY_process_is_suspended(process);
496 * \ingroup simix_process_management
497 * \brief Return the properties
499 * This functions returns the properties associated with this process
501 xbt_dict_t simcall_process_get_properties(smx_actor_t process)
503 return SIMIX_process_get_properties(process);
506 * \ingroup simix_process_management
507 * \brief Add an on_exit function
508 * Add an on_exit function which will be executed when the process exits/is killed.
510 XBT_PUBLIC(void) simcall_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data)
512 simcall_BODY_process_on_exit(process, fun, data);
515 * \ingroup simix_process_management
516 * \brief Sets the process to be auto-restarted or not by SIMIX when its host comes back up.
517 * Will restart the process when the host comes back up if auto_restart is set to 1.
520 XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_actor_t process, int auto_restart)
522 simcall_BODY_process_auto_restart_set(process, auto_restart);
526 * \ingroup simix_process_management
527 * \brief Restarts the process, killing it and starting it again from scratch.
529 XBT_PUBLIC(smx_actor_t) simcall_process_restart(smx_actor_t process)
531 return (smx_actor_t) simcall_BODY_process_restart(process);
534 * \ingroup simix_process_management
535 * \brief Creates a new sleep SIMIX synchro.
537 * This function creates a SURF action and allocates the data necessary
538 * to create the SIMIX synchro. It can raise a host_error exception if the
539 * host crashed. The default SIMIX name of the synchro is "sleep".
541 * \param duration Time duration of the sleep.
542 * \return A result telling whether the sleep was successful
544 e_smx_state_t simcall_process_sleep(double duration)
546 /* checking for infinite values */
547 xbt_assert(std::isfinite(duration), "duration is not finite!");
548 return (e_smx_state_t) simcall_BODY_process_sleep(duration);
552 * \ingroup simix_mbox_management
553 * \brief Creates a new rendez-vous point
554 * \param name The name of the rendez-vous point
555 * \return The created rendez-vous point
557 smx_mailbox_t simcall_mbox_create(const char *name)
559 return simcall_BODY_mbox_create(name);
562 void simcall_mbox_set_receiver(smx_mailbox_t mbox, smx_actor_t process)
564 simcall_BODY_mbox_set_receiver(mbox, process);
568 * \ingroup simix_comm_management
570 void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate,
571 void *src_buff, size_t src_buff_size,
572 int (*match_fun)(void *, void *, smx_activity_t),
573 void (*copy_data_fun)(smx_activity_t, void*, size_t), void *data,
576 /* checking for infinite values */
577 xbt_assert(std::isfinite(task_size), "task_size is not finite!");
578 xbt_assert(std::isfinite(rate), "rate is not finite!");
579 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
581 xbt_assert(mbox, "No rendez-vous point defined for send");
583 if (MC_is_active() || MC_record_replay_is_active()) {
584 /* the model-checker wants two separate simcalls */
585 smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simcall */
586 comm = simcall_comm_isend(sender, mbox, task_size, rate,
587 src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, 0);
588 simcall_comm_wait(comm, timeout);
592 simcall_BODY_comm_send(sender, mbox, task_size, rate, src_buff, src_buff_size,
593 match_fun, copy_data_fun, data, timeout);
598 * \ingroup simix_comm_management
600 smx_activity_t simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate,
601 void *src_buff, size_t src_buff_size,
602 int (*match_fun)(void *, void *, smx_activity_t),
603 void (*clean_fun)(void *),
604 void (*copy_data_fun)(smx_activity_t, void*, size_t),
608 /* checking for infinite values */
609 xbt_assert(std::isfinite(task_size), "task_size is not finite!");
610 xbt_assert(std::isfinite(rate), "rate is not finite!");
612 xbt_assert(mbox, "No rendez-vous point defined for isend");
614 return simcall_BODY_comm_isend(sender, mbox, task_size, rate, src_buff,
615 src_buff_size, match_fun,
616 clean_fun, copy_data_fun, data, detached);
620 * \ingroup simix_comm_management
622 void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t * dst_buff_size,
623 int (*match_fun)(void *, void *, smx_activity_t),
624 void (*copy_data_fun)(smx_activity_t, void*, size_t),
625 void *data, double timeout, double rate)
627 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
628 xbt_assert(mbox, "No rendez-vous point defined for recv");
630 if (MC_is_active() || MC_record_replay_is_active()) {
631 /* the model-checker wants two separate simcalls */
632 smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simcall */
633 comm = simcall_comm_irecv(receiver, mbox, dst_buff, dst_buff_size,
634 match_fun, copy_data_fun, data, rate);
635 simcall_comm_wait(comm, timeout);
639 simcall_BODY_comm_recv(receiver, mbox, dst_buff, dst_buff_size,
640 match_fun, copy_data_fun, data, timeout, rate);
644 * \ingroup simix_comm_management
646 smx_activity_t simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size,
647 int (*match_fun)(void *, void *, smx_activity_t),
648 void (*copy_data_fun)(smx_activity_t, void*, size_t),
649 void *data, double rate)
651 xbt_assert(mbox, "No rendez-vous point defined for irecv");
653 return simcall_BODY_comm_irecv(receiver, mbox, dst_buff, dst_buff_size,
654 match_fun, copy_data_fun, data, rate);
658 * \ingroup simix_comm_management
660 smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag,
661 int (*match_fun)(void *, void *, smx_activity_t), void *data)
663 xbt_assert(mbox, "No rendez-vous point defined for iprobe");
665 return simcall_BODY_comm_iprobe(mbox, type, src, tag, match_fun, data);
669 * \ingroup simix_comm_management
671 void simcall_comm_cancel(smx_activity_t synchro)
673 simgrid::simix::kernelImmediate([synchro]{
674 simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
680 * \ingroup simix_comm_management
682 unsigned int simcall_comm_waitany(xbt_dynar_t comms, double timeout)
684 return simcall_BODY_comm_waitany(comms, timeout);
688 * \ingroup simix_comm_management
690 int simcall_comm_testany(smx_activity_t* comms, size_t count)
694 return simcall_BODY_comm_testany(comms, count);
698 * \ingroup simix_comm_management
700 void simcall_comm_wait(smx_activity_t comm, double timeout)
702 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
703 simcall_BODY_comm_wait(comm, timeout);
707 * \brief Set the category of an synchro.
709 * This functions changes the category only. It calls a surf function.
710 * \param execution The execution synchro
711 * \param category The tracing category
713 void simcall_set_category(smx_activity_t synchro, const char *category)
715 if (category == nullptr) {
718 simcall_BODY_set_category(synchro, category);
722 * \ingroup simix_comm_management
725 int simcall_comm_test(smx_activity_t comm)
727 return simcall_BODY_comm_test(comm);
731 * \ingroup simix_synchro_management
734 smx_mutex_t simcall_mutex_init()
737 fprintf(stderr,"You must run MSG_init before using MSG\n"); // We can't use xbt_die since we may get there before the initialization
740 return simcall_BODY_mutex_init();
744 * \ingroup simix_synchro_management
747 void simcall_mutex_lock(smx_mutex_t mutex)
749 simcall_BODY_mutex_lock(mutex);
753 * \ingroup simix_synchro_management
756 int simcall_mutex_trylock(smx_mutex_t mutex)
758 return simcall_BODY_mutex_trylock(mutex);
762 * \ingroup simix_synchro_management
765 void simcall_mutex_unlock(smx_mutex_t mutex)
767 simcall_BODY_mutex_unlock(mutex);
771 * \ingroup simix_synchro_management
774 smx_cond_t simcall_cond_init()
776 return simcall_BODY_cond_init();
780 * \ingroup simix_synchro_management
783 void simcall_cond_signal(smx_cond_t cond)
785 simcall_BODY_cond_signal(cond);
789 * \ingroup simix_synchro_management
792 void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
794 simcall_BODY_cond_wait(cond, mutex);
798 * \ingroup simix_synchro_management
801 void simcall_cond_wait_timeout(smx_cond_t cond,
805 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
806 simcall_BODY_cond_wait_timeout(cond, mutex, timeout);
810 * \ingroup simix_synchro_management
813 void simcall_cond_broadcast(smx_cond_t cond)
815 simcall_BODY_cond_broadcast(cond);
819 * \ingroup simix_synchro_management
822 smx_sem_t simcall_sem_init(int capacity)
824 return simcall_BODY_sem_init(capacity);
828 * \ingroup simix_synchro_management
831 void simcall_sem_release(smx_sem_t sem)
833 simcall_BODY_sem_release(sem);
837 * \ingroup simix_synchro_management
840 int simcall_sem_would_block(smx_sem_t sem)
842 return simcall_BODY_sem_would_block(sem);
846 * \ingroup simix_synchro_management
849 void simcall_sem_acquire(smx_sem_t sem)
851 simcall_BODY_sem_acquire(sem);
855 * \ingroup simix_synchro_management
858 void simcall_sem_acquire_timeout(smx_sem_t sem, double timeout)
860 xbt_assert(std::isfinite(timeout), "timeout is not finite!");
861 simcall_BODY_sem_acquire_timeout(sem, timeout);
865 * \ingroup simix_synchro_management
868 int simcall_sem_get_capacity(smx_sem_t sem)
870 return simcall_BODY_sem_get_capacity(sem);
874 * \ingroup simix_file_management
877 sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
879 return simcall_BODY_file_read(fd, size, host);
883 * \ingroup simix_file_management
886 sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
888 return simcall_BODY_file_write(fd, size, host);
892 * \ingroup simix_file_management
895 smx_file_t simcall_file_open(const char* fullpath, sg_host_t host)
897 return simcall_BODY_file_open(fullpath, host);
901 * \ingroup simix_file_management
904 int simcall_file_close(smx_file_t fd, sg_host_t host)
906 return simcall_BODY_file_close(fd, host);
910 * \ingroup simix_file_management
913 int simcall_file_unlink(smx_file_t fd, sg_host_t host)
915 return simcall_BODY_file_unlink(fd, host);
919 * \ingroup simix_file_management
922 sg_size_t simcall_file_get_size(smx_file_t fd){
923 return simcall_BODY_file_get_size(fd);
927 * \ingroup simix_file_management
930 sg_size_t simcall_file_tell(smx_file_t fd){
931 return simcall_BODY_file_tell(fd);
935 * \ingroup simix_file_management
938 xbt_dynar_t simcall_file_get_info(smx_file_t fd)
940 return simcall_BODY_file_get_info(fd);
944 * \ingroup simix_file_management
947 int simcall_file_seek(smx_file_t fd, sg_offset_t offset, int origin){
948 return simcall_BODY_file_seek(fd, offset, origin);
952 * \ingroup simix_file_management
953 * \brief Move a file to another location on the *same mount point*.
956 int simcall_file_move(smx_file_t fd, const char* fullpath)
958 return simcall_BODY_file_move(fd, fullpath);
962 * \ingroup simix_storage_management
963 * \brief Returns the free space size on a given storage element.
964 * \param storage a storage
965 * \return Return the free space size on a given storage element (as sg_size_t)
967 sg_size_t simcall_storage_get_free_size (smx_storage_t storage){
968 return simcall_BODY_storage_get_free_size(storage);
972 * \ingroup simix_storage_management
973 * \brief Returns the used space size on a given storage element.
974 * \param storage a storage
975 * \return Return the used space size on a given storage element (as sg_size_t)
977 sg_size_t simcall_storage_get_used_size (smx_storage_t storage){
978 return simcall_BODY_storage_get_used_size(storage);
982 * \ingroup simix_storage_management
983 * \brief Returns a dict of the properties assigned to a storage element.
985 * \param storage A storage element
986 * \return The properties of this storage element
988 xbt_dict_t simcall_storage_get_properties(smx_storage_t storage)
990 return simcall_BODY_storage_get_properties(storage);
994 * \ingroup simix_storage_management
995 * \brief Returns a dict containing the content of a storage element.
997 * \param storage A storage element
998 * \return The content of this storage element as a dict (full path file => size)
1000 xbt_dict_t simcall_storage_get_content(smx_storage_t storage)
1002 return simcall_BODY_storage_get_content(storage);
1005 void simcall_run_kernel(std::function<void()> const& code)
1007 simcall_BODY_run_kernel(&code);
1010 void simcall_run_blocking(std::function<void()> const& code)
1012 simcall_BODY_run_blocking(&code);
1015 int simcall_mc_random(int min, int max) {
1016 return simcall_BODY_mc_random(min, max);
1019 /* ************************************************************************** */
1021 /** @brief returns a printable string representing a simcall */
1022 const char *SIMIX_simcall_name(e_smx_simcall_t kind) {
1023 return simcall_names[kind];
1029 void unblock(smx_actor_t process)
1031 xbt_assert(SIMIX_is_maestro());
1032 SIMIX_simcall_answer(&process->simcall);