Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge s4u wait_any
[simgrid.git] / src / simix / simcalls.in
index 38a52ec..476dd57 100644 (file)
-# Copyright (c) 2014. The SimGrid Team.
-# All rights reserved.
+# Copyright (c) 2014-2016. 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.
 
-# name has_answer (restype,rescast) (arg0name,arg0type,arg0cast) (arg1name,arg1type,arg1cast)
-host_get_by_name True (void*, smx_host_t) (name, const char*)
-host_get_name True (const char*) (host, void*, smx_host_t)
-host_on True (void) (host, void*, smx_host_t)
-host_off True (void) (host, void*, smx_host_t)
-host_get_properties True (void*, xbt_dict_t) (host, void*, smx_host_t)
-host_get_core True (int) (host, void*, smx_host_t)
-host_get_process_list True (void*, xbt_swag_t) (host, void*, smx_host_t)
-host_get_speed True (double) (host, void*, smx_host_t)
-host_get_available_speed True (double) (host, void*, smx_host_t)
-host_get_state True (int) (host, void*, smx_host_t)
-host_get_current_power_peak True (double) (host, void*, smx_host_t)
-host_get_power_peak_at True (double) (host, void*, smx_host_t) (pstate_index, int)
-host_get_nb_pstates True (int) (host, void*, smx_host_t)
-host_set_power_peak_at True (void) (host, void*, smx_host_t) (pstate_index, int)
-host_get_consumed_energy True (double) (host, void*, smx_host_t)
-host_execute True (void*, smx_action_t) (name, const char*) (host, void*, smx_host_t) (computation_amount, double) (priority, double) (bound, double) (affinity_mask, unsigned long)
-host_parallel_execute True (void*, smx_action_t) (name, const char*) (host_nb, int) (host_list, void*, smx_host_t*) (computation_amount, void*, double*) (communication_amount, void*, double*) (amount, double) (rate, double)
-host_execution_destroy True (void) (execution, void*, smx_action_t)
-host_execution_cancel True (void) (execution, void*, smx_action_t)
-host_execution_get_remains True (double) (execution, void*, smx_action_t)
-host_execution_get_state True (int) (execution, void*, smx_action_t)
-host_execution_set_priority True (void) (execution, void*, smx_action_t) (priority, double)
-host_execution_set_bound True (void) (execution, void*, smx_action_t) (bound, double)
-host_execution_set_affinity True (void) (execution, void*, smx_action_t) (ws, void*, smx_host_t) (mask, unsigned long)
-host_execution_wait False (int) (execution, void*, smx_action_t)
-host_get_mounted_storage_list True (void*, xbt_dict_t) (host, void*, smx_host_t)
-host_get_attached_storage_list True (void*, xbt_dynar_t) (host, void*, smx_host_t)
-host_get_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
-host_set_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
-vm_create True (void*) (name, const char*) (ind_pm, void*, smx_host_t)
-vm_start True (void) (ind_vm, void*, smx_host_t)
-vm_get_state True (int) (ind_vm, void*, smx_host_t)
-vm_migrate True (void) (ind_vm, void*, smx_host_t) (ind_dst_pm, void*, smx_host_t)
-vm_get_pm True (void*) (ind_vm, void*, smx_host_t)
-vm_set_bound True (void) (ind_vm, void*, smx_host_t) (bound, double)
-vm_set_affinity True (void) (ind_vm, void*, smx_host_t) (ind_pm, void*, smx_host_t) (mask, unsigned long)
-vm_destroy True (void) (ind_vm, void*, smx_host_t)
-vm_suspend True (void) (ind_vm, void*, smx_host_t)
-vm_resume True (void) (ind_vm, void*, smx_host_t)
-vm_shutdown True (void) (ind_vm, void*, smx_host_t)
-vm_save True (void) (ind_vm, void*, smx_host_t)
-vm_restore True (void) (ind_vm, void*, smx_host_t)
-process_create True (void) (process, void*, smx_process_t*) (name, const char*) (code, FPtr, xbt_main_func_t) (data, void*) (hostname, const char*) (kill_time, double) (argc, int) (argv, void*, char**) (properties, void*, xbt_dict_t) (auto_restart, int)
-process_kill True (void) (process, void*, smx_process_t)
-process_killall True (void) (reset_pid, int)
-process_cleanup True (void) (process, void*, smx_process_t)
-process_change_host True (void) (process, void*, smx_process_t) (dest, void*, smx_host_t)
-process_suspend False (void) (process, void*, smx_process_t)
-process_resume True (void) (process, void*, smx_process_t)
-process_count True (int)
-process_get_PID True (int) (process, void*, smx_process_t)
-process_get_PPID True (int) (process, void*, smx_process_t)
-process_get_data True (void*) (process, void*, smx_process_t)
-process_set_data True (void) (process, void*, smx_process_t) (data, void*)
-process_get_host True (void*, smx_host_t) (process, void*, smx_process_t)
-process_get_name True (const char*) (process, void*, smx_process_t)
-process_is_suspended True (int) (process, void*, smx_process_t)
-process_get_properties True (void*, xbt_dict_t) (process, void*, smx_process_t)
-process_join False (int) (process, void*, smx_process_t) (timeout, double)
-process_sleep False (int) (duration, double)
-process_on_exit True (void) (process, void*, smx_process_t) (fun, FPtr, int_f_pvoid_pvoid_t) (data, void*)
-process_auto_restart_set True (void) (process, void*, smx_process_t) (auto_restart, int)
-process_restart True (void*, smx_process_t) (process, void*, smx_process_t)
-rdv_create True (void*, smx_rdv_t) (name, const char*)
-rdv_destroy True (void) (rdv, void*, smx_rdv_t)
-#rdv_get_by_name True (void*, smx_host_t) (name, const char*)
-rdv_comm_count_by_host True (unsigned int) (rdv, void*, smx_rdv_t) (host, void*, smx_host_t)
-rdv_get_head True (void*, smx_action_t) (rdv, void*, smx_rdv_t)
-rdv_set_receiver True (void) (rdv, void*, smx_rdv_t) (receiver, void*, smx_process_t)
-rdv_get_receiver True (void*, smx_process_t) (rdv, void*, smx_rdv_t)
-comm_iprobe True (void*, smx_action_t) (rdv, void*, smx_rdv_t) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*)
-comm_send False (void) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t)  (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double)
-comm_isend True (void*, smx_action_t) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t) (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (clean_fun, FPtr, simix_clean_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (detached, int)
-comm_recv False (void) (rdv, void*, smx_rdv_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double) (rate, double)
-comm_irecv True (void*, smx_action_t) (rdv, void*, smx_rdv_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (rate, double)
-comm_cancel True (void) (comm, void*, smx_action_t)
-comm_waitany False (int) (comms, void*, xbt_dynar_t)
-comm_wait False (void) (comm, void*, smx_action_t) (timeout, double)
-comm_test False (int) (comm, void*, smx_action_t)
-comm_testany False (int) (comms, void*, xbt_dynar_t)
-comm_get_remains True (double) (comm, void*, smx_action_t)
-comm_get_state True (int) (comm, void*, smx_action_t)
-comm_get_src_data True (void*) (comm, void*, smx_action_t)
-comm_get_dst_data True (void*) (comm, void*, smx_action_t)
-comm_get_src_proc True (void*, smx_process_t) (comm, void*, smx_action_t)
-comm_get_dst_proc True (void*, smx_process_t) (comm, void*, smx_action_t)
-mutex_init True (void*, smx_mutex_t)
-mutex_destroy True (void) (mutex, void*, smx_mutex_t)
-mutex_lock False (void) (mutex, void*, smx_mutex_t)
-mutex_trylock True (int) (mutex, void*, smx_mutex_t)
-mutex_unlock True (void) (mutex, void*, smx_mutex_t)
-cond_init True (void*, smx_cond_t)
-cond_destroy True (void) (cond, void*, smx_cond_t)
-cond_signal True (void) (cond, void*, smx_cond_t)
-cond_wait False (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t)
-cond_wait_timeout False (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t) (timeout, double)
-cond_broadcast True (void) (cond, void*, smx_cond_t)
-sem_init True (void*, smx_sem_t) (capacity, int)
-sem_destroy True (void) (sem, void*, smx_sem_t)
-sem_release True (void) (sem, void*, smx_sem_t)
-sem_would_block True (int) (sem, void*, smx_sem_t)
-sem_acquire False (void) (sem, void*, smx_sem_t)
-sem_acquire_timeout False (void) (sem, void*, smx_sem_t) (timeout, double)
-sem_get_capacity True (int) (sem, void*, smx_sem_t)
-file_read False (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, smx_host_t)
-file_write False (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, smx_host_t)
-file_open False (void*, smx_file_t) (fullpath, const char*) (host, void*, smx_host_t)
-file_close False (int) (fd, void*, smx_file_t) (host, void*, smx_host_t)
-file_unlink True (int) (fd, void*, smx_file_t) (host, void*, smx_host_t)
-file_get_size True (sg_size_t) (fd, void*, smx_file_t)
-file_tell True (sg_size_t) (fd, void*, smx_file_t)
-file_seek True (int) (fd, void*, smx_file_t) (offset, sg_offset_t) (origin, int)
-file_get_info True (void*, xbt_dynar_t) (fd, void*, smx_file_t)
-file_move True (int) (fd, void*, smx_file_t) (fullpath, const char*)
-storage_get_free_size True (sg_size_t) (storage, void*, smx_storage_t)
-storage_get_used_size True (sg_size_t) (name, void*, smx_storage_t)
-storage_get_properties True (void*, xbt_dict_t) (storage, void*, smx_storage_t)
-storage_get_content True (void*, xbt_dict_t) (storage, void*, smx_storage_t)
-asr_get_properties True (void*, xbt_dict_t) (name, const char*)
-## HAVE_LATENCY_BOUND_TRACKING
-comm_is_latency_bounded True (int) (comm, void*, smx_action_t)
-## HAVE_TRACING
-set_category True (void) (action, void*, smx_action_t) (category, const char*)
-## HAVE_MC
-mc_snapshot True (void*)
-mc_compare_snapshots True (int) (s1, void*) (s2, void*)
-mc_random True (int) (min, int) (max, int)
+# The simcalls are given as C-like signatures (one per line):
+#
+# int foo(int x, int y);
+# int foo(int x, int y) [[block]];
+# int foo(int x, int y) [[nohandler]];
+# int foo(int x, int y) [[block, nohandler]];
+#
+# The `block` attribut is used for calls which do not return in the same
+# scheduling round. The answer requires some interaction with SURF,
+# even if this can still occure at the same timestamp under some
+# circonstances (eg if the surf_action cannot start because of resources
+# that are down) examples: things that last some time (communicate, execute,
+# mutex_lock).
+#
+# The `nohandler` is used to disable handlers.
+# I wish we could completely remove the handlers as their only use is
+# to adapt the interface between the exported symbol that is visible
+# by the user applications and the internal symbol that is implemented 
+# by the kernel. 
+# The only remaining use of that mechanism is to add the caller
+# identity as a parameter of internal call, but that could be
+# automatized too (eg by having a special parameter type called "self")
+
+# Please note that in addition to completing this file with your new simcall,
+# you should complete the libsmx.c file by adding the corresponding function
+# (aka. stub). Anyway, if you omit to do it, the invocation of ./simcalls.py will notify you ;)
+# If you want to remove an handler, it is important to remove although
+# the corresponding code (simcall_HANDLER_name_of_simcall(xxx) (note that comment the code 
+# is not sufficient, the python script does not check whether the code is commented or not).
+# Last but not the least, you should declare the new simix call in
+# ./include/simgrid/simix.h (otherwise you will get a warning at the
+# compilation time)
+
+void vm_suspend(sg_host_t ind_vm);
+void vm_resume(sg_host_t ind_vm);
+void vm_shutdown(sg_host_t ind_vm);
+void vm_save(sg_host_t ind_vm);
+void vm_restore(sg_host_t ind_vm);
+
+void process_kill(smx_process_t process);
+void process_killall(int reset_pid);
+void process_cleanup(smx_process_t process) [[nohandler]];
+void process_suspend(smx_process_t process) [[block]];
+void process_resume(smx_process_t process);
+void process_set_host(smx_process_t process, sg_host_t dest);
+int  process_is_suspended(smx_process_t process) [[nohandler]];
+int  process_join(smx_process_t process, double timeout) [[block]];
+int  process_sleep(double duration) [[block]];
+
+smx_synchro_t execution_start(const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask);
+smx_synchro_t execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate) [[nohandler]];
+void          execution_cancel(smx_synchro_t execution) [[nohandler]];
+void          execution_set_priority(smx_synchro_t execution, double priority) [[nohandler]];
+void          execution_set_bound(smx_synchro_t execution, double bound) [[nohandler]];
+void          execution_set_affinity(smx_synchro_t execution, sg_host_t ws, unsigned long mask) [[nohandler]];
+int           execution_wait(smx_synchro_t execution) [[block]];
+
+void          process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void* data) [[nohandler]];
+void          process_auto_restart_set(smx_process_t process, int auto_restart) [[nohandler]];
+smx_process_t process_restart(smx_process_t process);
+
+smx_mailbox_t mbox_create(const char* name) [[nohandler]];
+void          mbox_set_receiver(smx_mailbox_t mbox, smx_process_t receiver) [[nohandler]];
+
+smx_synchro_t comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag, simix_match_func_t match_fun, void* data);
+void          comm_send(smx_process_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout) [[block]];
+smx_synchro_t comm_isend(smx_process_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached);
+void          comm_recv(smx_process_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) [[block]];
+smx_synchro_t comm_irecv(smx_process_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate);
+int           comm_waitany(xbt_dynar_t comms, double timeout) [[block]];
+void          comm_wait(smx_synchro_t comm, double timeout) [[block]];
+int           comm_test(smx_synchro_t comm) [[block]];
+int           comm_testany(smx_synchro_t* comms, size_t count) [[block]];
+
+smx_mutex_t mutex_init();
+void        mutex_lock(smx_mutex_t mutex) [[block]];
+int         mutex_trylock(smx_mutex_t mutex);
+void        mutex_unlock(smx_mutex_t mutex);
+
+smx_cond_t cond_init() [[nohandler]];
+void       cond_signal(smx_cond_t cond) [[nohandler]];
+void       cond_wait(smx_cond_t cond, smx_mutex_t mutex) [[block]];
+void       cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) [[block]];
+void       cond_broadcast(smx_cond_t cond) [[nohandler]];
+
+smx_sem_t sem_init(unsigned int capacity) [[nohandler]];
+void      sem_release(smx_sem_t sem);
+int       sem_would_block(smx_sem_t sem);
+void      sem_acquire(smx_sem_t sem) [[block]];
+void      sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
+int       sem_get_capacity(smx_sem_t sem);
+
+sg_size_t   file_read(smx_file_t fd, sg_size_t size, sg_host_t host) [[block]];
+sg_size_t   file_write(smx_file_t fd, sg_size_t size, sg_host_t host) [[block]];
+smx_file_t  file_open(const char* fullpath, sg_host_t host) [[block]];
+int         file_close(smx_file_t fd, sg_host_t host) [[block]];
+int         file_unlink(smx_file_t fd, sg_host_t host) [[nohandler]];
+sg_size_t   file_get_size(smx_file_t fd);
+sg_size_t   file_tell(smx_file_t fd);
+int         file_seek(smx_file_t fd, sg_offset_t offset, int origin);
+xbt_dynar_t file_get_info(smx_file_t fd);
+int         file_move(smx_file_t fd, const char* fullpath);
+
+sg_size_t  storage_get_free_size(smx_storage_t storage);
+sg_size_t  storage_get_used_size(smx_storage_t name);
+xbt_dict_t storage_get_properties(smx_storage_t storage) [[nohandler]];
+xbt_dict_t storage_get_content(smx_storage_t storage) [[nohandler]];
+
+xbt_dict_t asr_get_properties(const char* name);
+int        mc_random(int min, int max);
+void       set_category(smx_synchro_t synchro, const char* category) [[nohandler]];
+
+void       run_kernel(std::function<void()> const* code) [[nohandler]];
+void       run_blocking(std::function<void()> const* code) [[block,nohandler]];