/* Simulation execution */
XBT_PUBLIC(void) SIMIX_run(void);
+ XBT_INLINE XBT_PUBLIC(double) SIMIX_get_clock(void);
/* Timer functions FIXME: should these be public? */
XBT_PUBLIC(void) SIMIX_timer_set(double date, void *function, void *arg);
XBT_PUBLIC(void) SIMIX_comm_finish(smx_action_t action);
/******************************************************************************/
- /* SIMIX Smurf Proxy Functions */
+ /* SIMIX simcalls */
/******************************************************************************/
- /* These functions issue request through the Smurf proxy. */
- /* They cannot be called from maestro's context, and they are thread safe. */
+ /* These functions are a system call-like interface to the simulation kernel. */
+ /* They can also be called from maestro's context, and they are thread safe. */
/******************************************************************************/
- XBT_INLINE XBT_PUBLIC(double) SIMIX_get_clock(void);
-
- /******************************* Host Requests ********************************/
- /* FIXME: use handlers and keep smx_host_t hidden from higher levels */
- XBT_PUBLIC(xbt_dict_t) SIMIX_req_host_get_dict(void);
- XBT_INLINE XBT_PUBLIC(smx_host_t) SIMIX_req_host_get_by_name(const char *name);
- XBT_PUBLIC(const char *) SIMIX_req_host_get_name(smx_host_t host);
- XBT_PUBLIC(xbt_dict_t) SIMIX_req_host_get_properties(smx_host_t host);
- XBT_PUBLIC(double) SIMIX_req_host_get_speed(smx_host_t host);
- XBT_PUBLIC(double) SIMIX_req_host_get_available_speed(smx_host_t host);
+ /******************************* Host simcalls ********************************/
+ /* TODO use handlers and keep smx_host_t hidden from higher levels */
+ XBT_PUBLIC(xbt_dict_t) simcall_host_get_dict(void);
+ XBT_INLINE XBT_PUBLIC(smx_host_t) simcall_host_get_by_name(const char *name);
+ XBT_PUBLIC(const char *) simcall_host_get_name(smx_host_t host);
+ XBT_PUBLIC(xbt_dict_t) simcall_host_get_properties(smx_host_t host);
+ XBT_PUBLIC(double) simcall_host_get_speed(smx_host_t host);
+ XBT_PUBLIC(double) simcall_host_get_available_speed(smx_host_t host);
/* Two possible states, 1 - CPU ON and 0 CPU OFF */
- XBT_PUBLIC(int) SIMIX_req_host_get_state(smx_host_t host);
- XBT_PUBLIC(void *) SIMIX_req_host_get_data(smx_host_t host);
+ XBT_PUBLIC(int) simcall_host_get_state(smx_host_t host);
+ XBT_PUBLIC(void *) simcall_host_get_data(smx_host_t host);
- XBT_PUBLIC(void) SIMIX_req_host_set_data(smx_host_t host, void *data);
+ XBT_PUBLIC(void) simcall_host_set_data(smx_host_t host, void *data);
- XBT_PUBLIC(smx_action_t) SIMIX_req_host_execute(const char *name, smx_host_t host,
+ XBT_PUBLIC(smx_action_t) simcall_host_execute(const char *name, smx_host_t host,
double computation_amount,
double priority);
- XBT_PUBLIC(smx_action_t) SIMIX_req_host_parallel_execute(const char *name,
+ XBT_PUBLIC(smx_action_t) simcall_host_parallel_execute(const char *name,
int host_nb,
smx_host_t *host_list,
double *computation_amount,
double *communication_amount,
double amount,
double rate);
- XBT_PUBLIC(void) SIMIX_req_host_execution_destroy(smx_action_t execution);
- XBT_PUBLIC(void) SIMIX_req_host_execution_cancel(smx_action_t execution);
- XBT_PUBLIC(double) SIMIX_req_host_execution_get_remains(smx_action_t execution);
- XBT_PUBLIC(e_smx_state_t) SIMIX_req_host_execution_get_state(smx_action_t execution);
- XBT_PUBLIC(void) SIMIX_req_host_execution_set_priority(smx_action_t execution, double priority);
- XBT_PUBLIC(e_smx_state_t) SIMIX_req_host_execution_wait(smx_action_t execution);
+ XBT_PUBLIC(void) simcall_host_execution_destroy(smx_action_t execution);
+ XBT_PUBLIC(void) simcall_host_execution_cancel(smx_action_t execution);
+ XBT_PUBLIC(double) simcall_host_execution_get_remains(smx_action_t execution);
+ XBT_PUBLIC(e_smx_state_t) simcall_host_execution_get_state(smx_action_t execution);
+ XBT_PUBLIC(void) simcall_host_execution_set_priority(smx_action_t execution, double priority);
+ XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution);
- /**************************** Process Requests ********************************/
+ /**************************** Process simcalls ********************************/
/* Constructor and Destructor */
- XBT_PUBLIC(void) SIMIX_req_process_create(smx_process_t *process,
+ XBT_PUBLIC(void) simcall_process_create(smx_process_t *process,
const char *name,
xbt_main_func_t code,
void *data,
int argc, char **argv,
xbt_dict_t properties);
- XBT_PUBLIC(void) SIMIX_req_process_kill(smx_process_t process);
- XBT_PUBLIC(void) SIMIX_req_process_killall(void);
+ XBT_PUBLIC(void) simcall_process_kill(smx_process_t process);
+ XBT_PUBLIC(void) simcall_process_killall(void);
/* Process handling */
- XBT_PUBLIC(void) SIMIX_req_process_cleanup(smx_process_t process);
- XBT_PUBLIC(void) SIMIX_req_process_change_host(smx_process_t process,
+ XBT_PUBLIC(void) simcall_process_cleanup(smx_process_t process);
+ XBT_PUBLIC(void) simcall_process_change_host(smx_process_t process,
smx_host_t dest);
- XBT_PUBLIC(void) SIMIX_req_process_suspend(smx_process_t process);
- XBT_PUBLIC(void) SIMIX_req_process_resume(smx_process_t process);
+ XBT_PUBLIC(void) simcall_process_suspend(smx_process_t process);
+ XBT_PUBLIC(void) simcall_process_resume(smx_process_t process);
/* Getters and Setters */
- XBT_PUBLIC(int) SIMIX_req_process_count(void);
- XBT_PUBLIC(void *) SIMIX_req_process_get_data(smx_process_t process);
- XBT_PUBLIC(void) SIMIX_req_process_set_data(smx_process_t process, void *data);
- XBT_INLINE XBT_PUBLIC(smx_host_t) SIMIX_req_process_get_host(smx_process_t process);
- XBT_PUBLIC(const char *) SIMIX_req_process_get_name(smx_process_t process);
- XBT_PUBLIC(int) SIMIX_req_process_is_suspended(smx_process_t process);
- XBT_PUBLIC(xbt_dict_t) SIMIX_req_process_get_properties(smx_process_t host);
+ XBT_PUBLIC(int) simcall_process_count(void);
+ XBT_PUBLIC(void *) simcall_process_get_data(smx_process_t process);
+ XBT_PUBLIC(void) simcall_process_set_data(smx_process_t process, void *data);
+ XBT_INLINE XBT_PUBLIC(smx_host_t) simcall_process_get_host(smx_process_t process);
+ XBT_PUBLIC(const char *) simcall_process_get_name(smx_process_t process);
+ XBT_PUBLIC(int) simcall_process_is_suspended(smx_process_t process);
+ XBT_PUBLIC(xbt_dict_t) simcall_process_get_properties(smx_process_t host);
/* Sleep control */
- XBT_PUBLIC(e_smx_state_t) SIMIX_req_process_sleep(double duration);
+ XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration);
- /************************** Comunication Requests *****************************/
+ /************************** Comunication simcalls *****************************/
/***** Rendez-vous points *****/
- XBT_PUBLIC(smx_rdv_t) SIMIX_req_rdv_create(const char *name);
- XBT_PUBLIC(void) SIMIX_req_rdv_destroy(smx_rdv_t rvp);
- XBT_PUBLIC(smx_rdv_t) SIMIX_req_rdv_get_by_name(const char *name);
- XBT_PUBLIC(int) SIMIX_req_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host);
- XBT_PUBLIC(smx_action_t) SIMIX_req_rdv_get_head(smx_rdv_t rdv);
++
+ XBT_PUBLIC(smx_rdv_t) simcall_rdv_create(const char *name);
+ XBT_PUBLIC(void) simcall_rdv_destroy(smx_rdv_t rvp);
+ XBT_PUBLIC(smx_rdv_t) simcall_rdv_get_by_name(const char *name);
+ XBT_PUBLIC(int) simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host);
+ XBT_PUBLIC(smx_action_t) simcall_rdv_get_head(smx_rdv_t rdv);
+
+XBT_PUBLIC(xbt_dict_t) SIMIX_get_rdv_points(void);
+
- /***** Communication Requests *****/
+ /***** Communication simcalls *****/
- XBT_PUBLIC(void) SIMIX_req_comm_send(smx_rdv_t rdv, double task_size,
+ XBT_PUBLIC(void) simcall_comm_send(smx_rdv_t rdv, double task_size,
double rate, void *src_buff,
size_t src_buff_size,
int (*match_fun)(void *, void *),
void *data, double timeout);
- XBT_PUBLIC(smx_action_t) SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size,
+ XBT_PUBLIC(smx_action_t) simcall_comm_isend(smx_rdv_t rdv, double task_size,
double rate, void *src_buff,
size_t src_buff_size,
int (*match_fun)(void *, void *),
void (*clean_fun)(void *),
void *data, int detached);
- XBT_PUBLIC(void) SIMIX_req_comm_recv(smx_rdv_t rdv, void *dst_buff,
+ XBT_PUBLIC(void) simcall_comm_recv(smx_rdv_t rdv, void *dst_buff,
size_t * dst_buff_size,
int (*match_fun)(void *, void *),
void *data, double timeout);
- XBT_PUBLIC(smx_action_t) SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff,
+ XBT_PUBLIC(smx_action_t) simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff,
size_t * dst_buff_size,
int (*match_fun)(void *, void *),
void *data);
- XBT_PUBLIC(void) SIMIX_req_comm_destroy(smx_action_t comm);
+ XBT_PUBLIC(void) simcall_comm_destroy(smx_action_t comm);
- XBT_INLINE XBT_PUBLIC(void) SIMIX_req_comm_cancel(smx_action_t comm);
+ XBT_INLINE XBT_PUBLIC(void) simcall_comm_cancel(smx_action_t comm);
/* FIXME: waitany is going to be a vararg function, and should take a timeout */
- XBT_PUBLIC(unsigned int) SIMIX_req_comm_waitany(xbt_dynar_t comms);
- XBT_PUBLIC(void) SIMIX_req_comm_wait(smx_action_t comm, double timeout);
- XBT_PUBLIC(int) SIMIX_req_comm_test(smx_action_t comm);
- XBT_PUBLIC(int) SIMIX_req_comm_testany(xbt_dynar_t comms);
+ XBT_PUBLIC(unsigned int) simcall_comm_waitany(xbt_dynar_t comms);
+ XBT_PUBLIC(void) simcall_comm_wait(smx_action_t comm, double timeout);
+ XBT_PUBLIC(int) simcall_comm_test(smx_action_t comm);
+ XBT_PUBLIC(int) simcall_comm_testany(xbt_dynar_t comms);
/* Getters and setters */
- XBT_PUBLIC(double) SIMIX_req_comm_get_remains(smx_action_t comm);
- XBT_PUBLIC(e_smx_state_t) SIMIX_req_comm_get_state(smx_action_t comm);
- XBT_PUBLIC(void *) SIMIX_req_comm_get_src_data(smx_action_t comm);
- XBT_PUBLIC(void *) SIMIX_req_comm_get_dst_data(smx_action_t comm);
- XBT_PUBLIC(smx_process_t) SIMIX_req_comm_get_src_proc(smx_action_t comm);
- XBT_PUBLIC(smx_process_t) SIMIX_req_comm_get_dst_proc(smx_action_t comm);
+ XBT_PUBLIC(double) simcall_comm_get_remains(smx_action_t comm);
+ XBT_PUBLIC(e_smx_state_t) simcall_comm_get_state(smx_action_t comm);
+ XBT_PUBLIC(void *) simcall_comm_get_src_data(smx_action_t comm);
+ XBT_PUBLIC(void *) simcall_comm_get_dst_data(smx_action_t comm);
+ XBT_PUBLIC(smx_process_t) simcall_comm_get_src_proc(smx_action_t comm);
+ XBT_PUBLIC(smx_process_t) simcall_comm_get_dst_proc(smx_action_t comm);
#ifdef HAVE_LATENCY_BOUND_TRACKING
- XBT_PUBLIC(int) SIMIX_req_comm_is_latency_bounded(smx_action_t comm);
+ XBT_PUBLIC(int) simcall_comm_is_latency_bounded(smx_action_t comm);
#endif
#ifdef HAVE_TRACING
/************************** Tracing handling **********************************/
- XBT_PUBLIC(void) SIMIX_req_set_category(smx_action_t action, const char *category);
+ XBT_PUBLIC(void) simcall_set_category(smx_action_t action, const char *category);
#endif
- /************************** Synchro handling **********************************/
+ /************************** Synchro simcalls **********************************/
- XBT_PUBLIC(smx_mutex_t) SIMIX_req_mutex_init(void);
- XBT_PUBLIC(void) SIMIX_req_mutex_destroy(smx_mutex_t mutex);
- XBT_PUBLIC(void) SIMIX_req_mutex_lock(smx_mutex_t mutex);
- XBT_PUBLIC(int) SIMIX_req_mutex_trylock(smx_mutex_t mutex);
- XBT_PUBLIC(void) SIMIX_req_mutex_unlock(smx_mutex_t mutex);
+ XBT_PUBLIC(smx_mutex_t) simcall_mutex_init(void);
+ XBT_PUBLIC(void) simcall_mutex_destroy(smx_mutex_t mutex);
+ XBT_PUBLIC(void) simcall_mutex_lock(smx_mutex_t mutex);
+ XBT_PUBLIC(int) simcall_mutex_trylock(smx_mutex_t mutex);
+ XBT_PUBLIC(void) simcall_mutex_unlock(smx_mutex_t mutex);
- XBT_PUBLIC(smx_cond_t) SIMIX_req_cond_init(void);
- XBT_PUBLIC(void) SIMIX_req_cond_destroy(smx_cond_t cond);
- XBT_PUBLIC(void) SIMIX_req_cond_signal(smx_cond_t cond);
- XBT_PUBLIC(void) SIMIX_req_cond_wait(smx_cond_t cond, smx_mutex_t mutex);
- XBT_PUBLIC(void) SIMIX_req_cond_wait_timeout(smx_cond_t cond,
+ XBT_PUBLIC(smx_cond_t) simcall_cond_init(void);
+ XBT_PUBLIC(void) simcall_cond_destroy(smx_cond_t cond);
+ XBT_PUBLIC(void) simcall_cond_signal(smx_cond_t cond);
+ XBT_PUBLIC(void) simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex);
+ XBT_PUBLIC(void) simcall_cond_wait_timeout(smx_cond_t cond,
smx_mutex_t mutex,
double max_duration);
- XBT_PUBLIC(void) SIMIX_req_cond_broadcast(smx_cond_t cond);
-
- XBT_PUBLIC(smx_sem_t) SIMIX_req_sem_init(int capacity);
- XBT_PUBLIC(void) SIMIX_req_sem_destroy(smx_sem_t sem);
- XBT_PUBLIC(void) SIMIX_req_sem_release(smx_sem_t sem);
- XBT_PUBLIC(void) SIMIX_req_sem_release_forever(smx_sem_t sem);
- XBT_PUBLIC(int) SIMIX_req_sem_would_block(smx_sem_t sem);
- XBT_PUBLIC(void) SIMIX_req_sem_block_onto(smx_sem_t sem);
- XBT_PUBLIC(void) SIMIX_req_sem_acquire(smx_sem_t sem);
- XBT_PUBLIC(void) SIMIX_req_sem_acquire_timeout(smx_sem_t sem,
+ XBT_PUBLIC(void) simcall_cond_broadcast(smx_cond_t cond);
+
+ XBT_PUBLIC(smx_sem_t) simcall_sem_init(int capacity);
+ XBT_PUBLIC(void) simcall_sem_destroy(smx_sem_t sem);
+ XBT_PUBLIC(void) simcall_sem_release(smx_sem_t sem);
+ XBT_PUBLIC(void) simcall_sem_release_forever(smx_sem_t sem);
+ XBT_PUBLIC(int) simcall_sem_would_block(smx_sem_t sem);
+ XBT_PUBLIC(void) simcall_sem_block_onto(smx_sem_t sem);
+ XBT_PUBLIC(void) simcall_sem_acquire(smx_sem_t sem);
+ XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem,
double max_duration);
- XBT_PUBLIC(unsigned int) SIMIX_req_sem_acquire_any(xbt_dynar_t sems);
- XBT_PUBLIC(int) SIMIX_req_sem_get_capacity(smx_sem_t sem);
+ XBT_PUBLIC(unsigned int) simcall_sem_acquire_any(xbt_dynar_t sems);
+ XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
- const char *SIMIX_request_name(int kind);
+ XBT_PUBLIC(void) simcall_file_read(char* name);
SG_END_DECL()
#endif /* _SIMIX_SIMIX_H */
new_reg->start_addr = start_addr;
new_reg->size = size;
new_reg->data = xbt_malloc0(size);
- XBT_DEBUG("New reg data %p, start_addr %p", new_reg->data, start_addr);
+ XBT_DEBUG("New reg data %p, start_addr %p, size %zu", new_reg->data, start_addr, size);
memcpy(new_reg->data, start_addr, size);
return new_reg;
if (!memcmp(maps->regions[i].pathname, "[stack]", 7)){
size_t diff = (char*)reg->start_addr - (char*)r.start_addr;
void *segment = malloc(reg->size + diff);
- XBT_DEBUG("Size of segment : %lu", sizeof(segment));
+ XBT_DEBUG("Size of segment : %zu", sizeof(segment));
memcpy((char *)segment + diff, reg->data, reg->size);
memcpy(r.start_addr, segment, sizeof(segment));
XBT_DEBUG("Memcpy region ok");
XBT_DEBUG("New region libsimgrid (%zu)", size);
break;
case 2 :
- XBT_DEBUG("New region program (%zu)", size);
- break;
- case 3 :
- XBT_DEBUG("New region stack (%zu)", size);
+ XBT_DEBUG("New region program data (%zu)", size);
break;
}
mc_mem_region_t new_reg = MC_region_new(type, start_addr, size);
if (reg.start_addr == std_heap){ // only save the std heap (and not the raw one)
MC_snapshot_add_region(snapshot, 0, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
}
- } else {
+ }else {
if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
- } else {
- if (!memcmp(basename(maps->regions[i].pathname), basename(prog_name), strlen(basename(prog_name)))){
- MC_snapshot_add_region(snapshot, 2, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
- } /*else {
- if (!memcmp(maps->regions[i].pathname, "[stack]", 7)){
- MC_snapshot_add_region(snapshot, 3, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
- }
- }*/
- }
+ }
}
}
i++;
XBT_DEBUG("libsimgrid (data) restored");
break;
case 2:
- XBT_DEBUG("program (data) restored");
- break;
- case 3:
- XBT_DEBUG("stack restored");
+ XBT_DEBUG("data program restored");
break;
}
xbt_dynar_t visited_pairs_hash;
xbt_dynar_t successors;
+xbt_dynar_t hosts_table;
+
/* fast implementation of djb2 algorithm */
unsigned int hash_region(char *str, int str_len){
}
switch(s1->regions[i]->type){
- case 0:
+ case 0:
if(s1->regions[i]->size != s2->regions[i]->size){
if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
XBT_DEBUG("Different size of heap (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
return 1;
}
}
- if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data)){
+ if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data, std_heap)){
if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
XBT_DEBUG("Different heap (mmalloc_compare)");
errors++;
}
}
break;
- case 1 :
+ /*case 1 :
if(s1->regions[i]->size != s2->regions[i]->size){
if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
XBT_DEBUG("Different size of libsimgrid (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
XBT_DEBUG("Different memcmp for data in libsimgrid");
+ XBT_DEBUG("Size : %zu", s1->regions[i]->size);
errors++;
}else{
return 1;
}
}
- break;
- /*case 2:
- if(s1->regions[i]->size != s2->regions[i]->size){
- if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
- XBT_DEBUG("Different size of program (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
- errors++;
- }else{
- return 1;
- }
- }
- if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
- if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
- XBT_DEBUG("Different start addr of program (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
- errors++;
- }else{
- return 1;
- }
- }
- if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
- if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
- XBT_DEBUG("Different memcmp for data in program");
- errors++;
- }else{
- return 1;
- }
- }
break;*/
- case 3:
- if(s1->regions[i]->size != s2->regions[i]->size){
- if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
- XBT_DEBUG("Different size of stack (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
- errors++;
- }else{
- return 1;
- }
- }
- if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
- if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
- XBT_DEBUG("Different start addr of stack (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
- errors++;
- }else{
- return 1;
- }
- }
- if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
- if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
- XBT_DEBUG("Different memcmp for data in stack");
- errors++;
- }else{
- return 1;
- }
- }
- break;
default:
break;
}
}
- if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
- return (errors>0);
- }else{
- return 0;
- }
+ return (errors > 0);
+
}
cursor = 0;
mc_pair_reached_t pair_test = NULL;
-
+ //xbt_dict_t current_rdv_points = SIMIX_get_rdv_points();
+
xbt_dynar_foreach(reached_pairs, cursor, pair_test){
+ XBT_DEBUG("Pair reached #%d", cursor+1);
if(automaton_state_compare(pair_test->automaton_state, st) == 0){
if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
- XBT_DEBUG("Pair reached %d", cursor+1);
- if(snapshot_compare(pair_test->system_state, sn) == 0){
- MC_free_snapshot(sn);
- xbt_dynar_reset(prop_ato);
- xbt_free(prop_ato);
- MC_UNSET_RAW_MEM;
- return 1;
+ //XBT_DEBUG("Rdv points size %d - %d", xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points));
+ //if(xbt_dict_length(pair_test->rdv_points) == xbt_dict_length(current_rdv_points)){
+ //if(rdv_points_compare(pair_test->rdv_points, current_rdv_points) == 0){
+ if(snapshot_compare(pair_test->system_state, sn) == 0){
+ MC_free_snapshot(sn);
+ xbt_dynar_reset(prop_ato);
+ xbt_free(prop_ato);
+ MC_UNSET_RAW_MEM;
+ return 1;
+ }
+ /* }
}else{
- XBT_DEBUG("Different snapshot");
- }
+ XBT_DEBUG("Different size of rdv points (%d - %d)",xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points) );
+ }*/
}else{
XBT_DEBUG("Different values of propositional symbols");
}
}
}
+int rdv_points_compare(xbt_dict_t d1, xbt_dict_t d2){ /* d1 = pair_test, d2 = current_pair */
+
+ xbt_dict_cursor_t cursor_dict = NULL;
+ char *key;
+ char *data;
+ smx_rdv_t rdv1, rdv2;
+ xbt_fifo_item_t item1, item2;
+ smx_action_t action1, action2;
+ xbt_fifo_item_t item_req1, item_req2;
+ smx_req_t req1, req2;
+ int i=0;
+ int j=0;
+
+ xbt_dict_foreach(d1, cursor_dict, key, data){
+ rdv1 = (smx_rdv_t)data;
+ rdv2 = xbt_dict_get_or_null(d2, rdv1->name);
+ if(rdv2 == NULL){
+ XBT_DEBUG("Rdv point unknown");
+ return 1;
+ }else{
+ if(xbt_fifo_size(rdv1->comm_fifo) != xbt_fifo_size(rdv2->comm_fifo)){
+ XBT_DEBUG("Different total of actions in mailbox \"%s\" (%d - %d)", rdv1->name, xbt_fifo_size(rdv1->comm_fifo),xbt_fifo_size(rdv2->comm_fifo) );
+ return 1;
+ }else{
+
+ XBT_DEBUG("Total of actions in mailbox \"%s\" : %d", rdv1->name, xbt_fifo_size(rdv1->comm_fifo));
+
+ item1 = xbt_fifo_get_first_item(rdv1->comm_fifo);
+ item2 = xbt_fifo_get_first_item(rdv2->comm_fifo);
+
+ while(i<xbt_fifo_size(rdv1->comm_fifo)){
+ action1 = (smx_action_t) xbt_fifo_get_item_content(item1);
+ action2 = (smx_action_t) xbt_fifo_get_item_content(item2);
+
+ if(action1->type != action2->type){
+ XBT_DEBUG("Different type of action");
+ return 1;
+ }
+
+ if(action1->state != action2->state){
+ XBT_DEBUG("Different state of action");
+ return 1;
+ }
+
+ if(xbt_fifo_size(action1->request_list) != xbt_fifo_size(action2->request_list)){
+ XBT_DEBUG("Different size of request list (%d - %d", xbt_fifo_size(action1->request_list), xbt_fifo_size(action2->request_list));
+ return 1;
+ }else{
+
+ item_req1 = xbt_fifo_get_first_item(action1->request_list);
+ item_req2 = xbt_fifo_get_first_item(action2->request_list);
+
+ while(j<xbt_fifo_size(action1->request_list)){
+
+ req1 = (smx_req_t) xbt_fifo_get_item_content(item_req1);
+ req2 = (smx_req_t) xbt_fifo_get_item_content(item_req2);
+
+ if(req1->call != req2->call){
+ XBT_DEBUG("Different request call in request_list of action (%d - %d)", req1->call, req2->call);
+ return 1;
+ }
+ if(req1->issuer->pid != req2->issuer->pid){
+ XBT_DEBUG("Different request issuer in request_list of action (%lu- %lu)", req1->issuer->pid, req2->issuer->pid);
+ return 1;
+ }
+
+ item_req1 = xbt_fifo_get_next_item(item_req1);
+ item_req2 = xbt_fifo_get_next_item(item_req2);
+ j++;
+
+ }
+ }
+
+ switch(action1->type){
+ case 0: /* execution */
+ case 1: /* parallel execution */
+ if(strcmp(action1->execution.host->name, action2->execution.host->name) != 0)
+ return 1;
+ break;
+ case 2: /* comm */
+ if(action1->comm.type != action2->comm.type)
+ return 1;
+ //XBT_DEBUG("Type of comm : %d", action1->comm.type);
+
+ switch(action1->comm.type){
+ case 0: /* SEND */
+ if(action1->comm.src_proc->pid != action2->comm.src_proc->pid)
+ return 1;
+ if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0)
+ return 1;
+ break;
+ case 1: /* RECEIVE */
+ if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid)
+ return 1;
+ if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0)
+ return 1;
+ break;
+ case 2: /* READY */
+ if(action1->comm.src_proc->pid != action2->comm.src_proc->pid)
+ return 1;
+ if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0)
+ return 1;
+ if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid)
+ return 1;
+ if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0)
+ return 1;
+ break;
+ case 3: /* DONE */
+ if(action1->comm.src_proc->pid != action2->comm.src_proc->pid)
+ return 1;
+ if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0)
+ return 1;
+ if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid)
+ return 1;
+ if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0)
+ return 1;
+ break;
+
+ } /* end of switch on type of comm */
+
+ if(action1->comm.refcount != action2->comm.refcount)
+ return 1;
+ if(action1->comm.detached != action2->comm.detached)
+ return 1;
+ if(action1->comm.rate != action2->comm.rate)
+ return 1;
+ if(action1->comm.task_size != action2->comm.task_size)
+ return 1;
+ if(action1->comm.src_buff != action2->comm.src_buff)
+ return 1;
+ if(action1->comm.dst_buff != action2->comm.dst_buff)
+ return 1;
+ if(action1->comm.src_data != action2->comm.src_data)
+ return 1;
+ if(action1->comm.dst_data != action2->comm.dst_data)
+ return 1;
+
+ break;
+ case 3: /* sleep */
+ if(strcmp(action1->sleep.host->name, action2->sleep.host->name) != 0)
+ return 1;
+ break;
+ case 4: /* synchro */
+
+ break;
+ default:
+ break;
+ }
+
+ item1 = xbt_fifo_get_next_item(item1);
+ item2 = xbt_fifo_get_next_item(item2);
+ i++;
+ }
+ }
+ }
+ }
+
+ return 0;
+
+}
+
void set_pair_reached(xbt_state_t st){
pair->automaton_state = st;
pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
+ //pair->rdv_points = xbt_dict_new();
MC_take_snapshot_liveness(pair->system_state);
/* Get values of propositional symbols */
res = (*f)();
xbt_dynar_push_as(pair->prop_ato, int, res);
}
-
+
+ /*xbt_dict_t rdv_points = SIMIX_get_rdv_points();
+
+ xbt_dict_cursor_t cursor_dict = NULL;
+ char *key;
+ char *data;
+ xbt_fifo_item_t item;
+ smx_action_t action;
+
+ xbt_dict_foreach(rdv_points, cursor_dict, key, data){
+ smx_rdv_t new_rdv = xbt_new0(s_smx_rvpoint_t, 1);
+ new_rdv->name = strdup(((smx_rdv_t)data)->name);
+ new_rdv->comm_fifo = xbt_fifo_new();
+ xbt_fifo_foreach(((smx_rdv_t)data)->comm_fifo, item, action, smx_action_t) {
+ smx_action_t a = xbt_new0(s_smx_action_t, 1);
+ memcpy(a, action, sizeof(s_smx_action_t));
+ xbt_fifo_push(new_rdv->comm_fifo, a);
+ XBT_DEBUG("New action (type = %d, state = %d) in mailbox \"%s\"", action->type, action->state, key);
+ if(action->type==2)
+ XBT_DEBUG("Type of communication : %d, Ref count = %d", action->comm.type, action->comm.refcount);
+ }
+ //new_rdv->comm_fifo = xbt_fifo_copy(((smx_rdv_t)data)->comm_fifo);
+ xbt_dict_set(pair->rdv_points, new_rdv->name, new_rdv, NULL);
+ }*/
+
xbt_dynar_push(reached_pairs, &pair);
MC_UNSET_RAW_MEM;
}
+
int reached_hash(xbt_state_t st){
}
-
-
-
/********************* Double-DFS stateless *******************/
void MC_pair_stateless_delete(mc_pair_stateless_t pair){
int value;
mc_state_t next_graph_state = NULL;
- smx_req_t req = NULL;
+ smx_simcall_t req = NULL;
char *req_str;
xbt_transition_t transition_succ;
MC_state_set_executed_request(current_pair->graph_state, req, value);
/* Answer the request */
- SIMIX_request_pre(req, value);
+ SIMIX_simcall_pre(req, value);
/* Wait for requests (schedules processes) */
MC_wait_for_requests();
#include "../simix/private.h"
#include "xbt/automaton.h"
#include "xbt/hash.h"
+#include "msg/msg.h"
+#include "msg/datatypes.h"
+#include "simix/datatypes.h"
/****************************** Snapshots ***********************************/
void MC_replay_liveness(xbt_fifo_t stack, int all_stack);
void MC_wait_for_requests(void);
void MC_get_enabled_processes();
- void MC_show_deadlock(smx_req_t req);
- void MC_show_deadlock_stateful(smx_req_t req);
+ void MC_show_deadlock(smx_simcall_t req);
+ void MC_show_deadlock_stateful(smx_simcall_t req);
void MC_show_stack_safety_stateless(xbt_fifo_t stack);
void MC_dump_stack_safety_stateless(xbt_fifo_t stack);
void MC_show_stack_safety_stateful(xbt_fifo_t stack);
void MC_dump_stack_safety_stateful(xbt_fifo_t stack);
/********************************* Requests ***********************************/
- int MC_request_depend(smx_req_t req1, smx_req_t req2);
- char* MC_request_to_string(smx_req_t req, int value);
- unsigned int MC_request_testany_fail(smx_req_t req);
+ int MC_request_depend(smx_simcall_t req1, smx_simcall_t req2);
+ char* MC_request_to_string(smx_simcall_t req, int value);
+ unsigned int MC_request_testany_fail(smx_simcall_t req);
/*int MC_waitany_is_enabled_by_comm(smx_req_t req, unsigned int comm);*/
- int MC_request_is_visible(smx_req_t req);
- int MC_request_is_enabled(smx_req_t req);
- int MC_request_is_enabled_by_idx(smx_req_t req, unsigned int idx);
+ int MC_request_is_visible(smx_simcall_t req);
+ int MC_request_is_enabled(smx_simcall_t req);
+ int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx);
int MC_process_is_enabled(smx_process_t process);
unsigned long max_pid; /* Maximum pid at state's creation time */
mc_procstate_t proc_status; /* State's exploration status by process */
s_smx_action_t internal_comm; /* To be referenced by the internal_req */
- s_smx_req_t internal_req; /* Internal translation of request */
- s_smx_req_t executed_req; /* The executed request of the state */
+ s_smx_simcall_t internal_req; /* Internal translation of request */
+ s_smx_simcall_t executed_req; /* The executed request of the state */
int req_num; /* The request number (in the case of a
multi-request like waitany ) */
} s_mc_state_t, *mc_state_t;
void MC_state_interleave_process(mc_state_t state, smx_process_t process);
unsigned int MC_state_interleave_size(mc_state_t state);
int MC_state_process_is_done(mc_state_t state, smx_process_t process);
- void MC_state_set_executed_request(mc_state_t state, smx_req_t req, int value);
- smx_req_t MC_state_get_executed_request(mc_state_t state, int *value);
- smx_req_t MC_state_get_internal_request(mc_state_t state);
- smx_req_t MC_state_get_request(mc_state_t state, int *value);
+ void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, int value);
+ smx_simcall_t MC_state_get_executed_request(mc_state_t state, int *value);
+ smx_simcall_t MC_state_get_internal_request(mc_state_t state);
+ smx_simcall_t MC_state_get_request(mc_state_t state, int *value);
/****************************** Statistics ************************************/
typedef struct mc_stats {
xbt_state_t automaton_state;
xbt_dynar_t prop_ato;
mc_snapshot_t system_state;
+ //xbt_dict_t rdv_points;
}s_mc_pair_reached_t, *mc_pair_reached_t;
typedef struct s_mc_pair_visited{
unsigned int *hash_regions;
}s_mc_pair_reached_hash_t, *mc_pair_reached_hash_t;
+
+
int MC_automaton_evaluate_label(xbt_exp_label_t l);
mc_pair_t new_pair(mc_snapshot_t sn, mc_state_t sg, xbt_state_t st);
int visited_hash(xbt_state_t st, int search_cycle);
void set_pair_visited_hash(xbt_state_t st, int search_cycle);
unsigned int hash_region(char *str, int str_len);
+int rdv_points_compare(xbt_dict_t d1, xbt_dict_t d2);
/* **** Double-DFS stateless **** */
/* 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. */
- #include "private.h"
+ #include "smx_private.h"
#include "xbt/log.h"
#include "mc/mc.h"
#include "xbt/dict.h"
static xbt_dict_t rdv_points = NULL;
unsigned long int smx_total_comms = 0;
- static void SIMIX_waitany_req_remove_from_actions(smx_req_t req);
+ static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall);
static void SIMIX_comm_copy_data(smx_action_t comm);
static smx_action_t SIMIX_comm_new(e_smx_comm_type_t type);
static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm);
- static smx_action_t SIMIX_rdv_get_request(smx_rdv_t rdv, e_smx_comm_type_t type,
+ static smx_action_t SIMIX_rdv_get_comm(smx_rdv_t rdv, e_smx_comm_type_t type,
int (*match_fun)(void *, void *), void *);
static void SIMIX_rdv_free(void *data);
smx_rdv_t SIMIX_rdv_create(const char *name)
{
- /* two processes may have pushed the same rdv_create request at the same time */
+ /* two processes may have pushed the same rdv_create simcall at the same time */
smx_rdv_t rdv = name ? xbt_dict_get_or_null(rdv_points, name) : NULL;
if (!rdv) {
xbt_free(rdv);
}
+xbt_dict_t SIMIX_get_rdv_points()
+{
+ return rdv_points;
+}
+
smx_rdv_t SIMIX_rdv_get_by_name(const char *name)
{
return xbt_dict_get_or_null(rdv_points, name);
}
/**
- * \brief Push a communication request into a rendez-vous point
+ * \brief Pushes a communication action into a rendez-vous point
* \param rdv The rendez-vous point
- * \param comm The communication request
+ * \param comm The communication action
*/
static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm)
{
}
/**
- * \brief Remove a communication request from a rendez-vous point
+ * \brief Removes a communication action from a rendez-vous point
* \param rdv The rendez-vous point
- * \param comm The communication request
+ * \param comm The communication action
*/
XBT_INLINE void SIMIX_rdv_remove(smx_rdv_t rdv, smx_action_t comm)
{
}
/**
- * \brief Wrapper to SIMIX_rdv_get_request
+ * \brief Wrapper to SIMIX_rdv_get_comm
*/
smx_action_t SIMIX_comm_get_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data) {
- return SIMIX_rdv_get_request(rdv, SIMIX_COMM_SEND, match_fun, data);
+ return SIMIX_rdv_get_comm(rdv, SIMIX_COMM_SEND, match_fun, data);
}
/**
* \param type The type of communication we are looking for (comm_send, comm_recv)
* \return The communication action if found, NULL otherwise
*/
- smx_action_t SIMIX_rdv_get_request(smx_rdv_t rdv, e_smx_comm_type_t type,
+ smx_action_t SIMIX_rdv_get_comm(smx_rdv_t rdv, e_smx_comm_type_t type,
int (*match_fun)(void *, void *), void *data)
{
// FIXME rewrite this function by using SIMIX_rdv_has_send/recv_match
smx_action_t action;
xbt_fifo_item_t item;
- void* req_data = NULL;
+ void* comm_data = NULL;
xbt_fifo_foreach(rdv->comm_fifo, item, action, smx_action_t) {
if (action->comm.type == SIMIX_COMM_SEND) {
- req_data = action->comm.src_data;
+ comm_data = action->comm.src_data;
} else if (action->comm.type == SIMIX_COMM_RECEIVE) {
- req_data = action->comm.dst_data;
+ comm_data = action->comm.dst_data;
}
- if (action->comm.type == type && (!match_fun || match_fun(data, req_data))) {
+ if (action->comm.type == type && (!match_fun || match_fun(data, comm_data))) {
XBT_DEBUG("Found a matching communication action %p", action);
xbt_fifo_remove_item(rdv->comm_fifo, item);
xbt_fifo_free_item(item);
/**
* \brief Creates a new comunicate action
- * \param type The type of request (comm_send, comm_recv)
+ * \param type The direction of communication (comm_send, comm_recv)
* \return The new comunicate action
*/
smx_action_t SIMIX_comm_new(e_smx_comm_type_t type)
{
smx_action_t action;
- /* Look for communication request matching our needs.
+ /* Look for communication action matching our needs.
If it is not found then create it and push it into the rendez-vous point */
- action = SIMIX_rdv_get_request(rdv, SIMIX_COMM_RECEIVE, match_fun, data);
+ action = SIMIX_rdv_get_comm(rdv, SIMIX_COMM_RECEIVE, match_fun, data);
if (!action) {
action = SIMIX_comm_new(SIMIX_COMM_SEND);
action->comm.clean_fun = NULL;
}
- /* Setup the communication request */
+ /* Setup the communication action */
action->comm.src_proc = src_proc;
action->comm.task_size = task_size;
action->comm.rate = rate;
{
smx_action_t action;
- /* Look for communication request matching our needs.
+ /* Look for communication action matching our needs.
* If it is not found then create it and push it into the rendez-vous point
*/
- action = SIMIX_rdv_get_request(rdv, SIMIX_COMM_SEND, match_fun, data);
+ action = SIMIX_rdv_get_comm(rdv, SIMIX_COMM_SEND, match_fun, data);
if (!action) {
action = SIMIX_comm_new(SIMIX_COMM_RECEIVE);
}
xbt_fifo_push(dst_proc->comms, action);
- /* Setup communication request */
+ /* Setup communication action */
action->comm.dst_proc = dst_proc;
action->comm.dst_buff = dst_buff;
action->comm.dst_buff_size = dst_buff_size;
return action;
}
- void SIMIX_pre_comm_wait(smx_req_t req, smx_action_t action, double timeout, int idx)
+ void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout, int idx)
{
- /* the request may be a wait, a send or a recv */
+ /* the simcall may be a wait, a send or a recv */
surf_action_t sleep;
- /* Associate this request to the action */
- xbt_fifo_push(action->request_list, req);
- req->issuer->waiting_action = action;
+ /* Associate this simcall to the wait action */
+ xbt_fifo_push(action->simcalls, simcall);
+ simcall->issuer->waiting_action = action;
if (MC_IS_ENABLED) {
if (idx == 0) {
action->state = SIMIX_DONE;
} else {
- /* If we reached this point, the wait request must have a timeout */
+ /* If we reached this point, the wait simcall must have a timeout */
/* Otherwise it shouldn't be enabled and executed by the MC */
if (timeout == -1)
THROW_IMPOSSIBLE;
- if (action->comm.src_proc == req->issuer)
+ if (action->comm.src_proc == simcall->issuer)
action->state = SIMIX_SRC_TIMEOUT;
else
action->state = SIMIX_DST_TIMEOUT;
if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING) {
SIMIX_comm_finish(action);
} else { /* if (timeout >= 0) { we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host fails */
- sleep = surf_workstation_model->extension.workstation.sleep(req->issuer->smx_host->host, timeout);
+ sleep = surf_workstation_model->extension.workstation.sleep(simcall->issuer->smx_host->host, timeout);
surf_workstation_model->action_data_set(sleep, action);
- if (req->issuer == action->comm.src_proc)
+ if (simcall->issuer == action->comm.src_proc)
action->comm.src_timeout = sleep;
else
action->comm.dst_timeout = sleep;
}
}
- void SIMIX_pre_comm_test(smx_req_t req)
+ void SIMIX_pre_comm_test(smx_simcall_t simcall)
{
- smx_action_t action = req->comm_test.comm;
+ smx_action_t action = simcall->comm_test.comm;
if(MC_IS_ENABLED){
- req->comm_test.result = action->comm.src_proc && action->comm.dst_proc;
- if(req->comm_test.result){
+ simcall->comm_test.result = action->comm.src_proc && action->comm.dst_proc;
+ if(simcall->comm_test.result){
action->state = SIMIX_DONE;
- xbt_fifo_push(action->request_list, req);
+ xbt_fifo_push(action->simcalls, simcall);
SIMIX_comm_finish(action);
}else{
- SIMIX_request_answer(req);
+ SIMIX_simcall_answer(simcall);
}
return;
}
- req->comm_test.result = (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING);
- if (req->comm_test.result) {
- xbt_fifo_push(action->request_list, req);
+ simcall->comm_test.result = (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING);
+ if (simcall->comm_test.result) {
+ xbt_fifo_push(action->simcalls, simcall);
SIMIX_comm_finish(action);
} else {
- SIMIX_request_answer(req);
+ SIMIX_simcall_answer(simcall);
}
}
- void SIMIX_pre_comm_testany(smx_req_t req, int idx)
+ void SIMIX_pre_comm_testany(smx_simcall_t simcall, int idx)
{
unsigned int cursor;
smx_action_t action;
- xbt_dynar_t actions = req->comm_testany.comms;
- req->comm_testany.result = -1;
+ xbt_dynar_t actions = simcall->comm_testany.comms;
+ simcall->comm_testany.result = -1;
if (MC_IS_ENABLED){
if(idx == -1){
- SIMIX_request_answer(req);
+ SIMIX_simcall_answer(simcall);
}else{
action = xbt_dynar_get_as(actions, idx, smx_action_t);
- req->comm_testany.result = idx;
- xbt_fifo_push(action->request_list, req);
+ simcall->comm_testany.result = idx;
+ xbt_fifo_push(action->simcalls, simcall);
action->state = SIMIX_DONE;
SIMIX_comm_finish(action);
}
return;
}
- xbt_dynar_foreach(req->comm_testany.comms,cursor,action) {
+ xbt_dynar_foreach(simcall->comm_testany.comms,cursor,action) {
if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING) {
- req->comm_testany.result = cursor;
- xbt_fifo_push(action->request_list, req);
+ simcall->comm_testany.result = cursor;
+ xbt_fifo_push(action->simcalls, simcall);
SIMIX_comm_finish(action);
return;
}
}
- SIMIX_request_answer(req);
+ SIMIX_simcall_answer(simcall);
}
- void SIMIX_pre_comm_waitany(smx_req_t req, int idx)
+ void SIMIX_pre_comm_waitany(smx_simcall_t simcall, int idx)
{
smx_action_t action;
unsigned int cursor = 0;
- xbt_dynar_t actions = req->comm_waitany.comms;
+ xbt_dynar_t actions = simcall->comm_waitany.comms;
if (MC_IS_ENABLED){
action = xbt_dynar_get_as(actions, idx, smx_action_t);
- xbt_fifo_push(action->request_list, req);
- req->comm_waitany.result = idx;
+ xbt_fifo_push(action->simcalls, simcall);
+ simcall->comm_waitany.result = idx;
action->state = SIMIX_DONE;
SIMIX_comm_finish(action);
return;
}
xbt_dynar_foreach(actions, cursor, action){
- /* associate this request to the the action */
- xbt_fifo_push(action->request_list, req);
+ /* associate this simcall to the the action */
+ xbt_fifo_push(action->simcalls, simcall);
/* see if the action is already finished */
if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING){
}
}
- void SIMIX_waitany_req_remove_from_actions(smx_req_t req)
+ void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall)
{
smx_action_t action;
unsigned int cursor = 0;
- xbt_dynar_t actions = req->comm_waitany.comms;
+ xbt_dynar_t actions = simcall->comm_waitany.comms;
- xbt_dynar_foreach(actions, cursor, action){
- xbt_fifo_remove(action->request_list, req);
+ xbt_dynar_foreach(actions, cursor, action) {
+ xbt_fifo_remove(action->simcalls, simcall);
}
}
/**
- * \brief Start the simulation of a communication request
- * \param action The communication action
+ * \brief Starts the simulation of a communication action.
+ * \param action the communication action
*/
-
XBT_INLINE void SIMIX_comm_start(smx_action_t action)
{
/* If both the sender and the receiver are already there, start the communication */
}
/**
- * \brief Answers the SIMIX requests associated to a communication action.
+ * \brief Answers the SIMIX simcalls associated to a communication action.
* \param action a finished communication action
*/
void SIMIX_comm_finish(smx_action_t action)
{
volatile unsigned int destroy_count = 0;
- smx_req_t req;
+ smx_simcall_t simcall;
- while ((req = xbt_fifo_shift(action->request_list))) {
+ while ((simcall = xbt_fifo_shift(action->simcalls))) {
- /* If a waitany request is waiting for this action to finish, then remove
+ /* If a waitany simcall is waiting for this action to finish, then remove
it from the other actions in the waitany list. Afterwards, get the
- position of the actual action in the waitany request's actions dynar and
- return it as the result of the call */
- if (req->call == REQ_COMM_WAITANY) {
- SIMIX_waitany_req_remove_from_actions(req);
+ position of the actual action in the waitany dynar and
+ return it as the result of the simcall */
+ if (simcall->call == SIMCALL_COMM_WAITANY) {
+ SIMIX_waitany_remove_simcall_from_actions(simcall);
if (!MC_IS_ENABLED)
- req->comm_waitany.result = xbt_dynar_search(req->comm_waitany.comms, &action);
+ simcall->comm_waitany.result = xbt_dynar_search(simcall->comm_waitany.comms, &action);
}
/* If the action is still in a rendez-vous point then remove from it */
TRY {
THROWF(timeout_error, 0, "Communication timeouted because of sender");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
TRY {
THROWF(timeout_error, 0, "Communication timeouted because of receiver");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
case SIMIX_SRC_HOST_FAILURE:
TRY {
- if (req->issuer == action->comm.src_proc)
+ if (simcall->issuer == action->comm.src_proc)
THROWF(host_error, 0, "Host failed");
else
THROWF(network_error, 0, "Remote peer failed");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
case SIMIX_DST_HOST_FAILURE:
TRY {
- if (req->issuer == action->comm.dst_proc)
+ if (simcall->issuer == action->comm.dst_proc)
THROWF(host_error, 0, "Host failed");
else
THROWF(network_error, 0, "Remote peer failed");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
action,
action->comm.src_proc ? action->comm.src_proc->smx_host->name : NULL,
action->comm.dst_proc ? action->comm.dst_proc->smx_host->name : NULL,
- req->issuer->name, req->issuer, action->comm.detached);
- if (action->comm.src_proc == req->issuer) {
+ simcall->issuer->name, simcall->issuer, action->comm.detached);
+ if (action->comm.src_proc == simcall->issuer) {
XBT_DEBUG("I'm source");
- } else if (action->comm.dst_proc == req->issuer) {
+ } else if (action->comm.dst_proc == simcall->issuer) {
XBT_DEBUG("I'm dest");
} else {
XBT_DEBUG("I'm neither source nor dest");
}
THROWF(network_error, 0, "Link failure");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
case SIMIX_CANCELED:
TRY {
- if (req->issuer == action->comm.dst_proc) {
+ if (simcall->issuer == action->comm.dst_proc) {
THROWF(cancel_error, 0, "Communication canceled by the sender");
}
else {
THROWF(cancel_error, 0, "Communication canceled by the receiver");
}
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
}
/* if there is an exception during a waitany or a testany, indicate the position of the failed communication */
- if (req->issuer->doexception) {
- if (req->call == REQ_COMM_WAITANY) {
- req->issuer->running_ctx->exception.value = xbt_dynar_search(req->comm_waitany.comms, &action);
+ if (simcall->issuer->doexception) {
+ if (simcall->call == SIMCALL_COMM_WAITANY) {
+ simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall->comm_waitany.comms, &action);
}
- else if (req->call == REQ_COMM_TESTANY) {
- req->issuer->running_ctx->exception.value = xbt_dynar_search(req->comm_testany.comms, &action);
+ else if (simcall->call == SIMCALL_COMM_TESTANY) {
+ simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall->comm_testany.comms, &action);
}
}
- req->issuer->waiting_action = NULL;
- xbt_fifo_remove(req->issuer->comms, action);
- SIMIX_request_answer(req);
+ simcall->issuer->waiting_action = NULL;
+ xbt_fifo_remove(simcall->issuer->comms, action);
+ SIMIX_simcall_answer(simcall);
destroy_count++;
}
xbt_fifo_remove(action->comm.dst_proc->comms, action);
}
- /* if there are requests associated with the action, then answer them */
- if (xbt_fifo_size(action->request_list)) {
+ /* if there are simcalls associated with the action, then answer them */
+ if (xbt_fifo_size(action->simcalls)) {
SIMIX_comm_finish(action);
}
}