X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fc727903530d55d5d3f903a8213c7cb8a3273c7a..7e9b6e88f6c2daa87a9f5370596e5acc7f73fc6a:/src/simix/smx_user.c diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 455b98d52a..0987155253 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -214,7 +214,7 @@ smx_action_t simcall_host_parallel_execute(const char *name, xbt_assert(isfinite(computation_amount[i]), "computation_amount[%d] is not finite!", i); for (j = 0 ; j < host_nb ; ++j) { xbt_assert(isfinite(communication_amount[i + host_nb * j]), - "communication_amount[%d+%d*%d] is not finite!", i, host_nb, j); + "communication_amount[%d+%d*%d] is not finite!", i, host_nb, j); } } @@ -521,6 +521,24 @@ void simcall_process_set_data(smx_process_t process, void *data) } } +/** + * \brief Set the kill time of a process. + * + * \param process a process + * \param kill_time a double + */ +void simcall_process_set_kill_time(smx_process_t process, double kill_time) +{ + + if (kill_time > SIMIX_get_clock()) { + if (simix_global->kill_process_function) { + XBT_DEBUG("Set kill time %f for process %s(%s)",kill_time, process->name, + process->smx_host->name); + SIMIX_timer_set(kill_time, simix_global->kill_process_function, process); + } + } +} + /** * \brief Return the location on which an agent is running. * @@ -598,8 +616,8 @@ xbt_dict_t simcall_process_get_properties(smx_process_t process) * to create the SIMIX action. It can raise a host_error exception if the * host crashed. The default SIMIX name of the action is "sleep". * - * \param duration Time duration of the sleep. - * \return A result telling whether the sleep was successful + * \param duration Time duration of the sleep. + * \return A result telling whether the sleep was successful */ e_smx_state_t simcall_process_sleep(double duration) { @@ -987,6 +1005,10 @@ int simcall_comm_is_latency_bounded(smx_action_t comm) smx_mutex_t simcall_mutex_init(void) { + if(!simix_global) { + fprintf(stderr,"You must run MSG_global_init or gras_init before using MSG or GRAS\n"); // I would have loved using xbt_die but I can't since it is not initialized yet... :) + abort(); + } smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_MUTEX_INIT; @@ -1181,12 +1203,11 @@ int simcall_sem_get_capacity(smx_sem_t sem) return simcall->sem_get_capacity.result; } -size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream) +size_t simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_READ; - simcall->file_read.storage = storage; simcall->file_read.ptr = ptr; simcall->file_read.size = size; simcall->file_read.nmemb = nmemb; @@ -1196,12 +1217,11 @@ size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nme return simcall->file_read.result; } -size_t simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream) +size_t simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_WRITE; - simcall->file_write.storage = storage; simcall->file_write.ptr = ptr; simcall->file_write.size = size; simcall->file_write.nmemb = nmemb; @@ -1211,12 +1231,12 @@ size_t simcall_file_write(const char* storage, const void* ptr, size_t size, siz return simcall->file_write.result; } -smx_file_t simcall_file_open(const char* storage, const char* path, const char* mode) +smx_file_t simcall_file_open(const char* mount, const char* path, const char* mode) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_OPEN; - simcall->file_open.storage = storage; + simcall->file_open.mount = mount; simcall->file_open.path = path; simcall->file_open.mode = mode; SIMIX_simcall_push(simcall->issuer); @@ -1224,23 +1244,21 @@ smx_file_t simcall_file_open(const char* storage, const char* path, const char* return simcall->file_open.result; } -int simcall_file_close(const char* storage, smx_file_t fp) +int simcall_file_close(smx_file_t fp) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_CLOSE; - simcall->file_close.storage = storage; simcall->file_close.fp = fp; SIMIX_simcall_push(simcall->issuer); return simcall->file_close.result; } -int simcall_file_stat(const char* storage, smx_file_t fd, s_file_stat_t *buf) +int simcall_file_stat(smx_file_t fd, s_file_stat_t *buf) { smx_simcall_t simcall = SIMIX_simcall_mine(); simcall->call = SIMCALL_FILE_STAT; - simcall->file_stat.storage = storage; simcall->file_stat.fd = fd; SIMIX_simcall_push(simcall->issuer);