name = xbt_str_join_array(action, " ");
if (mutex == NULL) { // first arriving on the barrier
- mutex = SIMIX_req_mutex_init();
- cond = SIMIX_req_cond_init();
+ mutex = simcall_mutex_init();
+ cond = simcall_cond_init();
processes_arrived_sofar=0;
}
XBT_DEBUG("Entering barrier: %s (%d already there)", name,processes_arrived_sofar);
- SIMIX_req_mutex_lock(mutex);
+ simcall_mutex_lock(mutex);
if (++processes_arrived_sofar == communicator_size) {
- SIMIX_req_cond_broadcast(cond);
- SIMIX_req_mutex_unlock(mutex);
+ simcall_cond_broadcast(cond);
+ simcall_mutex_unlock(mutex);
} else {
- SIMIX_req_cond_wait(cond,mutex);
- SIMIX_req_mutex_unlock(mutex);
+ simcall_cond_wait(cond,mutex);
+ simcall_mutex_unlock(mutex);
}
XBT_DEBUG("Exiting barrier: %s", name);
processes_arrived_sofar--;
if (!processes_arrived_sofar) {
- SIMIX_req_cond_destroy(cond);
- SIMIX_req_mutex_destroy(mutex);
+ simcall_cond_destroy(cond);
+ simcall_mutex_destroy(mutex);
mutex=NULL;
}
/* 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);
-/***** 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(void) SIMIX_req_file_read(char* name);
+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 */
typedef void *gras_trp_bufdata_;
#include "simix/datatypes.h"
+#include "simix/smx_private.h"
/* Yeah, the following is awfull, breaking the encapsulation of at least 3 modules
* at the same time, but I'm tracking this bug since too long now, I want it dead. now.
}
XBT_VERB("Wait on %ld 'sockets'", xbt_dynar_length(comms));
/* Wait for the end of any of these communications */
- got = SIMIX_req_comm_waitany(comms);
+ got = simcall_comm_waitany(comms);
/* retrieve the message sent in that communication */
sock = xbt_dynar_get_as(trp_proc->sockets, got, gras_socket_t);
}
*/
sock_data->comm_recv =
- SIMIX_req_comm_irecv(gras_socket_im_the_server(sock) ?
+ simcall_comm_irecv(gras_socket_im_the_server(sock) ?
sock_data->rdv_server : sock_data->rdv_client,
&sock_data->msg, NULL, NULL, NULL);
payload, msg->payl);
}
- comm = SIMIX_req_comm_isend(target_rdv, whole_payload_size, -1, msg, sizeof(void *), NULL,NULL, msg, 0);
- SIMIX_req_comm_wait(comm, -1);
+ comm = simcall_comm_isend(target_rdv, whole_payload_size, -1, msg, sizeof(void *), NULL,NULL, msg, 0);
+ simcall_comm_wait(comm, -1);
XBT_VERB("Message sent (and received)");
if ((sock_data->to_socket == active_socket) &&
(sock_data->to_host ==
- SIMIX_req_process_get_host(active_socket_data->from_process))) {
+ simcall_process_get_host(active_socket_data->from_process))) {
xbt_dynar_cursor_unlock(pd->sockets);
return sock_iter;
}
sockdata->to_socket = active_socket;
/*update the peer to_socket variable */
active_socket_data->to_socket = res;
- sockdata->cond = SIMIX_req_cond_init();
- sockdata->mutex = SIMIX_req_mutex_init();
+ sockdata->cond = simcall_cond_init();
+ sockdata->mutex = simcall_mutex_init();
sockdata->to_host =
- SIMIX_req_process_get_host(active_socket_data->from_process);
+ simcall_process_get_host(active_socket_data->from_process);
res->data = sockdata;
- res->peer_name = strdup(SIMIX_req_host_get_name(sockdata->to_host));
+ res->peer_name = strdup(simcall_host_get_name(sockdata->to_host));
gras_trp_buf_init_sock(res);
XBT_DEBUG("Create socket to process:%s(Port %d) from process: %s(Port %d)",
- SIMIX_req_process_get_name(sockdata->from_process),
+ simcall_process_get_name(sockdata->from_process),
res->peer_port,
- SIMIX_req_process_get_name(sockdata->to_process), res->port);
+ simcall_process_get_name(sockdata->to_process), res->port);
return res;
}
static const char* gras_trp_sg_peer_name(gras_socket_t s) {
gras_trp_sg_sock_data_t sockdata = s->data;
if (gras_socket_im_the_server(s))
- return SIMIX_host_get_name(SIMIX_req_process_get_host(sockdata->client));
+ return SIMIX_host_get_name(simcall_process_get_host(sockdata->client));
else {
- return SIMIX_host_get_name(SIMIX_req_process_get_host(sockdata->server));
+ return SIMIX_host_get_name(simcall_process_get_host(sockdata->server));
}
}
static const char* gras_trp_sg_peer_proc(gras_socket_t s) {
gras_sg_portrec_t pr;
/* make sure this socket will reach someone */
- if (!(peer = SIMIX_req_host_get_by_name(host)))
+ if (!(peer = simcall_host_get_by_name(host)))
THROWF(mismatch_error, 0,
"Can't connect to %s: no such host.\n", host);
- if (!(hd = (gras_hostdata_t *) SIMIX_req_host_get_data(peer)))
+ if (!(hd = (gras_hostdata_t *) simcall_host_get_data(peer)))
THROWF(mismatch_error, 0,
"can't connect to %s: no process on this host",
host);
/* initialize synchronization stuff on the socket */
data->rdv_server = pr->rdv;
- data->rdv_client = SIMIX_req_rdv_create(NULL);
- data->comm_recv = SIMIX_req_comm_irecv(data->rdv_client, &data->msg, NULL, NULL, NULL);
+ data->rdv_client = simcall_rdv_create(NULL);
+ data->comm_recv = simcall_comm_irecv(data->rdv_client, &data->msg, NULL, NULL, NULL);
/* connect that simulation data to the socket */
sock->data = data;
sock->incoming = 1;
XBT_DEBUG("%s (PID %d) connects in %s mode to %s:%d (rdv_ser:%p, rdv_cli:%p, comm:%p)",
- SIMIX_req_process_get_name(SIMIX_process_self()), gras_os_getpid(),
+ simcall_process_get_name(SIMIX_process_self()), gras_os_getpid(),
sock->meas ? "meas" : "regular", host, port,
data->rdv_server,data->rdv_client,data->comm_recv);
}
pr->meas = sock->meas;
pr->server = SIMIX_process_self();
xbt_dynar_push(hd->ports, &pr);
- pr->rdv = SIMIX_req_rdv_create(NULL);
+ pr->rdv = simcall_rdv_create(NULL);
/* Create the socket */
data = xbt_new0(s_gras_trp_sg_sock_data_t, 1);
data->client = NULL;
data->rdv_server = pr->rdv;
data->rdv_client = NULL;
- data->comm_recv = SIMIX_req_comm_irecv(pr->rdv, &data->msg, NULL, NULL, NULL);
+ data->comm_recv = simcall_comm_irecv(pr->rdv, &data->msg, NULL, NULL, NULL);
sock->data = data;
XBT_VERB
("'%s' (%d) ears on %s:%d%s (%p; data:%p); Here rdv: %p; Remote rdv: %p; Comm %p",
- SIMIX_req_process_get_name(SIMIX_process_self()), gras_os_getpid(),
+ simcall_process_get_name(SIMIX_process_self()), gras_os_getpid(),
SIMIX_host_self_get_name(), port,
sock->meas ? " (mode meas)" : "", sock, data,
(data->server ==
smx_process_t remote_dude =
(sock_data->server ==
SIMIX_process_self())? (sock_data->client) : (sock_data->server);
- smx_host_t remote_host = SIMIX_req_process_get_host(remote_dude);
+ smx_host_t remote_host = simcall_process_get_host(remote_dude);
}
*/
//SIMIX_network_send(sock_data->rdv,size,1,-1,NULL,0,NULL,NULL);
//gras_trp_sg_sock_data_t *sock_data =
// (gras_trp_sg_sock_data_t *) sock->data;
- //SIMIX_req_comm_recv(sock_data->rdv,-1,NULL,0,NULL);
+ //simcall_comm_recv(sock_data->rdv,-1,NULL,0,NULL);
THROW_UNIMPLEMENTED;
#ifdef KILLME
gras_trp_sg_sock_data_t *remote_sock_data;
sock_data = (gras_trp_sg_sock_data_t *) sock->data;
/* ok, I'm here, you can continue the communication */
- SIMIX_req_cond_signal(remote_sock_data->cond);
+ simcall_cond_signal(remote_sock_data->cond);
- SIMIX_req_mutex_lock(remote_sock_data->mutex);
+ simcall_mutex_lock(remote_sock_data->mutex);
/* wait for communication end */
- SIMIX_req_cond_wait(remote_sock_data->cond, remote_sock_data->mutex);
+ simcall_cond_wait(remote_sock_data->cond, remote_sock_data->mutex);
if (msg_got->payl_size != size)
THROWF(mismatch_error, 0,
"Got %d bytes when %ld where expected (in %s->%s:%d)",
msg_got->payl_size, size,
- SIMIX_req_host_get_name(sock_data->to_host),
+ simcall_host_get_name(sock_data->to_host),
SIMIX_host_self_get_name(), sock->peer_port);
if (data)
xbt_free(msg_got->payl);
xbt_free(msg_got);
- SIMIX_req_mutex_unlock(remote_sock_data->mutex);
+ simcall_mutex_unlock(remote_sock_data->mutex);
#endif
return 0;
}
smx_action_t execution;
if (flops > 0){
- execution = SIMIX_req_host_execute("task", SIMIX_host_self(), flops, 1);
- SIMIX_req_host_execution_wait(execution);
+ execution = simcall_host_execute("task", SIMIX_host_self(), flops, 1);
+ simcall_host_execution_wait(execution);
}
}
{
smx_process_t process;
- SIMIX_req_process_create(&process, name, code, NULL,
+ simcall_process_create(&process, name, code, NULL,
gras_os_myname(), argc, argv, properties);
}
gras_hostdata_t *hd =
(gras_hostdata_t *) SIMIX_host_self_get_data();
gras_procdata_t *pd =
- (gras_procdata_t *) SIMIX_req_process_get_data(SIMIX_process_self());
+ (gras_procdata_t *) simcall_process_get_data(SIMIX_process_self());
gras_msg_procdata_t msg_pd =
(gras_msg_procdata_t) gras_libdata_by_name("gras_msg");
xbt_assert(hd, "Run gras_process_init (ie, gras_init)!!");
XBT_VERB("GRAS: Finalizing process '%s' (%d)",
- SIMIX_req_process_get_name(SIMIX_process_self()), gras_os_getpid());
+ simcall_process_get_name(SIMIX_process_self()), gras_os_getpid());
if (!xbt_dynar_is_empty(msg_pd->msg_queue)) {
unsigned int cpt;
gras_procdata_t *gras_procdata_get(void)
{
gras_procdata_t *pd =
- (gras_procdata_t *) SIMIX_req_process_get_data(SIMIX_process_self());
+ (gras_procdata_t *) simcall_process_get_data(SIMIX_process_self());
xbt_assert(pd, "Run gras_process_init! (ie, gras_init)");
void *gras_libdata_by_name_from_remote(const char *name, smx_process_t p)
{
- gras_procdata_t *pd = (gras_procdata_t *) SIMIX_req_process_get_data(p);
+ gras_procdata_t *pd = (gras_procdata_t *) simcall_process_get_data(p);
xbt_assert(pd,
"process '%s' on '%s' didn't run gras_process_init! (ie, gras_init)",
- SIMIX_req_process_get_name(p),
- SIMIX_req_host_get_name(SIMIX_req_process_get_host(p)));
+ simcall_process_get_name(p),
+ simcall_host_get_name(simcall_process_get_host(p)));
return gras_libdata_by_name_from_procdata(name, pd);
}
/** @brief retrieve the value of a given process property (or NULL if not defined) */
const char *gras_process_property_value(const char *name)
{
- return xbt_dict_get_or_null(SIMIX_req_process_get_properties
+ return xbt_dict_get_or_null(simcall_process_get_properties
(SIMIX_process_self()), name);
}
*/
xbt_dict_t gras_process_properties(void)
{
- return SIMIX_req_process_get_properties(SIMIX_process_self());
+ return simcall_process_get_properties(SIMIX_process_self());
}
/* **************************************************************************
const char *gras_os_host_property_value(const char *name)
{
return
- xbt_dict_get_or_null(SIMIX_req_host_get_properties
- (SIMIX_req_process_get_host(SIMIX_process_self())),
+ xbt_dict_get_or_null(simcall_host_get_properties
+ (simcall_process_get_host(SIMIX_process_self())),
name);
}
xbt_dict_t gras_os_host_properties(void)
{
return
- SIMIX_req_host_get_properties(SIMIX_req_process_get_host
+ simcall_host_get_properties(simcall_process_get_host
(SIMIX_process_self()));
}
#include "instr/instr.h"
#include "msg/msg.h"
#include "simdag/private.h"
-#include "simix/private.h"
+#include "simix/smx_private.h"
#include "xbt/graph_private.h"
typedef enum {
{
char *req_str;
int value;
- smx_req_t req = NULL, prev_req = NULL;
+ smx_simcall_t req = NULL, prev_req = NULL;
mc_state_t state = NULL, prev_state = NULL, next_state = NULL;
smx_process_t process = NULL;
xbt_fifo_item_t item = NULL;
mc_stats->executed_transitions++;
/* Answer the request */
- SIMIX_request_pre(req, value); /* After this call req is no longer usefull */
+ SIMIX_simcall_pre(req, value); /* After this call req is no longer usefull */
/* Wait for requests (schedules processes) */
MC_wait_for_requests();
int value;
mc_state_t next_graph_state = NULL;
- smx_req_t req = NULL, prev_req = NULL;
+ smx_simcall_t req = NULL, prev_req = NULL;
char *req_str;
xbt_fifo_item_t item = NULL;
mc_stats->executed_transitions++;
/* Answer the request */
- SIMIX_request_pre(req, value);
+ SIMIX_simcall_pre(req, value);
/* Wait for requests (schedules processes) */
MC_wait_for_requests();
void MC_wait_for_requests(void)
{
smx_process_t process;
- smx_req_t req;
+ smx_simcall_t req;
unsigned int iter;
while (!xbt_dynar_is_empty(simix_global->process_to_run)) {
SIMIX_process_runall();
xbt_dynar_foreach(simix_global->process_that_ran, iter, process) {
- req = &process->request;
+ req = &process->simcall;
if (req->call != REQ_NO_REQ && !MC_request_is_visible(req))
- SIMIX_request_pre(req, 0);
+ SIMIX_simcall_pre(req, 0);
}
}
}
if(xbt_swag_size(simix_global->process_list)){
deadlock = TRUE;
xbt_swag_foreach(process, simix_global->process_list){
- if(process->request.call != REQ_NO_REQ
- && MC_request_is_enabled(&process->request)){
+ if(process->simcall.call != REQ_NO_REQ
+ && MC_request_is_enabled(&process->simcall)){
deadlock = FALSE;
break;
}
{
int value;
char *req_str;
- smx_req_t req = NULL, saved_req = NULL;
+ smx_simcall_t req = NULL, saved_req = NULL;
xbt_fifo_item_t item;
mc_state_t state;
if(saved_req){
/* because we got a copy of the executed request, we have to fetch the
real one, pointed by the request field of the issuer process */
- req = &saved_req->issuer->request;
+ req = &saved_req->issuer->simcall;
/* Debug information */
if(XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)){
}
}
- SIMIX_request_pre(req, value);
+ SIMIX_simcall_pre(req, value);
MC_wait_for_requests();
/* Update statistics */
{
int value;
char *req_str;
- smx_req_t req = NULL, saved_req = NULL;
+ smx_simcall_t req = NULL, saved_req = NULL;
xbt_fifo_item_t item;
mc_state_t state;
mc_pair_stateless_t pair;
if(saved_req != NULL){
/* because we got a copy of the executed request, we have to fetch the
real one, pointed by the request field of the issuer process */
- req = &saved_req->issuer->request;
+ req = &saved_req->issuer->simcall;
//XBT_DEBUG("Req->call %u", req->call);
/* Debug information */
}
- SIMIX_request_pre(req, value);
+ SIMIX_simcall_pre(req, value);
MC_wait_for_requests();
}
if(saved_req != NULL){
/* because we got a copy of the executed request, we have to fetch the
real one, pointed by the request field of the issuer process */
- req = &saved_req->issuer->request;
+ req = &saved_req->issuer->simcall;
//XBT_DEBUG("Req->call %u", req->call);
/* Debug information */
}
- SIMIX_request_pre(req, value);
+ SIMIX_simcall_pre(req, value);
MC_wait_for_requests();
}
int value;
mc_state_t state;
xbt_fifo_item_t item;
- smx_req_t req;
+ smx_simcall_t req;
char *req_str = NULL;
for (item = xbt_fifo_get_last_item(stack);
}
}
-void MC_show_deadlock(smx_req_t req)
+void MC_show_deadlock(smx_simcall_t req)
{
/*char *req_str = NULL;*/
XBT_INFO("**************************");
MC_dump_stack_safety_stateless(mc_stack_safety_stateless);
}
-void MC_show_deadlock_stateful(smx_req_t req)
+void MC_show_deadlock_stateful(smx_simcall_t req)
{
/*char *req_str = NULL;*/
XBT_INFO("**************************");
int value;
mc_state_ws_t state;
xbt_fifo_item_t item;
- smx_req_t req;
+ smx_simcall_t req;
char *req_str = NULL;
for (item = xbt_fifo_get_last_item(stack);
int value;
mc_pair_stateless_t pair;
xbt_fifo_item_t item;
- smx_req_t req;
+ smx_simcall_t req;
char *req_str = NULL;
for (item = xbt_fifo_get_last_item(stack);
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();
static char* pointer_to_string(void* pointer);
static char* buff_size_to_string(size_t size);
-int MC_request_depend(smx_req_t r1, smx_req_t r2)
+int MC_request_depend(smx_simcall_t r1, smx_simcall_t r2)
{
if(_surf_do_model_check == 2)
return TRUE;
}
-char *MC_request_to_string(smx_req_t req, int value)
+char *MC_request_to_string(smx_simcall_t req, int value)
{
char *type = NULL, *args = NULL, *str = NULL, *p = NULL, *bs = NULL;
smx_action_t act = NULL;
return str;
}
-unsigned int MC_request_testany_fail(smx_req_t req)
+unsigned int MC_request_testany_fail(smx_simcall_t req)
{
unsigned int cursor;
smx_action_t action;
return TRUE;
}
-int MC_request_is_visible(smx_req_t req)
+int MC_request_is_visible(smx_simcall_t req)
{
return req->call == REQ_COMM_ISEND
|| req->call == REQ_COMM_IRECV
|| req->call == REQ_COMM_TESTANY;
}
-int MC_request_is_enabled(smx_req_t req)
+int MC_request_is_enabled(smx_simcall_t req)
{
unsigned int index = 0;
smx_action_t act;
}
}
-int MC_request_is_enabled_by_idx(smx_req_t req, unsigned int idx)
+int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
{
smx_action_t act;
int MC_process_is_enabled(smx_process_t process)
{
- if (process->request.call != REQ_NO_REQ && MC_request_is_enabled(&process->request))
+ if (process->simcall.call != REQ_NO_REQ && MC_request_is_enabled(&process->simcall))
return TRUE;
return FALSE;
return state->proc_status[process->pid].state == MC_DONE ? TRUE : FALSE;
}
-void MC_state_set_executed_request(mc_state_t state, smx_req_t req, int value)
+void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, int value)
{
state->executed_req = *req;
state->req_num = value;
}
}
-smx_req_t MC_state_get_executed_request(mc_state_t state, int *value)
+smx_simcall_t MC_state_get_executed_request(mc_state_t state, int *value)
{
*value = state->req_num;
return &state->executed_req;
}
-smx_req_t MC_state_get_internal_request(mc_state_t state)
+smx_simcall_t MC_state_get_internal_request(mc_state_t state)
{
return &state->internal_req;
}
-smx_req_t MC_state_get_request(mc_state_t state, int *value)
+smx_simcall_t MC_state_get_request(mc_state_t state, int *value)
{
smx_process_t process = NULL;
mc_procstate_t procstate = NULL;
if(procstate->state == MC_INTERLEAVE){
if(MC_process_is_enabled(process)){
- switch(process->request.call){
+ switch(process->simcall.call){
case REQ_COMM_WAITANY:
*value = -1;
- while(procstate->interleave_count < xbt_dynar_length(process->request.comm_waitany.comms)){
- if(MC_request_is_enabled_by_idx(&process->request, procstate->interleave_count++)){
+ while(procstate->interleave_count < xbt_dynar_length(process->simcall.comm_waitany.comms)){
+ if(MC_request_is_enabled_by_idx(&process->simcall, procstate->interleave_count++)){
*value = procstate->interleave_count-1;
break;
}
}
- if(procstate->interleave_count >= xbt_dynar_length(process->request.comm_waitany.comms))
+ if(procstate->interleave_count >= xbt_dynar_length(process->simcall.comm_waitany.comms))
procstate->state = MC_DONE;
if(*value != -1)
- return &process->request;
+ return &process->simcall;
break;
case REQ_COMM_TESTANY:
start_count = procstate->interleave_count;
*value = -1;
- while(procstate->interleave_count < xbt_dynar_length(process->request.comm_testany.comms)){
- if(MC_request_is_enabled_by_idx(&process->request, procstate->interleave_count++)){
+ while(procstate->interleave_count < xbt_dynar_length(process->simcall.comm_testany.comms)){
+ if(MC_request_is_enabled_by_idx(&process->simcall, procstate->interleave_count++)){
*value = procstate->interleave_count - 1;
break;
}
}
- if(procstate->interleave_count >= xbt_dynar_length(process->request.comm_testany.comms))
+ if(procstate->interleave_count >= xbt_dynar_length(process->simcall.comm_testany.comms))
procstate->state = MC_DONE;
if(*value != -1 || start_count == 0)
- return &process->request;
+ return &process->simcall;
break;
case REQ_COMM_WAIT:
- if(process->request.comm_wait.comm->comm.src_proc
- && process->request.comm_wait.comm->comm.dst_proc){
+ if(process->simcall.comm_wait.comm->comm.src_proc
+ && process->simcall.comm_wait.comm->comm.dst_proc){
*value = 0;
}else{
*value = -1;
}
procstate->state = MC_DONE;
- return &process->request;
+ return &process->simcall;
break;
default:
procstate->state = MC_DONE;
*value = 0;
- return &process->request;
+ return &process->simcall;
break;
}
}
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 {
m_host_t MSG_get_host_by_name(const char *name)
{
smx_host_t simix_h = NULL;
- simix_h = SIMIX_req_host_get_by_name(name);
+ simix_h = simcall_host_get_by_name(name);
if (simix_h == NULL)
return NULL;
- return (m_host_t) SIMIX_req_host_get_data(simix_h);
+ return (m_host_t) simcall_host_get_data(simix_h);
}
/** \ingroup msg_easier_life
*/
int MSG_process_killall(int reset_PIDs)
{
- SIMIX_req_process_killall();
+ simcall_process_killall();
if (reset_PIDs > 0) {
msg_global->PID = reset_PIDs;
p_simdata = SIMIX_process_self_get_data(self);
simdata->isused=1;
simdata->compute =
- SIMIX_req_host_execute(task->name, p_simdata->m_host->simdata->smx_host,
+ simcall_host_execute(task->name, p_simdata->m_host->simdata->smx_host,
simdata->computation_amount,
simdata->priority);
#ifdef HAVE_TRACING
- SIMIX_req_set_category(simdata->compute, task->category);
+ simcall_set_category(simdata->compute, task->category);
#endif
p_simdata->waiting_action = simdata->compute;
- comp_state = SIMIX_req_host_execution_wait(simdata->compute);
+ comp_state = simcall_host_execution_wait(simdata->compute);
p_simdata->waiting_action = NULL;
simdata->isused=0;
TRACE_msg_task_execute_end(task);
#endif
MSG_RETURN(MSG_OK);
- } else if (SIMIX_req_host_get_state(SIMIX_host_self()) == 0) {
+ } else if (simcall_host_get_state(SIMIX_host_self()) == 0) {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
simdata->comm = NULL;
simdata->compute = NULL;
simdata->isused=1;
simdata->compute =
- SIMIX_req_host_parallel_execute(task->name, simdata->host_nb,
+ simcall_host_parallel_execute(task->name, simdata->host_nb,
simdata->host_list,
simdata->comp_amount,
simdata->comm_amount, 1.0, -1.0);
XBT_DEBUG("Parallel execution action created: %p", simdata->compute);
p_simdata->waiting_action = simdata->compute;
- comp_state = SIMIX_req_host_execution_wait(simdata->compute);
+ comp_state = simcall_host_execution_wait(simdata->compute);
p_simdata->waiting_action = NULL;
XBT_DEBUG("Finished waiting for execution of action %p, state = %d", simdata->compute, comp_state);
simdata->comm = NULL;
simdata->compute = NULL;
MSG_RETURN(MSG_OK);
- } else if (SIMIX_req_host_get_state(SIMIX_host_self()) == 0) {
+ } else if (simcall_host_get_state(SIMIX_host_self()) == 0) {
/* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
simdata->comm = NULL;
simdata->compute = NULL;
#endif
/* create action to sleep */
- state = SIMIX_req_process_sleep(nb_sec);
+ state = simcall_process_sleep(nb_sec);
/*proc->simdata->waiting_action = act_sleep;
comm->task_received = NULL;
comm->status = MSG_OK;
comm->s_comm =
- SIMIX_req_comm_isend(mailbox, t_simdata->message_size,
+ simcall_comm_isend(mailbox, t_simdata->message_size,
t_simdata->rate, task, sizeof(void *), match_fun, NULL, match_data, 0);
t_simdata->comm = comm->s_comm; /* FIXME: is the field t_simdata->comm still useful? */
msg_global->sent_msg++;
/* Send it by calling SIMIX network layer */
- smx_action_t comm = SIMIX_req_comm_isend(mailbox, t_simdata->message_size,
+ smx_action_t comm = simcall_comm_isend(mailbox, t_simdata->message_size,
t_simdata->rate, task, sizeof(void *), NULL, cleanup, NULL, 1);
t_simdata->comm = comm;
}
comm->task_sent = NULL;
comm->task_received = task;
comm->status = MSG_OK;
- comm->s_comm = SIMIX_req_comm_irecv(rdv, task, NULL, NULL, NULL);
+ comm->s_comm = simcall_comm_irecv(rdv, task, NULL, NULL, NULL);
return comm;
}
xbt_ex_t e;
int finished = 0;
TRY {
- finished = SIMIX_req_comm_test(comm->s_comm);
+ finished = simcall_comm_test(comm->s_comm);
if (finished && comm->task_received != NULL) {
/* I am the receiver */
MSG_error_t status = MSG_OK;
TRY {
- finished_index = SIMIX_req_comm_testany(s_comms);
+ finished_index = simcall_comm_testany(s_comms);
}
CATCH(e) {
switch (e.category) {
{
xbt_ex_t e;
TRY {
- SIMIX_req_comm_wait(comm->s_comm, timeout);
+ simcall_comm_wait(comm->s_comm, timeout);
if (comm->task_received != NULL) {
/* I am the receiver */
MSG_error_t status = MSG_OK;
TRY {
- finished_index = SIMIX_req_comm_waitany(s_comms);
+ finished_index = simcall_comm_waitany(s_comms);
}
CATCH(e) {
switch (e.category) {
if (msg_global->task_copy_callback) {
m_task_t task = buff;
msg_global->task_copy_callback(task,
- SIMIX_req_comm_get_src_proc(comm), SIMIX_req_comm_get_dst_proc(comm));
+ simcall_comm_get_src_proc(comm), simcall_comm_get_dst_proc(comm));
}
}
memset(alias, 0, MAX_ALIAS_NAME + 1);
}
- SIMIX_req_host_set_data(workstation, host);
+ simcall_host_set_data(workstation, host);
xbt_lib_set(host_lib,name,MSG_HOST_LEVEL,host);
return host;
{
xbt_assert((h != NULL), "Invalid parameters");
- return (SIMIX_req_host_get_speed(h->simdata->smx_host));
+ return (simcall_host_get_speed(h->simdata->smx_host));
}
/** \ingroup m_host_management
{
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
- return (SIMIX_req_host_get_properties(host->simdata->smx_host));
+ return (simcall_host_get_properties(host->simdata->smx_host));
}
int MSG_host_is_avail(m_host_t h)
{
xbt_assert((h != NULL), "Invalid parameters (host is NULL)");
- return (SIMIX_req_host_get_state(h->simdata->smx_host));
+ return (simcall_host_get_state(h->simdata->smx_host));
}
msg_mailbox_t MSG_mailbox_new(const char *alias)
{
- return SIMIX_req_rdv_create(alias);
+ return simcall_rdv_create(alias);
}
void MSG_mailbox_free(void *mailbox)
{
- SIMIX_req_rdv_destroy((msg_mailbox_t)mailbox);
+ simcall_rdv_destroy((msg_mailbox_t)mailbox);
}
int MSG_mailbox_is_empty(msg_mailbox_t mailbox)
{
- return (NULL == SIMIX_req_rdv_get_head(mailbox));
+ return (NULL == simcall_rdv_get_head(mailbox));
}
m_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox)
{
- smx_action_t comm = SIMIX_req_rdv_get_head(mailbox);
+ smx_action_t comm = simcall_rdv_get_head(mailbox);
if (!comm)
return NULL;
- return (m_task_t) SIMIX_req_comm_get_src_data(comm);
+ return (m_task_t) simcall_comm_get_src_data(comm);
}
int
MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox,
m_host_t host)
{
- return SIMIX_req_rdv_comm_count_by_host(mailbox,
+ return simcall_rdv_comm_count_by_host(mailbox,
host->simdata->smx_host);
}
msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias)
{
- msg_mailbox_t mailbox = SIMIX_req_rdv_get_by_name(alias);
+ msg_mailbox_t mailbox = simcall_rdv_get_by_name(alias);
if (!mailbox)
mailbox = MSG_mailbox_new(alias);
/* Try to receive it by calling SIMIX network layer */
TRY {
- SIMIX_req_comm_recv(mailbox, task, NULL, NULL, NULL, timeout);
+ simcall_comm_recv(mailbox, task, NULL, NULL, NULL, timeout);
XBT_DEBUG("Got task %s from %p",(*task)->name,mailbox);
(*task)->simdata->isused=0;
}
/* Try to send it by calling SIMIX network layer */
TRY {
- smx_action_t comm = SIMIX_req_comm_isend(mailbox, t_simdata->message_size,
+ smx_action_t comm = simcall_comm_isend(mailbox, t_simdata->message_size,
t_simdata->rate, task, sizeof(void *),
NULL, NULL, task, 0);
#ifdef HAVE_TRACING
if (TRACE_is_enabled()) {
- SIMIX_req_set_category(comm, task->category);
+ simcall_set_category(comm, task->category);
}
#endif
t_simdata->comm = comm;
- SIMIX_req_comm_wait(comm, timeout);
+ simcall_comm_wait(comm, timeout);
}
CATCH(e) {
#define MSG_RETURN(val) do {PROCESS_SET_ERRNO(val);return(val);} while(0)
/* #define CHECK_ERRNO() ASSERT((PROCESS_GET_ERRNO()!=MSG_HOST_FAILURE),"Host failed, you cannot call this function.") */
-/*#define CHECK_HOST() xbt_assert(SIMIX_req_host_get_state(SIMIX_host_self())==1,\
- "Host failed, you cannot call this function. (state=%d)",SIMIX_req_host_get_state(SIMIX_host_self()))*/
+/*#define CHECK_HOST() xbt_assert(simcall_host_get_state(SIMIX_host_self())==1,\
+ "Host failed, you cannot call this function. (state=%d)",simcall_host_get_state(SIMIX_host_self()))*/
#else
# define MSG_RETURN(val) return(val)
#endif
SIMIX_process_self_set_data(smx_proc, NULL);
}
else {
- msg_proc = SIMIX_req_process_get_data(smx_proc);
- SIMIX_req_process_set_data(smx_proc, NULL);
+ msg_proc = simcall_process_get_data(smx_proc);
+ simcall_process_set_data(smx_proc, NULL);
}
#ifdef HAVE_TRACING
/* Let's create the process: SIMIX may decide to start it right now,
* even before returning the flow control to us */
- SIMIX_req_process_create(&process, name, code, simdata, host->name,
+ simcall_process_create(&process, name, code, simdata, host->name,
argc, argv, properties);
if (!process) {
#endif
/* FIXME: why do we only cancel communication actions? is this useful? */
- simdata_process_t p_simdata = SIMIX_req_process_get_data(process);
+ simdata_process_t p_simdata = simcall_process_get_data(process);
if (p_simdata->waiting_task && p_simdata->waiting_task->simdata->comm) {
- SIMIX_req_comm_cancel(p_simdata->waiting_task->simdata->comm);
+ simcall_comm_cancel(p_simdata->waiting_task->simdata->comm);
}
- SIMIX_req_process_kill(process);
+ simcall_process_kill(process);
return;
}
*/
MSG_error_t MSG_process_migrate(m_process_t process, m_host_t host)
{
- simdata_process_t simdata = SIMIX_req_process_get_data(process);
+ simdata_process_t simdata = simcall_process_get_data(process);
simdata->m_host = host;
#ifdef HAVE_TRACING
m_host_t now = simdata->m_host;
TRACE_msg_process_change_host(process, now, host);
#endif
- SIMIX_req_process_change_host(process, host->simdata->smx_host);
+ simcall_process_change_host(process, host->simdata->smx_host);
return MSG_OK;
}
xbt_assert(process != NULL, "Invalid parameter");
/* get from SIMIX the MSG process data, and then the user data */
- simdata_process_t simdata = SIMIX_req_process_get_data(process);
+ simdata_process_t simdata = simcall_process_get_data(process);
return simdata->data;
}
{
xbt_assert(process != NULL, "Invalid parameter");
- simdata_process_t simdata = SIMIX_req_process_get_data(process);
+ simdata_process_t simdata = simcall_process_get_data(process);
simdata->data = data;
return MSG_OK;
simdata = SIMIX_process_self_get_data(SIMIX_process_self());
}
else {
- simdata = SIMIX_req_process_get_data(process);
+ simdata = simcall_process_get_data(process);
}
return simdata->m_host;
}
return 0;
}
- simdata_process_t simdata = SIMIX_req_process_get_data(process);
+ simdata_process_t simdata = simcall_process_get_data(process);
return simdata != NULL ? simdata->PID : 0;
}
{
xbt_assert(process != NULL, "Invalid parameter");
- simdata_process_t simdata = SIMIX_req_process_get_data(process);
+ simdata_process_t simdata = simcall_process_get_data(process);
return simdata->PPID;
}
{
xbt_assert(process, "Invalid parameter");
- return SIMIX_req_process_get_name(process);
+ return simcall_process_get_name(process);
}
/** \ingroup m_process_management
{
xbt_assert(process != NULL, "Invalid parameter");
- return SIMIX_req_process_get_properties(process);
+ return simcall_process_get_properties(process);
}
TRACE_msg_process_suspend(process);
#endif
- SIMIX_req_process_suspend(process);
+ simcall_process_suspend(process);
MSG_RETURN(MSG_OK);
}
TRACE_msg_process_resume(process);
#endif
- SIMIX_req_process_resume(process);
+ simcall_process_resume(process);
MSG_RETURN(MSG_OK);
}
int MSG_process_is_suspended(m_process_t process)
{
xbt_assert(process != NULL, "Invalid parameter");
- return SIMIX_req_process_is_suspended(process);
+ return simcall_process_is_suspended(process);
}
smx_context_t MSG_process_get_smx_ctx(m_process_t process) {
action = task->simdata->compute;
if (action)
- SIMIX_req_host_execution_destroy(action);
+ simcall_host_execution_destroy(action);
/* parallel tasks only */
xbt_free(task->simdata->host_list);
xbt_assert((task != NULL), "Invalid parameter");
if (task->simdata->compute) {
- SIMIX_req_host_execution_cancel(task->simdata->compute);
+ simcall_host_execution_cancel(task->simdata->compute);
}
else if (task->simdata->comm) {
- SIMIX_req_comm_cancel(task->simdata->comm);
+ simcall_comm_cancel(task->simdata->comm);
task->simdata->isused = 0;
}
return MSG_OK;
&& (task->simdata != NULL), "Invalid parameter");
if (task->simdata->compute) {
- return SIMIX_req_host_execution_get_remains(task->simdata->compute);
+ return simcall_host_execution_get_remains(task->simdata->compute);
} else {
return task->simdata->computation_amount;
}
{
xbt_assert((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
- XBT_DEBUG("calling SIMIX_req_communication_get_remains(%p)",
+ XBT_DEBUG("calling simcall_communication_get_remains(%p)",
task->simdata->comm);
- return SIMIX_req_comm_get_remains(task->simdata->comm);
+ return simcall_comm_get_remains(task->simdata->comm);
}
#ifdef HAVE_LATENCY_BOUND_TRACKING
{
xbt_assert((task != NULL)
&& (task->simdata != NULL), "Invalid parameter");
- XBT_DEBUG("calling SIMIX_req_communication_is_latency_bounded(%p)",
+ XBT_DEBUG("calling simcall_communication_is_latency_bounded(%p)",
task->simdata->comm);
- return SIMIX_req_comm_is_latency_bounded(task->simdata->comm);
+ return simcall_comm_is_latency_bounded(task->simdata->comm);
}
#endif
task->simdata->priority = 1 / priority;
if (task->simdata->compute)
- SIMIX_req_host_execution_set_priority(task->simdata->compute,
+ simcall_host_execution_set_priority(task->simdata->compute,
task->simdata->priority);
}
SimGrid this way is a *real* pain in the ass. You cannot use MSG nor
GRAS nor SMPI nor nothing (because none of these interfaces were coded
with the *extrem* requirement of the state_machine in mind), and you
-can only rely on SIMIX. From SIMIX, you can only use requests (ie, the
-SIMIX_req_* functions). Moreover, you must know that each blocking
-request will result in an interruption of your execution flow.
+can only rely on SIMIX. From SIMIX, you can only use simcalls (ie, the
+simcall_* functions). Moreover, you must know that each blocking
+simcall will result in an interruption of your execution flow.
Let's take an example: If your code contains:
- smx_action_t act = SIMIX_req_comm_isend(......);
- SIMIX_req_comm_wait(act);
- SIMIX_req_comm_destroy(act);
+ smx_action_t act = simcall_comm_isend(......);
+ simcall_comm_wait(act);
+ simcall_comm_destroy(act);
The execution flow is interrupted brutally somewhere within
-SIMIX_req_comm_isend(), the variable act will never be set (and any
+simcall_comm_isend(), the variable act will never be set (and any
code written after the first line is discarded).
-Indeed each SIMIX syscall results in an interruption of the calling
+Indeed each SIMIX simcall results in an interruption of the calling
process, but in state_machine there is only one system stack and the
whole state describing the process is in the structure describing it.
So, when we need to remove one process from the system, to pause it,
In short, each time simix wants to interrupt a process, state_machine
does a longjmp(2) to the point just before calling the user code. As a
-result, each time you do a syscall, your stack is destroyed to restore
+result, each time you do a simcall, your stack is destroyed to restore
it in the state where maestro put it before calling your code.
-This means that you cannot do anything after a syscall, and that the
+This means that you cannot do anything after a simcall, and that the
stack is not a safe storing area for your data.
So, you have to write your code as a state machine, with a big ugly
switch (globals->state) {
case l1: /* default value st. we take that branch the first time */
globals->state = l2;
- SIMIX_req_comm_isend(....); /* syscall=>hard interrupt on our code*/
+ simcall_comm_isend(....); /* syscall=>hard interrupt on our code */
case l2: /* we'll take that branch the second time we're scheduled */
globals->comm = res;
globals->state = l3;
- SIMIX_req_comm_wait(globals->comm); /* syscall=>interrupt */
+ simcall_comm_wait(globals->comm); /* syscall=>interrupt */
case l3:
globals->state = where_you_want_to_go_today;
- SIMIX_req_comm_destroy(globals->comm);
+ simcall_comm_destroy(globals->comm);
}
}
if (context->cleanup_func)
context->cleanup_func(context->data);
context->iwannadie = 0;
- SIMIX_req_process_cleanup(context->data);
+ simcall_process_cleanup(context->data);
context->iwannadie = 1;
}
parse_argv,
current_property_set);
else
- SIMIX_req_process_create(&process, parse_argv[0], parse_code, NULL, parse_host, parse_argc, parse_argv,
+ simcall_process_create(&process, parse_argv[0], parse_code, NULL, parse_host, parse_argc, parse_argv,
current_property_set);
/* verify if process has been created (won't be the case if the host is currently dead, but that's fine) */
if (!process) {
xbt_dynar_length(simix_global->process_to_run));
SIMIX_process_runall();
xbt_dynar_foreach(simix_global->process_that_ran, iter, process) {
- if (process->request.call != REQ_NO_REQ) {
- SIMIX_request_pre(&process->request, 0);
+ if (process->simcall.call != SIMCALL_NONE) {
+ SIMIX_simcall_pre(&process->simcall, 0);
}
}
}
xbt_dynar_foreach(model_list, iter, model) {
set = model->states.failed_action_set;
while ((action = xbt_swag_extract(set)))
- SIMIX_request_post((smx_action_t) action->data);
+ SIMIX_simcall_post((smx_action_t) action->data);
set = model->states.done_action_set;
while ((action = xbt_swag_extract(set)))
- SIMIX_request_post((smx_action_t) action->data);
+ SIMIX_simcall_post((smx_action_t) action->data);
}
/* Clean processes to destroy */
static void* SIMIX_action_mallocator_new_f(void) {
smx_action_t action = xbt_new(s_smx_action_t, 1);
- action->request_list = xbt_fifo_new();
+ action->simcalls = xbt_fifo_new();
return action;
}
static void SIMIX_action_mallocator_free_f(void* action) {
- xbt_fifo_free(((smx_action_t) action)->request_list);
+ xbt_fifo_free(((smx_action_t) action)->simcalls);
xbt_free(action);
}
static void SIMIX_action_mallocator_reset_f(void* action) {
- // we also recycle the request list
- xbt_fifo_t fifo = ((smx_action_t) action)->request_list;
+ // we also recycle the simcall list
+ xbt_fifo_t fifo = ((smx_action_t) action)->simcalls;
xbt_fifo_reset(fifo);
memset(action, 0, sizeof(s_smx_action_t));
- ((smx_action_t) action)->request_list = fifo;
+ ((smx_action_t) action)->simcalls = fifo;
}
return (process == NULL) ? NULL : SIMIX_process_get_host(process);
}
-/* needs to be public and without request because it is called
+/* needs to be public and without simcall because it is called
by exceptions and logging events */
const char* SIMIX_host_self_get_name(void)
{
surf_workstation_model->set_priority(action->execution.surf_exec, priority);
}
-void SIMIX_pre_host_execution_wait(smx_req_t req)
+void SIMIX_pre_host_execution_wait(smx_simcall_t simcall)
{
- smx_action_t action = req->host_execution_wait.execution;
+ smx_action_t action = simcall->host_execution_wait.execution;
XBT_DEBUG("Wait for execution of action %p, state %d", action, action->state);
- /* Associate this request to the action */
- xbt_fifo_push(action->request_list, req);
- req->issuer->waiting_action = action;
+ /* Associate this simcall to the action */
+ xbt_fifo_push(action->simcalls, simcall);
+ simcall->issuer->waiting_action = action;
/* set surf's action */
- if (MC_IS_ENABLED){
+ if (MC_IS_ENABLED) {
action->state = SIMIX_DONE;
SIMIX_execution_finish(action);
return;
void SIMIX_execution_finish(smx_action_t action)
{
volatile xbt_fifo_item_t item;
- smx_req_t req;
+ smx_simcall_t simcall;
- xbt_fifo_foreach(action->request_list, item, req, smx_req_t) {
+ xbt_fifo_foreach(action->simcalls, item, simcall, smx_simcall_t) {
switch (action->state) {
break;
case SIMIX_FAILED:
- XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", req->issuer->smx_host->name);
+ XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->smx_host->name);
TRY {
THROWF(host_error, 0, "Host failed");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
TRY {
THROWF(cancel_error, 0, "Canceled");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
xbt_die("Internal error in SIMIX_execution_finish: unexpected action state %d",
action->state);
}
- req->issuer->waiting_action = NULL;
- req->host_execution_wait.result = action->state;
- SIMIX_request_answer(req);
+ simcall->issuer->waiting_action = NULL;
+ simcall->host_execution_wait.result = action->state;
+ SIMIX_simcall_answer(simcall);
}
/* We no longer need it */
action->execution.surf_exec = NULL;
}
- /* 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_execution_finish(action);
+ }
}
double SIMIX_host_execution_get_remains(smx_action_t action);
e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action);
void SIMIX_host_execution_set_priority(smx_action_t action, double priority);
-void SIMIX_pre_host_execution_wait(smx_req_t req);
+void SIMIX_pre_host_execution_wait(smx_simcall_t simcall);
void SIMIX_host_execution_suspend(smx_action_t action);
void SIMIX_host_execution_resume(smx_action_t action);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix,
"Logging specific to SIMIX (io)");
-void SIMIX_pre_file_read(smx_req_t req)
+void SIMIX_pre_file_read(smx_simcall_t simcall)
{
- smx_action_t action = SIMIX_file_read(req->issuer, req->file_read.name);
- xbt_fifo_push(action->request_list, req);
- req->issuer->waiting_action = action;
+ smx_action_t action = SIMIX_file_read(simcall->issuer, simcall->file_read.name);
+ xbt_fifo_push(action->simcalls, simcall);
+ simcall->issuer->waiting_action = action;
}
smx_action_t SIMIX_file_read(smx_process_t process, char* name)
void SIMIX_io_finish(smx_action_t action)
{
volatile xbt_fifo_item_t item;
- smx_req_t req;
+ smx_simcall_t simcall;
- xbt_fifo_foreach(action->request_list, item, req, smx_req_t) {
+ xbt_fifo_foreach(action->simcalls, item, simcall, smx_simcall_t) {
switch (action->state) {
TRY {
THROWF(io_error, 0, "IO failed");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
TRY {
THROWF(cancel_error, 0, "Canceled");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
xbt_die("Internal error in SIMIX_io_finish: unexpected action state %d",
action->state);
}
- req->issuer->waiting_action = NULL;
- SIMIX_request_answer(req);
+ simcall->issuer->waiting_action = NULL;
+ SIMIX_simcall_answer(simcall);
}
/* We no longer need it */
#include "simix/datatypes.h"
#include "smx_smurf_private.h"
-void SIMIX_pre_file_read(smx_req_t req);
+void SIMIX_pre_file_read(smx_simcall_t simcall);
smx_action_t SIMIX_file_read(smx_process_t process, char* name);
void SIMIX_post_io(smx_action_t action);
void SIMIX_io_destroy(smx_action_t action);
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) {
}
/**
- * \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);
}
}
int (*)(void *, void *), void *data);
void SIMIX_comm_destroy(smx_action_t action);
void SIMIX_comm_destroy_internal_actions(smx_action_t action);
-void SIMIX_pre_comm_wait(smx_req_t req, smx_action_t action, double timeout, int idx);
-void SIMIX_pre_comm_waitany(smx_req_t req, int idx);
+void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout, int idx);
+void SIMIX_pre_comm_waitany(smx_simcall_t simcall, int idx);
void SIMIX_post_comm(smx_action_t action);
-void SIMIX_pre_comm_test(smx_req_t req);
-void SIMIX_pre_comm_testany(smx_req_t req, int idx);
+void SIMIX_pre_comm_test(smx_simcall_t simcall);
+void SIMIX_pre_comm_testany(smx_simcall_t simcall, int idx);
void SIMIX_comm_cancel(smx_action_t action);
double SIMIX_comm_get_remains(smx_action_t action);
e_smx_state_t SIMIX_comm_get_state(smx_action_t action);
e_smx_action_type_t type; /* Type of SIMIX action*/
e_smx_state_t state; /* State of the action */
char *name; /* Action name if any */
- xbt_fifo_t request_list; /* List of requests on this action */
+ xbt_fifo_t simcalls; /* List of simcalls waiting for this action */
/* Data specific to each action type */
union {
maestro->running_ctx = xbt_new(xbt_running_ctx_t, 1);
XBT_RUNNING_CTX_INITIALIZE(maestro->running_ctx);
maestro->context = SIMIX_context_new(NULL, 0, NULL, NULL, maestro);
- maestro->request.issuer = maestro;
+ maestro->simcall.issuer = maestro;
simix_global->maestro_process = maestro;
return;
* \brief Internal function to create a process.
*
* This function actually creates the process.
- * It may be called when a REQ_PROCESS_CREATE request occurs,
+ * It may be called when a SIMCALL_PROCESS_CREATE simcall occurs,
* or directly for SIMIX internal purposes.
*
* \return the process created
(*process)->smx_host = host;
(*process)->data = data;
(*process)->comms = xbt_fifo_new();
- (*process)->request.issuer = *process;
+ (*process)->simcall.issuer = *process;
XBT_VERB("Create context %s", (*process)->name);
(*process)->context = SIMIX_context_new(code, argc, argv,
/**
* \brief Internal function to kill a SIMIX process.
*
- * This function may be called when a REQ_PROCESS_KILL request occurs,
+ * This function may be called when a SIMCALL_PROCESS_KILL simcall occurs,
* or directly for SIMIX internal purposes.
*
* \param process poor victim
break;
case SIMIX_ACTION_SYNCHRO:
- SIMIX_synchro_stop_waiting(process, &process->request);
+ SIMIX_synchro_stop_waiting(process, &process->simcall);
SIMIX_synchro_destroy(process->waiting_action);
break;
process->new_host = dest;
}
-void SIMIX_pre_process_suspend(smx_req_t req)
+void SIMIX_pre_process_suspend(smx_simcall_t simcall)
{
- smx_process_t process = req->process_suspend.process;
- SIMIX_process_suspend(process, req->issuer);
+ smx_process_t process = simcall->process_suspend.process;
+ SIMIX_process_suspend(process, simcall->issuer);
- if (process != req->issuer) {
- SIMIX_request_answer(req);
+ if (process != simcall->issuer) {
+ SIMIX_simcall_answer(simcall);
}
- /* If we are suspending ourselves, then just do not replay the request. */
+ /* If we are suspending ourselves, then just do not finish the simcall now */
}
void SIMIX_process_suspend(smx_process_t process, smx_process_t issuer)
return process->smx_host;
}
-/* needs to be public and without request because it is called
+/* needs to be public and without simcall because it is called
by exceptions and logging events */
const char* SIMIX_process_self_get_name(void) {
return process->properties;
}
-void SIMIX_pre_process_sleep(smx_req_t req)
+void SIMIX_pre_process_sleep(smx_simcall_t simcall)
{
if (MC_IS_ENABLED) {
- MC_process_clock_add(req->issuer, req->process_sleep.duration);
- req->process_sleep.result = SIMIX_DONE;
- SIMIX_request_answer(req);
+ MC_process_clock_add(simcall->issuer, simcall->process_sleep.duration);
+ simcall->process_sleep.result = SIMIX_DONE;
+ SIMIX_simcall_answer(simcall);
return;
}
- smx_action_t action = SIMIX_process_sleep(req->issuer, req->process_sleep.duration);
- xbt_fifo_push(action->request_list, req);
- req->issuer->waiting_action = action;
+ smx_action_t action = SIMIX_process_sleep(simcall->issuer, simcall->process_sleep.duration);
+ xbt_fifo_push(action->simcalls, simcall);
+ simcall->issuer->waiting_action = action;
}
smx_action_t SIMIX_process_sleep(smx_process_t process, double duration)
void SIMIX_post_process_sleep(smx_action_t action)
{
- smx_req_t req;
+ smx_simcall_t simcall;
e_smx_state_t state;
- while ((req = xbt_fifo_shift(action->request_list))) {
+ while ((simcall = xbt_fifo_shift(action->simcalls))) {
switch(surf_workstation_model->action_state_get(action->sleep.surf_sleep)){
case SURF_ACTION_FAILED:
THROW_IMPOSSIBLE;
break;
}
- req->process_sleep.result = state;
- req->issuer->waiting_action = NULL;
- SIMIX_request_answer(req);
+ simcall->process_sleep.result = state;
+ simcall->issuer->waiting_action = NULL;
+ SIMIX_simcall_answer(simcall);
}
SIMIX_process_sleep_destroy(action);
}
smx_action_t waiting_action; /* the current blocking action if any */
xbt_fifo_t comms; /* the current non-blocking communication actions */
xbt_dict_t properties;
- s_smx_req_t request;
+ s_smx_simcall_t simcall;
void *data; /* kept for compatibility, it should be replaced with moddata */
} s_smx_process_t;
void SIMIX_process_change_host(smx_process_t process,
smx_host_t dest);
void SIMIX_pre_process_change_host(smx_process_t process, smx_host_t host);
-void SIMIX_pre_process_suspend(smx_req_t req);
+void SIMIX_pre_process_suspend(smx_simcall_t simcall);
void SIMIX_process_suspend(smx_process_t process, smx_process_t issuer);
void SIMIX_process_resume(smx_process_t process, smx_process_t issuer);
void* SIMIX_process_get_data(smx_process_t process);
smx_process_t SIMIX_process_get_by_name(const char* name);
int SIMIX_process_is_suspended(smx_process_t process);
xbt_dict_t SIMIX_process_get_properties(smx_process_t process);
-void SIMIX_pre_process_sleep(smx_req_t req);
+void SIMIX_pre_process_sleep(smx_simcall_t simcall);
smx_action_t SIMIX_process_sleep(smx_process_t process, double duration);
void SIMIX_post_process_sleep(smx_action_t action);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_smurf, simix,
"Logging specific to SIMIX (SMURF)");
-XBT_INLINE smx_req_t SIMIX_req_mine()
+XBT_INLINE smx_simcall_t SIMIX_simcall_mine()
{
smx_process_t issuer = SIMIX_process_self();
- return &issuer->request;
+ return &issuer->simcall;
}
/**
- * \brief Makes the current process do a request to the kernel and yields
+ * \brief Makes the current process do a simcall to the kernel and yields
* until completion.
* \param self the current process
*/
-void SIMIX_request_push(smx_process_t self)
+void SIMIX_simcall_push(smx_process_t self)
{
if (self != simix_global->maestro_process) {
- XBT_DEBUG("Yield process '%s' on request of type %s (%d)", self->name,
- SIMIX_request_name(self->request.call), self->request.call);
+ XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
+ SIMIX_simcall_name(self->simcall.call), self->simcall.call);
SIMIX_process_yield(self);
} else {
- SIMIX_request_pre(&self->request, 0);
+ SIMIX_simcall_pre(&self->simcall, 0);
}
}
-void SIMIX_request_answer(smx_req_t req)
+void SIMIX_simcall_answer(smx_simcall_t simcall)
{
- if (req->issuer != simix_global->maestro_process){
- XBT_DEBUG("Answer request %s (%d) issued by %s (%p)", SIMIX_request_name(req->call), req->call,
- req->issuer->name, req->issuer);
- req->issuer->request.call = REQ_NO_REQ;
- xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, req->issuer);
+ if (simcall->issuer != simix_global->maestro_process){
+ XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), simcall->call,
+ simcall->issuer->name, simcall->issuer);
+ simcall->issuer->simcall.call = SIMCALL_NONE;
+ xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, simcall->issuer);
}
}
-void SIMIX_request_pre(smx_req_t req, int value)
+void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
{
- XBT_DEBUG("Handling request %p: %s", req, SIMIX_request_name(req->call));
+ XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
- switch (req->call) {
- case REQ_COMM_TEST:
- SIMIX_pre_comm_test(req);
+ switch (simcall->call) {
+ case SIMCALL_COMM_TEST:
+ SIMIX_pre_comm_test(simcall);
break;
- case REQ_COMM_TESTANY:
- SIMIX_pre_comm_testany(req, value);
+ case SIMCALL_COMM_TESTANY:
+ SIMIX_pre_comm_testany(simcall, value);
break;
- case REQ_COMM_WAIT:
- SIMIX_pre_comm_wait(req,
- req->comm_wait.comm,
- req->comm_wait.timeout,
+ case SIMCALL_COMM_WAIT:
+ SIMIX_pre_comm_wait(simcall,
+ simcall->comm_wait.comm,
+ simcall->comm_wait.timeout,
value);
break;
- case REQ_COMM_WAITANY:
- SIMIX_pre_comm_waitany(req, value);
+ case SIMCALL_COMM_WAITANY:
+ SIMIX_pre_comm_waitany(simcall, value);
break;
- case REQ_COMM_SEND:
+ case SIMCALL_COMM_SEND:
{
smx_action_t comm = SIMIX_comm_isend(
- req->issuer,
- req->comm_send.rdv,
- req->comm_send.task_size,
- req->comm_send.rate,
- req->comm_send.src_buff,
- req->comm_send.src_buff_size,
- req->comm_send.match_fun,
+ simcall->issuer,
+ simcall->comm_send.rdv,
+ simcall->comm_send.task_size,
+ simcall->comm_send.rate,
+ simcall->comm_send.src_buff,
+ simcall->comm_send.src_buff_size,
+ simcall->comm_send.match_fun,
NULL, /* no clean function since it's not detached */
- req->comm_send.data,
+ simcall->comm_send.data,
0);
- SIMIX_pre_comm_wait(req, comm, req->comm_send.timeout, 0);
+ SIMIX_pre_comm_wait(simcall, comm, simcall->comm_send.timeout, 0);
break;
}
- case REQ_COMM_ISEND:
- req->comm_isend.result = SIMIX_comm_isend(
- req->issuer,
- req->comm_isend.rdv,
- req->comm_isend.task_size,
- req->comm_isend.rate,
- req->comm_isend.src_buff,
- req->comm_isend.src_buff_size,
- req->comm_isend.match_fun,
- req->comm_isend.clean_fun,
- req->comm_isend.data,
- req->comm_isend.detached);
- SIMIX_request_answer(req);
- break;
-
- case REQ_COMM_RECV:
+ case SIMCALL_COMM_ISEND:
+ simcall->comm_isend.result = SIMIX_comm_isend(
+ simcall->issuer,
+ simcall->comm_isend.rdv,
+ simcall->comm_isend.task_size,
+ simcall->comm_isend.rate,
+ simcall->comm_isend.src_buff,
+ simcall->comm_isend.src_buff_size,
+ simcall->comm_isend.match_fun,
+ simcall->comm_isend.clean_fun,
+ simcall->comm_isend.data,
+ simcall->comm_isend.detached);
+ SIMIX_simcall_answer(simcall);
+ break;
+
+ case SIMCALL_COMM_RECV:
{
smx_action_t comm = SIMIX_comm_irecv(
- req->issuer,
- req->comm_recv.rdv,
- req->comm_recv.dst_buff,
- req->comm_recv.dst_buff_size,
- req->comm_recv.match_fun,
- req->comm_recv.data);
- SIMIX_pre_comm_wait(req, comm, req->comm_recv.timeout, 0);
+ simcall->issuer,
+ simcall->comm_recv.rdv,
+ simcall->comm_recv.dst_buff,
+ simcall->comm_recv.dst_buff_size,
+ simcall->comm_recv.match_fun,
+ simcall->comm_recv.data);
+ SIMIX_pre_comm_wait(simcall, comm, simcall->comm_recv.timeout, 0);
break;
}
- case REQ_COMM_IRECV:
- req->comm_irecv.result = SIMIX_comm_irecv(
- req->issuer,
- req->comm_irecv.rdv,
- req->comm_irecv.dst_buff,
- req->comm_irecv.dst_buff_size,
- req->comm_irecv.match_fun,
- req->comm_irecv.data);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_IRECV:
+ simcall->comm_irecv.result = SIMIX_comm_irecv(
+ simcall->issuer,
+ simcall->comm_irecv.rdv,
+ simcall->comm_irecv.dst_buff,
+ simcall->comm_irecv.dst_buff_size,
+ simcall->comm_irecv.match_fun,
+ simcall->comm_irecv.data);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COMM_DESTROY:
- SIMIX_comm_destroy(req->comm_destroy.comm);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_DESTROY:
+ SIMIX_comm_destroy(simcall->comm_destroy.comm);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COMM_CANCEL:
- SIMIX_comm_cancel(req->comm_cancel.comm);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_CANCEL:
+ SIMIX_comm_cancel(simcall->comm_cancel.comm);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COMM_GET_REMAINS:
- req->comm_get_remains.result =
- SIMIX_comm_get_remains(req->comm_get_remains.comm);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_GET_REMAINS:
+ simcall->comm_get_remains.result =
+ SIMIX_comm_get_remains(simcall->comm_get_remains.comm);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COMM_GET_STATE:
- req->comm_get_state.result =
- SIMIX_comm_get_state(req->comm_get_state.comm);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_GET_STATE:
+ simcall->comm_get_state.result =
+ SIMIX_comm_get_state(simcall->comm_get_state.comm);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COMM_GET_SRC_DATA:
- req->comm_get_src_data.result = SIMIX_comm_get_src_data(req->comm_get_src_data.comm);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_GET_SRC_DATA:
+ simcall->comm_get_src_data.result = SIMIX_comm_get_src_data(simcall->comm_get_src_data.comm);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COMM_GET_DST_DATA:
- req->comm_get_dst_data.result = SIMIX_comm_get_dst_data(req->comm_get_dst_data.comm);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_GET_DST_DATA:
+ simcall->comm_get_dst_data.result = SIMIX_comm_get_dst_data(simcall->comm_get_dst_data.comm);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COMM_GET_SRC_PROC:
- req->comm_get_src_proc.result =
- SIMIX_comm_get_src_proc(req->comm_get_src_proc.comm);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_GET_SRC_PROC:
+ simcall->comm_get_src_proc.result =
+ SIMIX_comm_get_src_proc(simcall->comm_get_src_proc.comm);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COMM_GET_DST_PROC:
- req->comm_get_dst_proc.result =
- SIMIX_comm_get_dst_proc(req->comm_get_dst_proc.comm);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_GET_DST_PROC:
+ simcall->comm_get_dst_proc.result =
+ SIMIX_comm_get_dst_proc(simcall->comm_get_dst_proc.comm);
+ SIMIX_simcall_answer(simcall);
break;
#ifdef HAVE_LATENCY_BOUND_TRACKING
- case REQ_COMM_IS_LATENCY_BOUNDED:
- req->comm_is_latency_bounded.result =
- SIMIX_comm_is_latency_bounded(req->comm_is_latency_bounded.comm);
- SIMIX_request_answer(req);
+ case SIMCALL_COMM_IS_LATENCY_BOUNDED:
+ simcall->comm_is_latency_bounded.result =
+ SIMIX_comm_is_latency_bounded(simcall->comm_is_latency_bounded.comm);
+ SIMIX_simcall_answer(simcall);
break;
#endif
- case REQ_RDV_CREATE:
- req->rdv_create.result = SIMIX_rdv_create(req->rdv_create.name);
- SIMIX_request_answer(req);
+ case SIMCALL_RDV_CREATE:
+ simcall->rdv_create.result = SIMIX_rdv_create(simcall->rdv_create.name);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_RDV_DESTROY:
- SIMIX_rdv_destroy(req->rdv_destroy.rdv);
- SIMIX_request_answer(req);
+ case SIMCALL_RDV_DESTROY:
+ SIMIX_rdv_destroy(simcall->rdv_destroy.rdv);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_RDV_GEY_BY_NAME:
- req->rdv_get_by_name.result =
- SIMIX_rdv_get_by_name(req->rdv_get_by_name.name);
- SIMIX_request_answer(req);
+ case SIMCALL_RDV_GEY_BY_NAME:
+ simcall->rdv_get_by_name.result =
+ SIMIX_rdv_get_by_name(simcall->rdv_get_by_name.name);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_RDV_COMM_COUNT_BY_HOST:
- req->rdv_comm_count_by_host.result = SIMIX_rdv_comm_count_by_host(
- req->rdv_comm_count_by_host.rdv,
- req->rdv_comm_count_by_host.host);
- SIMIX_request_answer(req);
+ case SIMCALL_RDV_COMM_COUNT_BY_HOST:
+ simcall->rdv_comm_count_by_host.result = SIMIX_rdv_comm_count_by_host(
+ simcall->rdv_comm_count_by_host.rdv,
+ simcall->rdv_comm_count_by_host.host);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_RDV_GET_HEAD:
- req->rdv_get_head.result = SIMIX_rdv_get_head(req->rdv_get_head.rdv);
- SIMIX_request_answer(req);
+ case SIMCALL_RDV_GET_HEAD:
+ simcall->rdv_get_head.result = SIMIX_rdv_get_head(simcall->rdv_get_head.rdv);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_GET_BY_NAME:
- req->host_get_by_name.result =
- SIMIX_host_get_by_name(req->host_get_by_name.name);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_GET_BY_NAME:
+ simcall->host_get_by_name.result =
+ SIMIX_host_get_by_name(simcall->host_get_by_name.name);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_GET_NAME:
- req->host_get_name.result = SIMIX_host_get_name(req->host_get_name.host);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_GET_NAME:
+ simcall->host_get_name.result = SIMIX_host_get_name(simcall->host_get_name.host);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_GET_PROPERTIES:
- req->host_get_properties.result =
- SIMIX_host_get_properties(req->host_get_properties.host);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_GET_PROPERTIES:
+ simcall->host_get_properties.result =
+ SIMIX_host_get_properties(simcall->host_get_properties.host);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_GET_SPEED:
- req->host_get_speed.result =
- SIMIX_host_get_speed(req->host_get_speed.host);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_GET_SPEED:
+ simcall->host_get_speed.result =
+ SIMIX_host_get_speed(simcall->host_get_speed.host);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_GET_AVAILABLE_SPEED:
- req->host_get_available_speed.result =
- SIMIX_host_get_available_speed(req->host_get_available_speed.host);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_GET_AVAILABLE_SPEED:
+ simcall->host_get_available_speed.result =
+ SIMIX_host_get_available_speed(simcall->host_get_available_speed.host);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_GET_STATE:
- req->host_get_state.result =
- SIMIX_host_get_state(req->host_get_state.host);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_GET_STATE:
+ simcall->host_get_state.result =
+ SIMIX_host_get_state(simcall->host_get_state.host);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_GET_DATA:
- req->host_get_data.result = SIMIX_host_get_data(req->host_get_data.host);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_GET_DATA:
+ simcall->host_get_data.result = SIMIX_host_get_data(simcall->host_get_data.host);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_SET_DATA:
- SIMIX_host_set_data(req->host_set_data.host, req->host_set_data.data);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_SET_DATA:
+ SIMIX_host_set_data(simcall->host_set_data.host, simcall->host_set_data.data);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_EXECUTE:
- req->host_execute.result = SIMIX_host_execute(
- req->host_execute.name,
- req->host_execute.host,
- req->host_execute.computation_amount,
- req->host_execute.priority);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_EXECUTE:
+ simcall->host_execute.result = SIMIX_host_execute(
+ simcall->host_execute.name,
+ simcall->host_execute.host,
+ simcall->host_execute.computation_amount,
+ simcall->host_execute.priority);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_PARALLEL_EXECUTE:
- req->host_parallel_execute.result = SIMIX_host_parallel_execute(
- req->host_parallel_execute.name,
- req->host_parallel_execute.host_nb,
- req->host_parallel_execute.host_list,
- req->host_parallel_execute.computation_amount,
- req->host_parallel_execute.communication_amount,
- req->host_parallel_execute.amount,
- req->host_parallel_execute.rate);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_PARALLEL_EXECUTE:
+ simcall->host_parallel_execute.result = SIMIX_host_parallel_execute(
+ simcall->host_parallel_execute.name,
+ simcall->host_parallel_execute.host_nb,
+ simcall->host_parallel_execute.host_list,
+ simcall->host_parallel_execute.computation_amount,
+ simcall->host_parallel_execute.communication_amount,
+ simcall->host_parallel_execute.amount,
+ simcall->host_parallel_execute.rate);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_EXECUTION_DESTROY:
- SIMIX_host_execution_destroy(req->host_execution_destroy.execution);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_EXECUTION_DESTROY:
+ SIMIX_host_execution_destroy(simcall->host_execution_destroy.execution);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_EXECUTION_CANCEL:
- SIMIX_host_execution_cancel(req->host_execution_cancel.execution);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_EXECUTION_CANCEL:
+ SIMIX_host_execution_cancel(simcall->host_execution_cancel.execution);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_EXECUTION_GET_REMAINS:
- req->host_execution_get_remains.result =
- SIMIX_host_execution_get_remains(req->host_execution_get_remains.execution);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_EXECUTION_GET_REMAINS:
+ simcall->host_execution_get_remains.result =
+ SIMIX_host_execution_get_remains(simcall->host_execution_get_remains.execution);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_EXECUTION_GET_STATE:
- req->host_execution_get_state.result =
- SIMIX_host_execution_get_state(req->host_execution_get_state.execution);
- SIMIX_request_answer(req);
+ case SIMCALL_HOST_EXECUTION_GET_STATE:
+ simcall->host_execution_get_state.result =
+ SIMIX_host_execution_get_state(simcall->host_execution_get_state.execution);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_EXECUTION_SET_PRIORITY:
+ case SIMCALL_HOST_EXECUTION_SET_PRIORITY:
SIMIX_host_execution_set_priority(
- req->host_execution_set_priority.execution,
- req->host_execution_set_priority.priority);
- SIMIX_request_answer(req);
+ simcall->host_execution_set_priority.execution,
+ simcall->host_execution_set_priority.priority);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_HOST_EXECUTION_WAIT:
- SIMIX_pre_host_execution_wait(req);
+ case SIMCALL_HOST_EXECUTION_WAIT:
+ SIMIX_pre_host_execution_wait(simcall);
break;
- case REQ_PROCESS_CREATE:
+ case SIMCALL_PROCESS_CREATE:
SIMIX_process_create(
- req->process_create.process,
- req->process_create.name,
- req->process_create.code,
- req->process_create.data,
- req->process_create.hostname,
- req->process_create.argc,
- req->process_create.argv,
- req->process_create.properties);
- SIMIX_request_answer(req);
+ simcall->process_create.process,
+ simcall->process_create.name,
+ simcall->process_create.code,
+ simcall->process_create.data,
+ simcall->process_create.hostname,
+ simcall->process_create.argc,
+ simcall->process_create.argv,
+ simcall->process_create.properties);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_KILL:
- SIMIX_process_kill(req->process_kill.process);
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_KILL:
+ SIMIX_process_kill(simcall->process_kill.process);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_KILLALL:
- SIMIX_process_killall(req->issuer);
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_KILLALL:
+ SIMIX_process_killall(simcall->issuer);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_CLEANUP:
- SIMIX_process_cleanup(req->process_cleanup.process);
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_CLEANUP:
+ SIMIX_process_cleanup(simcall->process_cleanup.process);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_CHANGE_HOST:
+ case SIMCALL_PROCESS_CHANGE_HOST:
SIMIX_pre_process_change_host(
- req->process_change_host.process,
- req->process_change_host.dest);
- SIMIX_request_answer(req);
+ simcall->process_change_host.process,
+ simcall->process_change_host.dest);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_SUSPEND:
- SIMIX_pre_process_suspend(req);
+ case SIMCALL_PROCESS_SUSPEND:
+ SIMIX_pre_process_suspend(simcall);
break;
- case REQ_PROCESS_RESUME:
- SIMIX_process_resume(req->process_resume.process, req->issuer);
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_RESUME:
+ SIMIX_process_resume(simcall->process_resume.process, simcall->issuer);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_COUNT:
- req->process_count.result = SIMIX_process_count();
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_COUNT:
+ simcall->process_count.result = SIMIX_process_count();
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_GET_DATA:
- req->process_get_data.result =
- SIMIX_process_get_data(req->process_get_data.process);
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_GET_DATA:
+ simcall->process_get_data.result =
+ SIMIX_process_get_data(simcall->process_get_data.process);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_SET_DATA:
+ case SIMCALL_PROCESS_SET_DATA:
SIMIX_process_set_data(
- req->process_set_data.process,
- req->process_set_data.data);
- SIMIX_request_answer(req);
+ simcall->process_set_data.process,
+ simcall->process_set_data.data);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_GET_HOST:
- req->process_get_host.result = SIMIX_process_get_host(req->process_get_host.process);
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_GET_HOST:
+ simcall->process_get_host.result = SIMIX_process_get_host(simcall->process_get_host.process);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_GET_NAME:
- req->process_get_name.result = SIMIX_process_get_name(req->process_get_name.process);
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_GET_NAME:
+ simcall->process_get_name.result = SIMIX_process_get_name(simcall->process_get_name.process);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_IS_SUSPENDED:
- req->process_is_suspended.result =
- SIMIX_process_is_suspended(req->process_is_suspended.process);
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_IS_SUSPENDED:
+ simcall->process_is_suspended.result =
+ SIMIX_process_is_suspended(simcall->process_is_suspended.process);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_GET_PROPERTIES:
- req->process_get_properties.result =
- SIMIX_process_get_properties(req->process_get_properties.process);
- SIMIX_request_answer(req);
+ case SIMCALL_PROCESS_GET_PROPERTIES:
+ simcall->process_get_properties.result =
+ SIMIX_process_get_properties(simcall->process_get_properties.process);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_PROCESS_SLEEP:
- SIMIX_pre_process_sleep(req);
+ case SIMCALL_PROCESS_SLEEP:
+ SIMIX_pre_process_sleep(simcall);
break;
#ifdef HAVE_TRACING
- case REQ_SET_CATEGORY:
+ case SIMCALL_SET_CATEGORY:
SIMIX_set_category(
- req->set_category.action,
- req->set_category.category);
- SIMIX_request_answer(req);
+ simcall->set_category.action,
+ simcall->set_category.category);
+ SIMIX_simcall_answer(simcall);
break;
#endif
- case REQ_MUTEX_INIT:
- req->mutex_init.result = SIMIX_mutex_init();
- SIMIX_request_answer(req);
+ case SIMCALL_MUTEX_INIT:
+ simcall->mutex_init.result = SIMIX_mutex_init();
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_MUTEX_DESTROY:
- SIMIX_mutex_destroy(req->mutex_destroy.mutex);
- SIMIX_request_answer(req);
+ case SIMCALL_MUTEX_DESTROY:
+ SIMIX_mutex_destroy(simcall->mutex_destroy.mutex);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_MUTEX_LOCK:
- SIMIX_pre_mutex_lock(req);
+ case SIMCALL_MUTEX_LOCK:
+ SIMIX_pre_mutex_lock(simcall);
break;
- case REQ_MUTEX_TRYLOCK:
- req->mutex_trylock.result =
- SIMIX_mutex_trylock(req->mutex_trylock.mutex, req->issuer);
- SIMIX_request_answer(req);
+ case SIMCALL_MUTEX_TRYLOCK:
+ simcall->mutex_trylock.result =
+ SIMIX_mutex_trylock(simcall->mutex_trylock.mutex, simcall->issuer);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_MUTEX_UNLOCK:
- SIMIX_mutex_unlock(req->mutex_unlock.mutex, req->issuer);
- SIMIX_request_answer(req);
+ case SIMCALL_MUTEX_UNLOCK:
+ SIMIX_mutex_unlock(simcall->mutex_unlock.mutex, simcall->issuer);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COND_INIT:
- req->cond_init.result = SIMIX_cond_init();
- SIMIX_request_answer(req);
+ case SIMCALL_COND_INIT:
+ simcall->cond_init.result = SIMIX_cond_init();
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COND_DESTROY:
- SIMIX_cond_destroy(req->cond_destroy.cond);
- SIMIX_request_answer(req);
+ case SIMCALL_COND_DESTROY:
+ SIMIX_cond_destroy(simcall->cond_destroy.cond);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COND_SIGNAL:
- SIMIX_cond_signal(req->cond_signal.cond);
- SIMIX_request_answer(req);
+ case SIMCALL_COND_SIGNAL:
+ SIMIX_cond_signal(simcall->cond_signal.cond);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_COND_WAIT:
- SIMIX_pre_cond_wait(req);
+ case SIMCALL_COND_WAIT:
+ SIMIX_pre_cond_wait(simcall);
break;
- case REQ_COND_WAIT_TIMEOUT:
- SIMIX_pre_cond_wait_timeout(req);
+ case SIMCALL_COND_WAIT_TIMEOUT:
+ SIMIX_pre_cond_wait_timeout(simcall);
break;
- case REQ_COND_BROADCAST:
- SIMIX_cond_broadcast(req->cond_broadcast.cond);
- SIMIX_request_answer(req);
+ case SIMCALL_COND_BROADCAST:
+ SIMIX_cond_broadcast(simcall->cond_broadcast.cond);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_SEM_INIT:
- req->sem_init.result = SIMIX_sem_init(req->sem_init.capacity);
- SIMIX_request_answer(req);
+ case SIMCALL_SEM_INIT:
+ simcall->sem_init.result = SIMIX_sem_init(simcall->sem_init.capacity);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_SEM_DESTROY:
- SIMIX_sem_destroy(req->sem_destroy.sem);
- SIMIX_request_answer(req);
+ case SIMCALL_SEM_DESTROY:
+ SIMIX_sem_destroy(simcall->sem_destroy.sem);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_SEM_RELEASE:
- SIMIX_sem_release(req->sem_release.sem);
- SIMIX_request_answer(req);
+ case SIMCALL_SEM_RELEASE:
+ SIMIX_sem_release(simcall->sem_release.sem);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_SEM_WOULD_BLOCK:
- req->sem_would_block.result =
- SIMIX_sem_would_block(req->sem_would_block.sem);
- SIMIX_request_answer(req);
+ case SIMCALL_SEM_WOULD_BLOCK:
+ simcall->sem_would_block.result =
+ SIMIX_sem_would_block(simcall->sem_would_block.sem);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_SEM_ACQUIRE:
- SIMIX_pre_sem_acquire(req);
+ case SIMCALL_SEM_ACQUIRE:
+ SIMIX_pre_sem_acquire(simcall);
break;
- case REQ_SEM_ACQUIRE_TIMEOUT:
- SIMIX_pre_sem_acquire_timeout(req);
+ case SIMCALL_SEM_ACQUIRE_TIMEOUT:
+ SIMIX_pre_sem_acquire_timeout(simcall);
break;
- case REQ_SEM_GET_CAPACITY:
- req->sem_get_capacity.result =
- SIMIX_sem_get_capacity(req->sem_get_capacity.sem);
- SIMIX_request_answer(req);
+ case SIMCALL_SEM_GET_CAPACITY:
+ simcall->sem_get_capacity.result =
+ SIMIX_sem_get_capacity(simcall->sem_get_capacity.sem);
+ SIMIX_simcall_answer(simcall);
break;
- case REQ_FILE_READ:
- SIMIX_pre_file_read(req);
+ case SIMCALL_FILE_READ:
+ SIMIX_pre_file_read(simcall);
break;
- case REQ_NO_REQ:
+ case SIMCALL_NONE:
THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",
- SIMIX_process_get_name(req->issuer),
- SIMIX_host_get_name(SIMIX_process_get_host(req->issuer))
+ SIMIX_process_get_name(simcall->issuer),
+ SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer))
);
break;
-
}
}
-void SIMIX_request_post(smx_action_t action)
+void SIMIX_simcall_post(smx_action_t action)
{
switch (action->type) {
#ifndef _SIMIX_SMURF_PRIVATE_H
#define _SIMIX_SMURF_PRIVATE_H
-/********************************* Requests ***********************************/
-
-/* we want to build the e_smx_t enumeration and the table of the corresponding
- * strings automatically, using macros */
-
-#define SIMIX_REQ_LIST1 \
-SIMIX_REQ_ENUM_ELEMENT(REQ_NO_REQ),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_GET_BY_NAME),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_GET_NAME),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_GET_PROPERTIES),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_GET_SPEED),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_GET_AVAILABLE_SPEED),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_GET_STATE),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_GET_DATA),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_SET_DATA),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_EXECUTE),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_PARALLEL_EXECUTE),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_EXECUTION_DESTROY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_EXECUTION_CANCEL),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_EXECUTION_GET_REMAINS),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_EXECUTION_GET_STATE),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_EXECUTION_SET_PRIORITY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_HOST_EXECUTION_WAIT),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_CREATE),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_KILL),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_KILLALL),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_CLEANUP),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_CHANGE_HOST),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_SUSPEND),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_RESUME),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_COUNT),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_GET_DATA),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_SET_DATA),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_GET_HOST),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_GET_NAME),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_IS_SUSPENDED),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_GET_PROPERTIES),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_PROCESS_SLEEP),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_RDV_CREATE),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_RDV_DESTROY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_RDV_GEY_BY_NAME),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_RDV_COMM_COUNT_BY_HOST),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_RDV_GET_HEAD),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_SEND),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_ISEND),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_RECV),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_IRECV),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_DESTROY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_CANCEL),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_WAITANY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_WAIT),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_TEST),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_TESTANY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_GET_REMAINS),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_GET_STATE),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_GET_SRC_DATA),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_GET_DST_DATA),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_GET_SRC_PROC),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_GET_DST_PROC),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_MUTEX_INIT),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_MUTEX_DESTROY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_MUTEX_LOCK),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_MUTEX_TRYLOCK),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_MUTEX_UNLOCK),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COND_INIT),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COND_DESTROY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COND_SIGNAL),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COND_WAIT),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COND_WAIT_TIMEOUT),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_COND_BROADCAST),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_SEM_INIT),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_SEM_DESTROY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_SEM_RELEASE),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_SEM_WOULD_BLOCK),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_SEM_ACQUIRE),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_SEM_ACQUIRE_TIMEOUT),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_SEM_GET_CAPACITY),\
-SIMIX_REQ_ENUM_ELEMENT(REQ_FILE_READ)
-
-/* REQ_COMM_IS_LATENCY_BOUNDED and REQ_SET_CATEGORY make things complicated
+/********************************* Simcalls *********************************/
+
+/* we want to build the e_smx_simcall_t enumeration and the table of the
+ * corresponding strings automatically, using macros */
+
+#define SIMCALL_LIST1 \
+SIMCALL_ENUM_ELEMENT(SIMCALL_NONE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_BY_NAME),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_NAME),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_PROPERTIES),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_SPEED),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_AVAILABLE_SPEED),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_STATE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_DATA),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_SET_DATA),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_PARALLEL_EXECUTE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_DESTROY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_CANCEL),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_GET_REMAINS),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_GET_STATE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_SET_PRIORITY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_WAIT),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CREATE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_KILL),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_KILLALL),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CLEANUP),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CHANGE_HOST),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SUSPEND),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_RESUME),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_COUNT),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_DATA),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SET_DATA),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_HOST),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_NAME),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_IS_SUSPENDED),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_PROPERTIES),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SLEEP),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_CREATE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_DESTROY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GEY_BY_NAME),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_COMM_COUNT_BY_HOST),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GET_HEAD),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_SEND),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_ISEND),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_RECV),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IRECV),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_DESTROY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_CANCEL),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_WAITANY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_WAIT),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_TEST),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_TESTANY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_REMAINS),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_STATE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_SRC_DATA),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_DST_DATA),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_SRC_PROC),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_DST_PROC),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_INIT),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_DESTROY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_LOCK),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_TRYLOCK),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_UNLOCK),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COND_INIT),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COND_DESTROY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COND_SIGNAL),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COND_WAIT),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COND_WAIT_TIMEOUT),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_COND_BROADCAST),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_INIT),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_DESTROY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_RELEASE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_WOULD_BLOCK),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_ACQUIRE),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_ACQUIRE_TIMEOUT),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_GET_CAPACITY),\
+SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_READ)
+
+/* SIMCALL_COMM_IS_LATENCY_BOUNDED and SIMCALL_SET_CATEGORY make things complicated
* because they are not always present */
#ifdef HAVE_LATENCY_BOUND_TRACKING
-#define SIMIX_REQ_LIST2 \
-,SIMIX_REQ_ENUM_ELEMENT(REQ_COMM_IS_LATENCY_BOUNDED)
+#define SIMCALL_LIST2 \
+,SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IS_LATENCY_BOUNDED)
#else
-#define SIMIX_REQ_LIST2
+#define SIMCALL_LIST2
#endif
#ifdef HAVE_TRACING
-#define SIMIX_REQ_LIST3 \
-,SIMIX_REQ_ENUM_ELEMENT(REQ_SET_CATEGORY)
+#define SIMCALL_LIST3 \
+,SIMCALL_ENUM_ELEMENT(SIMCALL_SET_CATEGORY)
#else
-#define SIMIX_REQ_LIST3
+#define SIMCALL_LIST3
#endif
-/* SIMIX_REQ_LIST is the final macro to use */
-#define SIMIX_REQ_LIST SIMIX_REQ_LIST1 SIMIX_REQ_LIST2 SIMIX_REQ_LIST3
+/* SIMCALL_LIST is the final macro to use */
+#define SIMCALL_LIST SIMCALL_LIST1 SIMCALL_LIST2 SIMCALL_LIST3
/* you can redefine the following macro differently to generate something else
* with the list of enumeration values (e.g. a table of strings or a table of function pointers) */
-#define SIMIX_REQ_ENUM_ELEMENT(x) x
+#define SIMCALL_ENUM_ELEMENT(x) x
/**
- * \brief All possible SIMIX requests.
+ * \brief All possible simcalls.
*/
typedef enum {
-SIMIX_REQ_LIST
-} e_smx_req_t;
+SIMCALL_LIST
+} e_smx_simcall_t;
/**
- * \brief Represents a SIMIX request.
+ * \brief Represents a simcall to the kernel.
*/
-typedef struct s_smx_req {
- e_smx_req_t call;
+typedef struct s_smx_simcall {
+ e_smx_simcall_t call;
smx_process_t issuer;
union {
char* name;;
} file_read;
};
-} s_smx_req_t, *smx_req_t;
+} s_smx_simcall_t, *smx_simcall_t;
/******************************** General *************************************/
-void SIMIX_request_push(smx_process_t self);
-void SIMIX_request_answer(smx_req_t);
-void SIMIX_request_pre(smx_req_t, int);
-void SIMIX_request_post(smx_action_t);
-XBT_INLINE smx_req_t SIMIX_req_mine(void);
+void SIMIX_simcall_push(smx_process_t self);
+void SIMIX_simcall_answer(smx_simcall_t);
+void SIMIX_simcall_pre(smx_simcall_t, int);
+void SIMIX_simcall_post(smx_action_t);
+XBT_INLINE smx_simcall_t SIMIX_simcall_mine(void);
+const char *SIMIX_simcall_name(e_smx_simcall_t kind);
#endif
static smx_action_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout);
static void SIMIX_synchro_finish(smx_action_t action);
static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout,
- smx_process_t issuer, smx_req_t req);
+ smx_process_t issuer, smx_simcall_t simcall);
static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer,
- smx_req_t req);
+ smx_simcall_t simcall);
/***************************** Synchro action *********************************/
return action;
}
-void SIMIX_synchro_stop_waiting(smx_process_t process, smx_req_t req)
+void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall)
{
- XBT_IN("(%p, %p)",process,req);
- switch (req->call) {
+ XBT_IN("(%p, %p)",process,simcall);
+ switch (simcall->call) {
- case REQ_MUTEX_LOCK:
- xbt_swag_remove(process, req->mutex_lock.mutex->sleeping);
+ case SIMCALL_MUTEX_LOCK:
+ xbt_swag_remove(process, simcall->mutex_lock.mutex->sleeping);
break;
- case REQ_COND_WAIT:
- xbt_swag_remove(process, req->cond_wait.cond->sleeping);
+ case SIMCALL_COND_WAIT:
+ xbt_swag_remove(process, simcall->cond_wait.cond->sleeping);
break;
- case REQ_COND_WAIT_TIMEOUT:
- xbt_swag_remove(process, req->cond_wait_timeout.cond->sleeping);
+ case SIMCALL_COND_WAIT_TIMEOUT:
+ xbt_swag_remove(process, simcall->cond_wait_timeout.cond->sleeping);
break;
- case REQ_SEM_ACQUIRE:
- xbt_swag_remove(process, req->sem_acquire.sem->sleeping);
+ case SIMCALL_SEM_ACQUIRE:
+ xbt_swag_remove(process, simcall->sem_acquire.sem->sleeping);
break;
- case REQ_SEM_ACQUIRE_TIMEOUT:
- xbt_swag_remove(process, req->sem_acquire_timeout.sem->sleeping);
+ case SIMCALL_SEM_ACQUIRE_TIMEOUT:
+ xbt_swag_remove(process, simcall->sem_acquire_timeout.sem->sleeping);
break;
default:
static void SIMIX_synchro_finish(smx_action_t action)
{
XBT_IN("(%p)",action);
- smx_req_t req = xbt_fifo_shift(action->request_list);
+ smx_simcall_t simcall = xbt_fifo_shift(action->simcalls);
switch (action->state) {
TRY {
THROWF(timeout_error, 0, "Synchro's wait timeout");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
TRY {
THROWF(host_error, 0, "Host failed");
}
- CATCH(req->issuer->running_ctx->exception) {
- req->issuer->doexception = 1;
+ CATCH(simcall->issuer->running_ctx->exception) {
+ simcall->issuer->doexception = 1;
}
break;
break;
}
- SIMIX_synchro_stop_waiting(req->issuer, req);
+ SIMIX_synchro_stop_waiting(simcall->issuer, simcall);
SIMIX_synchro_destroy(action);
- SIMIX_request_answer(req);
+ SIMIX_simcall_answer(simcall);
XBT_OUT();
}
/*********************************** Mutex ************************************/
}
/**
- * \brief Handle mutex lock request
- * \param req The request
+ * \brief Handles a mutex lock simcall.
+ * \param simcall the simcall
*/
-void SIMIX_pre_mutex_lock(smx_req_t req)
+void SIMIX_pre_mutex_lock(smx_simcall_t simcall)
{
- XBT_IN("(%p)",req);
+ XBT_IN("(%p)",simcall);
/* FIXME: check where to validate the arguments */
smx_action_t sync_act = NULL;
- smx_mutex_t mutex = req->mutex_lock.mutex;
- smx_process_t process = req->issuer;
+ smx_mutex_t mutex = simcall->mutex_lock.mutex;
+ smx_process_t process = simcall->issuer;
if (mutex->locked) {
/* FIXME: check if the host is active ? */
/* Somebody using the mutex, use a synchro action to get host failures */
sync_act = SIMIX_synchro_wait(process->smx_host, -1);
- xbt_fifo_push(sync_act->request_list, req);
- req->issuer->waiting_action = sync_act;
- xbt_swag_insert(req->issuer, mutex->sleeping);
+ xbt_fifo_push(sync_act->simcalls, simcall);
+ simcall->issuer->waiting_action = sync_act;
+ xbt_swag_insert(simcall->issuer, mutex->sleeping);
} else {
/* mutex free */
mutex->locked = 1;
- mutex->owner = req->issuer;
- SIMIX_request_answer(req);
+ mutex->owner = simcall->issuer;
+ SIMIX_simcall_answer(simcall);
}
XBT_OUT();
}
SIMIX_synchro_destroy(p->waiting_action);
p->waiting_action = NULL;
mutex->owner = p;
- SIMIX_request_answer(&p->request);
+ SIMIX_simcall_answer(&p->simcall);
} else {
/* nobody to wake up */
mutex->locked = 0;
}
/**
- * \brief Handle condition waiting requests without timeouts
- * \param The request
+ * \brief Handle a condition waiting simcall without timeouts
+ * \param simcall the simcall
*/
-void SIMIX_pre_cond_wait(smx_req_t req)
+void SIMIX_pre_cond_wait(smx_simcall_t simcall)
{
- XBT_IN("(%p)",req);
- smx_process_t issuer = req->issuer;
- smx_cond_t cond = req->cond_wait.cond;
- smx_mutex_t mutex = req->cond_wait.mutex;
+ XBT_IN("(%p)",simcall);
+ smx_process_t issuer = simcall->issuer;
+ smx_cond_t cond = simcall->cond_wait.cond;
+ smx_mutex_t mutex = simcall->cond_wait.mutex;
- _SIMIX_cond_wait(cond, mutex, -1, issuer, req);
+ _SIMIX_cond_wait(cond, mutex, -1, issuer, simcall);
XBT_OUT();
}
/**
- * \brief Handle condition waiting requests with timeouts
- * \param The request
+ * \brief Handle a condition waiting simcall with timeouts
+ * \param simcall the simcall
*/
-void SIMIX_pre_cond_wait_timeout(smx_req_t req)
+void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall)
{
- XBT_IN("(%p)",req);
- smx_process_t issuer = req->issuer;
- smx_cond_t cond = req->cond_wait_timeout.cond;
- smx_mutex_t mutex = req->cond_wait_timeout.mutex;
- double timeout = req->cond_wait_timeout.timeout;
+ XBT_IN("(%p)",simcall);
+ smx_process_t issuer = simcall->issuer;
+ smx_cond_t cond = simcall->cond_wait_timeout.cond;
+ smx_mutex_t mutex = simcall->cond_wait_timeout.mutex;
+ double timeout = simcall->cond_wait_timeout.timeout;
- _SIMIX_cond_wait(cond, mutex, timeout, issuer, req);
+ _SIMIX_cond_wait(cond, mutex, timeout, issuer, simcall);
XBT_OUT();
}
static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout,
- smx_process_t issuer, smx_req_t req)
+ smx_process_t issuer, smx_simcall_t simcall)
{
- XBT_IN("(%p, %p, %f, %p,%p)",cond,mutex,timeout,issuer,req);
+ XBT_IN("(%p, %p, %f, %p,%p)",cond,mutex,timeout,issuer,simcall);
smx_action_t sync_act = NULL;
XBT_DEBUG("Wait condition %p", cond);
}
sync_act = SIMIX_synchro_wait(issuer->smx_host, timeout);
- xbt_fifo_unshift(sync_act->request_list, req);
+ xbt_fifo_unshift(sync_act->simcalls, simcall);
issuer->waiting_action = sync_act;
- xbt_swag_insert(req->issuer, cond->sleeping);
+ xbt_swag_insert(simcall->issuer, cond->sleeping);
XBT_OUT();
}
XBT_IN("(%p)",cond);
smx_process_t proc = NULL;
smx_mutex_t mutex = NULL;
- smx_req_t req = NULL;
+ smx_simcall_t simcall = NULL;
XBT_DEBUG("Signal condition %p", cond);
SIMIX_synchro_destroy(proc->waiting_action);
proc->waiting_action = NULL;
- /* Now transform the cond wait request into a mutex lock one */
- req = &proc->request;
- if(req->call == REQ_COND_WAIT)
- mutex = req->cond_wait.mutex;
+ /* Now transform the cond wait simcall into a mutex lock one */
+ simcall = &proc->simcall;
+ if(simcall->call == SIMCALL_COND_WAIT)
+ mutex = simcall->cond_wait.mutex;
else
- mutex = req->cond_wait_timeout.mutex;
+ mutex = simcall->cond_wait_timeout.mutex;
- req->call = REQ_MUTEX_LOCK;
- req->mutex_lock.mutex = mutex;
+ simcall->call = SIMCALL_MUTEX_LOCK;
+ simcall->mutex_lock.mutex = mutex;
- SIMIX_pre_mutex_lock(req);
+ SIMIX_pre_mutex_lock(simcall);
}
XBT_OUT();
}
proc = xbt_swag_extract(sem->sleeping);
SIMIX_synchro_destroy(proc->waiting_action);
proc->waiting_action = NULL;
- SIMIX_request_answer(&proc->request);
+ SIMIX_simcall_answer(&proc->simcall);
} else if (sem->value < SMX_SEM_NOLIMIT) {
sem->value++;
}
}
static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer,
- smx_req_t req)
+ smx_simcall_t simcall)
{
- XBT_IN("(%p, %f, %p, %p)",sem,timeout,issuer,req);
+ XBT_IN("(%p, %f, %p, %p)",sem,timeout,issuer,simcall);
smx_action_t sync_act = NULL;
XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout);
if (sem->value <= 0) {
sync_act = SIMIX_synchro_wait(issuer->smx_host, timeout);
- xbt_fifo_unshift(sync_act->request_list, req);
+ xbt_fifo_unshift(sync_act->simcalls, simcall);
issuer->waiting_action = sync_act;
xbt_swag_insert(issuer, sem->sleeping);
} else {
sem->value--;
- SIMIX_request_answer(req);
+ SIMIX_simcall_answer(simcall);
}
XBT_OUT();
}
/**
- * \brief Handle sem acquire requests without timeouts
+ * \brief Handles a sem acquire simcall without timeout.
+ * \param simcall the simcall
*/
-void SIMIX_pre_sem_acquire(smx_req_t req)
+void SIMIX_pre_sem_acquire(smx_simcall_t simcall)
{
- XBT_IN("(%p)",req);
- _SIMIX_sem_wait(req->sem_acquire.sem, -1, req->issuer, req);
+ XBT_IN("(%p)",simcall);
+ _SIMIX_sem_wait(simcall->sem_acquire.sem, -1, simcall->issuer, simcall);
XBT_OUT();
}
/**
- * \brief Handle sem acquire requests with timeouts
+ * \brief Handles a sem acquire simcall with timeout.
+ * \param simcall the simcall
*/
-void SIMIX_pre_sem_acquire_timeout(smx_req_t req)
+void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall)
{
- XBT_IN("(%p)",req);
- _SIMIX_sem_wait(req->sem_acquire_timeout.sem,
- req->sem_acquire_timeout.timeout, req->issuer, req);
+ XBT_IN("(%p)",simcall);
+ _SIMIX_sem_wait(simcall->sem_acquire_timeout.sem,
+ simcall->sem_acquire_timeout.timeout, simcall->issuer, simcall);
XBT_OUT();
}
} s_smx_sem_t;
void SIMIX_post_synchro(smx_action_t action);
-void SIMIX_synchro_stop_waiting(smx_process_t process, smx_req_t req);
+void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall);
void SIMIX_synchro_destroy(smx_action_t action);
smx_mutex_t SIMIX_mutex_init(void);
void SIMIX_mutex_destroy(smx_mutex_t mutex);
-void SIMIX_pre_mutex_lock(smx_req_t req);
+void SIMIX_pre_mutex_lock(smx_simcall_t simcall);
int SIMIX_mutex_trylock(smx_mutex_t mutex, smx_process_t issuer);
void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer);
smx_cond_t SIMIX_cond_init(void);
void SIMIX_cond_destroy(smx_cond_t cond);
void SIMIX_cond_signal(smx_cond_t cond);
-void SIMIX_pre_cond_wait(smx_req_t req);
-void SIMIX_pre_cond_wait_timeout(smx_req_t req);
+void SIMIX_pre_cond_wait(smx_simcall_t simcall);
+void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall);
void SIMIX_cond_broadcast(smx_cond_t cond);
smx_sem_t SIMIX_sem_init(unsigned int value);
void SIMIX_sem_destroy(smx_sem_t sem);
void SIMIX_sem_release(smx_sem_t sem);
int SIMIX_sem_would_block(smx_sem_t sem);
-void SIMIX_pre_sem_acquire(smx_req_t req);
-void SIMIX_pre_sem_acquire_timeout(smx_req_t req);
+void SIMIX_pre_sem_acquire(smx_simcall_t simcall);
+void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall);
int SIMIX_sem_get_capacity(smx_sem_t sem);
#endif
#include "smx_private.h"
#include "mc/mc.h"
-
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
-static const char* request_names[] = {
-#undef SIMIX_REQ_ENUM_ELEMENT
-#define SIMIX_REQ_ENUM_ELEMENT(x) #x /* generate strings from the enumeration values */
-SIMIX_REQ_LIST
-#undef SIMIX_REQ_ENUM_ELEMENT
+static const char* simcall_names[] = {
+#undef SIMCALL_ENUM_ELEMENT
+#define SIMCALL_ENUM_ELEMENT(x) #x /* generate strings from the enumeration values */
+SIMCALL_LIST
+#undef SIMCALL_ENUM_ELEMENT
};
/**
* \param name The name of the host to get
* \return The corresponding host
*/
-smx_host_t SIMIX_req_host_get_by_name(const char *name)
+smx_host_t simcall_host_get_by_name(const char *name)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_GET_BY_NAME;
- req->host_get_by_name.name = name;
- SIMIX_request_push(req->issuer);
- return req->host_get_by_name.result;
+ simcall->call = SIMCALL_HOST_GET_BY_NAME;
+ simcall->host_get_by_name.name = name;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_get_by_name.result;
}
/**
* \param host A SIMIX host
* \return The name of this host
*/
-const char* SIMIX_req_host_get_name(smx_host_t host)
+const char* simcall_host_get_name(smx_host_t host)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_GET_NAME;
- req->host_get_name.host = host;
- SIMIX_request_push(req->issuer);
- return req->host_get_name.result;
+ simcall->call = SIMCALL_HOST_GET_NAME;
+ simcall->host_get_name.host = host;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_get_name.result;
}
/**
* \param host A host
* \return The properties of this host
*/
-xbt_dict_t SIMIX_req_host_get_properties(smx_host_t host)
+xbt_dict_t simcall_host_get_properties(smx_host_t host)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_GET_PROPERTIES;
- req->host_get_properties.host = host;
- SIMIX_request_push(req->issuer);
- return req->host_get_properties.result;
+ simcall->call = SIMCALL_HOST_GET_PROPERTIES;
+ simcall->host_get_properties.host = host;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_get_properties.result;
}
/**
* \param host A SIMIX host
* \return The speed of this host (in Mflop/s)
*/
-double SIMIX_req_host_get_speed(smx_host_t host)
+double simcall_host_get_speed(smx_host_t host)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_GET_SPEED;
- req->host_get_speed.host = host;
- SIMIX_request_push(req->issuer);
- return req->host_get_speed.result;
+ simcall->call = SIMCALL_HOST_GET_SPEED;
+ simcall->host_get_speed.host = host;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_get_speed.result;
}
/**
*
* \return Speed currently available (in Mflop/s)
*/
-double SIMIX_req_host_get_available_speed(smx_host_t host)
+double simcall_host_get_available_speed(smx_host_t host)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_GET_AVAILABLE_SPEED;
- req->host_get_available_speed.host = host;
- SIMIX_request_push(req->issuer);
- return req->host_get_available_speed.result;
+ simcall->call = SIMCALL_HOST_GET_AVAILABLE_SPEED;
+ simcall->host_get_available_speed.host = host;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_get_available_speed.result;
}
/**
* \param host A SIMIX host
* \return 1 if the host is available, 0 otherwise
*/
-int SIMIX_req_host_get_state(smx_host_t host)
+int simcall_host_get_state(smx_host_t host)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_GET_STATE;
- req->host_get_state.host = host;
- SIMIX_request_push(req->issuer);
- return req->host_get_state.result;
+ simcall->call = SIMCALL_HOST_GET_STATE;
+ simcall->host_get_state.host = host;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_get_state.result;
}
/**
* \param host SIMIX host
* \return the user data of this host
*/
-void* SIMIX_req_host_get_data(smx_host_t host)
+void* simcall_host_get_data(smx_host_t host)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_GET_DATA;
- req->host_get_data.host = host;
- SIMIX_request_push(req->issuer);
- return req->host_get_data.result;
+ simcall->call = SIMCALL_HOST_GET_DATA;
+ simcall->host_get_data.host = host;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_get_data.result;
}
/**
* \param A host SIMIX host
* \param data The user data to set
*/
-void SIMIX_req_host_set_data(smx_host_t host, void *data)
+void simcall_host_set_data(smx_host_t host, void *data)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_SET_DATA;
- req->host_set_data.host = host;
- req->host_set_data.data = data;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_HOST_SET_DATA;
+ simcall->host_set_data.host = host;
+ simcall->host_set_data.data = data;
+ SIMIX_simcall_push(simcall->issuer);
}
/** \brief Creates an action that executes some computation of an host.
* \param amount Computation amount (in bytes)
* \return A new SIMIX execution action
*/
-smx_action_t SIMIX_req_host_execute(const char *name, smx_host_t host,
+smx_action_t simcall_host_execute(const char *name, smx_host_t host,
double computation_amount,
double priority)
{
xbt_assert(isfinite(computation_amount), "computation_amount is not finite!");
xbt_assert(isfinite(priority), "priority is not finite!");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_EXECUTE;
- req->host_execute.name = name;
- req->host_execute.host = host;
- req->host_execute.computation_amount = computation_amount;
- req->host_execute.priority = priority;
- SIMIX_request_push(req->issuer);
- return req->host_execute.result;
+ simcall->call = SIMCALL_HOST_EXECUTE;
+ simcall->host_execute.name = name;
+ simcall->host_execute.host = host;
+ simcall->host_execute.computation_amount = computation_amount;
+ simcall->host_execute.priority = priority;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_execute.result;
}
/** \brief Creates an action that may involve parallel computation on
* \param rate the SURF action rate
* \return A new SIMIX execution action
*/
-smx_action_t SIMIX_req_host_parallel_execute(const char *name,
+smx_action_t simcall_host_parallel_execute(const char *name,
int host_nb,
smx_host_t *host_list,
double *computation_amount,
xbt_assert(isfinite(amount), "amount is not finite!");
xbt_assert(isfinite(rate), "rate is not finite!");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_PARALLEL_EXECUTE;
- req->host_parallel_execute.name = name;
- req->host_parallel_execute.host_nb = host_nb;
- req->host_parallel_execute.host_list = host_list;
- req->host_parallel_execute.computation_amount = computation_amount;
- req->host_parallel_execute.communication_amount = communication_amount;
- req->host_parallel_execute.amount = amount;
- req->host_parallel_execute.rate = rate;
- SIMIX_request_push(req->issuer);
- return req->host_parallel_execute.result;
+ simcall->call = SIMCALL_HOST_PARALLEL_EXECUTE;
+ simcall->host_parallel_execute.name = name;
+ simcall->host_parallel_execute.host_nb = host_nb;
+ simcall->host_parallel_execute.host_list = host_list;
+ simcall->host_parallel_execute.computation_amount = computation_amount;
+ simcall->host_parallel_execute.communication_amount = communication_amount;
+ simcall->host_parallel_execute.amount = amount;
+ simcall->host_parallel_execute.rate = rate;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_parallel_execute.result;
}
/**
* Destroys an action, freing its memory. This function cannot be called if there are a conditional waiting for it.
* \param action The execution action to destroy
*/
-void SIMIX_req_host_execution_destroy(smx_action_t execution)
+void simcall_host_execution_destroy(smx_action_t execution)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_EXECUTION_DESTROY;
- req->host_execution_destroy.execution = execution;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_HOST_EXECUTION_DESTROY;
+ simcall->host_execution_destroy.execution = execution;
+ SIMIX_simcall_push(simcall->issuer);
}
/**
* This functions stops the execution. It calls a surf function.
* \param action The execution action to cancel
*/
-void SIMIX_req_host_execution_cancel(smx_action_t execution)
+void simcall_host_execution_cancel(smx_action_t execution)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_EXECUTION_CANCEL;
- req->host_execution_cancel.execution = execution;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_HOST_EXECUTION_CANCEL;
+ simcall->host_execution_cancel.execution = execution;
+ SIMIX_simcall_push(simcall->issuer);
}
/**
* \param Action The execution action
* \return The remaining amount
*/
-double SIMIX_req_host_execution_get_remains(smx_action_t execution)
+double simcall_host_execution_get_remains(smx_action_t execution)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_EXECUTION_GET_REMAINS;
- req->host_execution_get_remains.execution = execution;
- SIMIX_request_push(req->issuer);
- return req->host_execution_get_remains.result;
+ simcall->call = SIMCALL_HOST_EXECUTION_GET_REMAINS;
+ simcall->host_execution_get_remains.execution = execution;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_execution_get_remains.result;
}
/**
* \param execution The execution action
* \return The state
*/
-e_smx_state_t SIMIX_req_host_execution_get_state(smx_action_t execution)
+e_smx_state_t simcall_host_execution_get_state(smx_action_t execution)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_EXECUTION_GET_STATE;
- req->host_execution_get_state.execution = execution;
- SIMIX_request_push(req->issuer);
- return req->host_execution_get_state.result;
+ simcall->call = SIMCALL_HOST_EXECUTION_GET_STATE;
+ simcall->host_execution_get_state.execution = execution;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_execution_get_state.result;
}
/**
* \param execution The execution action
* \param priority The new priority
*/
-void SIMIX_req_host_execution_set_priority(smx_action_t execution, double priority)
+void simcall_host_execution_set_priority(smx_action_t execution, double priority)
{
/* checking for infinite values */
xbt_assert(isfinite(priority), "priority is not finite!");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_EXECUTION_SET_PRIORITY;
- req->host_execution_set_priority.execution = execution;
- req->host_execution_set_priority.priority = priority;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_HOST_EXECUTION_SET_PRIORITY;
+ simcall->host_execution_set_priority.execution = execution;
+ simcall->host_execution_set_priority.priority = priority;
+ SIMIX_simcall_push(simcall->issuer);
}
/**
*
* \param execution The execution action
*/
-e_smx_state_t SIMIX_req_host_execution_wait(smx_action_t execution)
+e_smx_state_t simcall_host_execution_wait(smx_action_t execution)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_HOST_EXECUTION_WAIT;
- req->host_execution_wait.execution = execution;
- SIMIX_request_push(req->issuer);
- return req->host_execution_wait.result;
+ simcall->call = SIMCALL_HOST_EXECUTION_WAIT;
+ simcall->host_execution_wait.execution = execution;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->host_execution_wait.result;
}
/**
* \param name a name for the process. It is for user-level information and can be NULL.
* \param code the main function of the process
* \param data a pointer to any data one may want to attach to the new object. It is for user-level information and can be NULL.
- * It can be retrieved with the function \ref SIMIX_req_process_get_data.
+ * It can be retrieved with the function \ref simcall_process_get_data.
* \param hostname name of the host where the new agent is executed.
* \param argc first argument passed to \a code
* \param argv second argument passed to \a code
* \param properties the properties of the process
*/
-void SIMIX_req_process_create(smx_process_t *process, const char *name,
+void simcall_process_create(smx_process_t *process, const char *name,
xbt_main_func_t code,
void *data,
const char *hostname,
int argc, char **argv,
xbt_dict_t properties)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_CREATE;
- req->process_create.process = process;
- req->process_create.name = name;
- req->process_create.code = code;
- req->process_create.data = data;
- req->process_create.hostname = hostname;
- req->process_create.argc = argc;
- req->process_create.argv = argv;
- req->process_create.properties = properties;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_PROCESS_CREATE;
+ simcall->process_create.process = process;
+ simcall->process_create.name = name;
+ simcall->process_create.code = code;
+ simcall->process_create.data = data;
+ simcall->process_create.hostname = hostname;
+ simcall->process_create.argc = argc;
+ simcall->process_create.argv = argv;
+ simcall->process_create.properties = properties;
+ SIMIX_simcall_push(simcall->issuer);
}
/** \brief Kills a SIMIX process.
*
* \param process poor victim
*/
-void SIMIX_req_process_kill(smx_process_t process)
+void simcall_process_kill(smx_process_t process)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_KILL;
- req->process_kill.process = process;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_PROCESS_KILL;
+ simcall->process_kill.process = process;
+ SIMIX_simcall_push(simcall->issuer);
}
/** \brief Kills all SIMIX processes.
*/
-void SIMIX_req_process_killall(void)
+void simcall_process_killall(void)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_KILLALL;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_PROCESS_KILLALL;
+ SIMIX_simcall_push(simcall->issuer);
}
/** \brief Cleans up a SIMIX process.
* \param process poor victim (must have already been killed)
*/
-void SIMIX_req_process_cleanup(smx_process_t process)
+void simcall_process_cleanup(smx_process_t process)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_CLEANUP;
- req->process_cleanup.process = process;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_PROCESS_CLEANUP;
+ simcall->process_cleanup.process = process;
+ SIMIX_simcall_push(simcall->issuer);
}
/**
* \param source name of the previous host
* \param dest name of the new host
*/
-void SIMIX_req_process_change_host(smx_process_t process, smx_host_t dest)
+void simcall_process_change_host(smx_process_t process, smx_host_t dest)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_CHANGE_HOST;
- req->process_change_host.process = process;
- req->process_change_host.dest = dest;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_PROCESS_CHANGE_HOST;
+ simcall->process_change_host.process = process;
+ simcall->process_change_host.dest = dest;
+ SIMIX_simcall_push(simcall->issuer);
}
/**
*
* \param process a SIMIX process
*/
-void SIMIX_req_process_suspend(smx_process_t process)
+void simcall_process_suspend(smx_process_t process)
{
xbt_assert(process, "Invalid parameters");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_SUSPEND;
- req->process_suspend.process = process;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_PROCESS_SUSPEND;
+ simcall->process_suspend.process = process;
+ SIMIX_simcall_push(simcall->issuer);
}
/**
*
* \param process a SIMIX process
*/
-void SIMIX_req_process_resume(smx_process_t process)
+void simcall_process_resume(smx_process_t process)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_RESUME;
- req->process_resume.process = process;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_PROCESS_RESUME;
+ simcall->process_resume.process = process;
+ SIMIX_simcall_push(simcall->issuer);
}
/**
*
* Maestro internal process is not counted, only user code processes are
*/
-int SIMIX_req_process_count(void)
+int simcall_process_count(void)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_COUNT;
- SIMIX_request_push(req->issuer);
- return req->process_count.result;
+ simcall->call = SIMCALL_PROCESS_COUNT;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->process_count.result;
}
/**
* \param process a SIMIX process
* \return the user data of this process
*/
-void* SIMIX_req_process_get_data(smx_process_t process)
+void* simcall_process_get_data(smx_process_t process)
{
if (process == SIMIX_process_self()) {
- /* avoid a request if this function is called by the process itself */
+ /* avoid a simcall if this function is called by the process itself */
return SIMIX_process_get_data(process);
}
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_GET_DATA;
- req->process_get_data.process = process;
- SIMIX_request_push(req->issuer);
- return req->process_get_data.result;
+ simcall->call = SIMCALL_PROCESS_GET_DATA;
+ simcall->process_get_data.process = process;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->process_get_data.result;
}
/**
* \param process SIMIX process
* \param data User data
*/
-void SIMIX_req_process_set_data(smx_process_t process, void *data)
+void simcall_process_set_data(smx_process_t process, void *data)
{
if (process == SIMIX_process_self()) {
- /* avoid a request if this function is called by the process itself */
+ /* avoid a simcall if this function is called by the process itself */
SIMIX_process_self_set_data(process, data);
}
else {
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_SET_DATA;
- req->process_set_data.process = process;
- req->process_set_data.data = data;
- SIMIX_request_push(req->issuer);
+ simcall->call = SIMCALL_PROCESS_SET_DATA;
+ simcall->process_set_data.process = process;
+ simcall->process_set_data.data = data;
+ SIMIX_simcall_push(simcall->issuer);
}
}
* \param process SIMIX process
* \return SIMIX host
*/
-smx_host_t SIMIX_req_process_get_host(smx_process_t process)
+smx_host_t simcall_process_get_host(smx_process_t process)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_GET_HOST;
- req->process_get_host.process = process;
- SIMIX_request_push(req->issuer);
- return req->process_get_host.result;
+ simcall->call = SIMCALL_PROCESS_GET_HOST;
+ simcall->process_get_host.process = process;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->process_get_host.result;
}
/**
* \param process SIMIX process
* \return The process name
*/
-const char* SIMIX_req_process_get_name(smx_process_t process)
+const char* simcall_process_get_name(smx_process_t process)
{
if (process == SIMIX_process_self()) {
- /* avoid a request if this function is called by the process itself */
+ /* avoid a simcall if this function is called by the process itself */
return process->name;
}
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_GET_NAME;
- req->process_get_name.process = process;
- SIMIX_request_push(req->issuer);
- return req->process_get_name.result;
+ simcall->call = SIMCALL_PROCESS_GET_NAME;
+ simcall->process_get_name.process = process;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->process_get_name.result;
}
/**
* \param process SIMIX process
* \return 1, if the process is suspended, else 0.
*/
-int SIMIX_req_process_is_suspended(smx_process_t process)
+int simcall_process_is_suspended(smx_process_t process)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_IS_SUSPENDED;
- req->process_is_suspended.process = process;
- SIMIX_request_push(req->issuer);
- return req->process_is_suspended.result;
+ simcall->call = SIMCALL_PROCESS_IS_SUSPENDED;
+ simcall->process_is_suspended.process = process;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->process_is_suspended.result;
}
/** \ingroup m_process_management
*
* This functions returns the properties associated with this process
*/
-xbt_dict_t SIMIX_req_process_get_properties(smx_process_t process)
+xbt_dict_t simcall_process_get_properties(smx_process_t process)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_GET_PROPERTIES;
- req->process_get_properties.process = process;
- SIMIX_request_push(req->issuer);
- return req->process_get_properties.result;
+ simcall->call = SIMCALL_PROCESS_GET_PROPERTIES;
+ simcall->process_get_properties.process = process;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->process_get_properties.result;
}
/** \brief Creates a new sleep SIMIX action.
* \param duration Time duration of the sleep.
* \return A result telling whether the sleep was successful
*/
-e_smx_state_t SIMIX_req_process_sleep(double duration)
+e_smx_state_t simcall_process_sleep(double duration)
{
/* checking for infinite values */
xbt_assert(isfinite(duration), "duration is not finite!");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_PROCESS_SLEEP;
- req->process_sleep.duration = duration;
- SIMIX_request_push(req->issuer);
- return req->process_sleep.result;
+ simcall->call = SIMCALL_PROCESS_SLEEP;
+ simcall->process_sleep.duration = duration;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->process_sleep.result;
}
/**
* \param name The name of the rendez-vous point
* \return The created rendez-vous point
*/
-smx_rdv_t SIMIX_req_rdv_create(const char *name)
+smx_rdv_t simcall_rdv_create(const char *name)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_RDV_CREATE;
- req->rdv_create.name = name;
+ simcall->call = SIMCALL_RDV_CREATE;
+ simcall->rdv_create.name = name;
- SIMIX_request_push(req->issuer);
- return req->rdv_create.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->rdv_create.result;
}
* \brief Destroy a rendez-vous point
* \param name The rendez-vous point to destroy
*/
-void SIMIX_req_rdv_destroy(smx_rdv_t rdv)
+void simcall_rdv_destroy(smx_rdv_t rdv)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_RDV_DESTROY;
- req->rdv_destroy.rdv = rdv;
+ simcall->call = SIMCALL_RDV_DESTROY;
+ simcall->rdv_destroy.rdv = rdv;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-smx_rdv_t SIMIX_req_rdv_get_by_name(const char *name)
+smx_rdv_t simcall_rdv_get_by_name(const char *name)
{
- xbt_assert(name != NULL, "Invalid parameter for SIMIX_req_rdv_get_by_name (name is NULL)");
+ xbt_assert(name != NULL, "Invalid parameter for simcall_rdv_get_by_name (name is NULL)");
/* FIXME: this is a horrible lost of performance, so we hack it out by
- * skipping the request (for now). It won't work on distributed but
- * probably we will change MSG for that. */
-/*
- smx_req_t req = SIMIX_req_mine();
- req->call = REQ_RDV_GEY_BY_NAME;
- req->rdv_get_by_name.name = name;
- SIMIX_request_push(req->issuer);
- return req->rdv_get_by_name.result;*/
+ * skipping the simcall (for now). It works in parallel, it won't work on
+ * distributed but probably we will change MSG for that. */
+
+ /*
+ smx_simcall_t simcall = simcall_mine();
+ simcall->call = SIMCALL_RDV_GEY_BY_NAME;
+ simcall->rdv_get_by_name.name = name;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->rdv_get_by_name.result;*/
return SIMIX_rdv_get_by_name(name);
}
/**
- * \brief counts the number of communication requests of a given host pending
- * on a rendez-vous point
+ * \brief Counts the number of communication actions of a given host pending
+ * on a rendez-vous point.
* \param rdv The rendez-vous point
* \param host The host to be counted
- * \return The number of comm request pending in the rdv
+ * \return The number of comm actions pending in the rdv
*/
-int SIMIX_req_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host)
+int simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_RDV_COMM_COUNT_BY_HOST;
- req->rdv_comm_count_by_host.rdv = rdv;
- req->rdv_comm_count_by_host.host = host;
+ simcall->call = SIMCALL_RDV_COMM_COUNT_BY_HOST;
+ simcall->rdv_comm_count_by_host.rdv = rdv;
+ simcall->rdv_comm_count_by_host.host = host;
- SIMIX_request_push(req->issuer);
- return req->rdv_comm_count_by_host.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->rdv_comm_count_by_host.result;
}
/**
* \param rdv The rendez-vous point
* \return The communication or NULL if empty
*/
-smx_action_t SIMIX_req_rdv_get_head(smx_rdv_t rdv)
+smx_action_t simcall_rdv_get_head(smx_rdv_t rdv)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_RDV_GET_HEAD;
- req->rdv_get_head.rdv = rdv;
+ simcall->call = SIMCALL_RDV_GET_HEAD;
+ simcall->rdv_get_head.rdv = rdv;
- SIMIX_request_push(req->issuer);
- return req->rdv_get_head.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->rdv_get_head.result;
}
-void SIMIX_req_comm_send(smx_rdv_t rdv, double task_size, double rate,
+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_assert(rdv, "No rendez-vous point defined for send");
if (MC_IS_ENABLED) {
- /* the model-checker wants two separate requests */
- smx_action_t comm = SIMIX_req_comm_isend(rdv, task_size, rate,
+ /* the model-checker wants two separate simcalls */
+ smx_action_t comm = simcall_comm_isend(rdv, task_size, rate,
src_buff, src_buff_size, match_fun, NULL, data, 0);
- SIMIX_req_comm_wait(comm, timeout);
+ simcall_comm_wait(comm, timeout);
}
else {
- smx_req_t req = SIMIX_req_mine();
-
- req->call = REQ_COMM_SEND;
- req->comm_send.rdv = rdv;
- req->comm_send.task_size = task_size;
- req->comm_send.rate = rate;
- req->comm_send.src_buff = src_buff;
- req->comm_send.src_buff_size = src_buff_size;
- req->comm_send.match_fun = match_fun;
- req->comm_send.data = data;
- req->comm_send.timeout = timeout;
-
- SIMIX_request_push(req->issuer);
+ smx_simcall_t simcall = SIMIX_simcall_mine();
+
+ simcall->call = SIMCALL_COMM_SEND;
+ simcall->comm_send.rdv = rdv;
+ simcall->comm_send.task_size = task_size;
+ simcall->comm_send.rate = rate;
+ simcall->comm_send.src_buff = src_buff;
+ simcall->comm_send.src_buff_size = src_buff_size;
+ simcall->comm_send.match_fun = match_fun;
+ simcall->comm_send.data = data;
+ simcall->comm_send.timeout = timeout;
+
+ SIMIX_simcall_push(simcall->issuer);
}
}
-smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate,
+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 *),
xbt_assert(rdv, "No rendez-vous point defined for isend");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_ISEND;
- req->comm_isend.rdv = rdv;
- req->comm_isend.task_size = task_size;
- req->comm_isend.rate = rate;
- req->comm_isend.src_buff = src_buff;
- req->comm_isend.src_buff_size = src_buff_size;
- req->comm_isend.match_fun = match_fun;
- req->comm_isend.clean_fun = clean_fun;
- req->comm_isend.data = data;
- req->comm_isend.detached = detached;
+ simcall->call = SIMCALL_COMM_ISEND;
+ simcall->comm_isend.rdv = rdv;
+ simcall->comm_isend.task_size = task_size;
+ simcall->comm_isend.rate = rate;
+ simcall->comm_isend.src_buff = src_buff;
+ simcall->comm_isend.src_buff_size = src_buff_size;
+ simcall->comm_isend.match_fun = match_fun;
+ simcall->comm_isend.clean_fun = clean_fun;
+ simcall->comm_isend.data = data;
+ simcall->comm_isend.detached = detached;
- SIMIX_request_push(req->issuer);
- return req->comm_isend.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_isend.result;
}
-void SIMIX_req_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size,
+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_assert(isfinite(timeout), "timeout is not finite!");
xbt_assert(rdv, "No rendez-vous point defined for recv");
if (MC_IS_ENABLED) {
- /* the model-checker wants two separate requests */
- smx_action_t comm = SIMIX_req_comm_irecv(rdv, dst_buff, dst_buff_size,
+ /* the model-checker wants two separate simcalls */
+ smx_action_t comm = simcall_comm_irecv(rdv, dst_buff, dst_buff_size,
match_fun, data);
- SIMIX_req_comm_wait(comm, timeout);
+ simcall_comm_wait(comm, timeout);
}
else {
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_RECV;
- req->comm_recv.rdv = rdv;
- req->comm_recv.dst_buff = dst_buff;
- req->comm_recv.dst_buff_size = dst_buff_size;
- req->comm_recv.match_fun = match_fun;
- req->comm_recv.data = data;
- req->comm_recv.timeout = timeout;
+ simcall->call = SIMCALL_COMM_RECV;
+ simcall->comm_recv.rdv = rdv;
+ simcall->comm_recv.dst_buff = dst_buff;
+ simcall->comm_recv.dst_buff_size = dst_buff_size;
+ simcall->comm_recv.match_fun = match_fun;
+ simcall->comm_recv.data = data;
+ simcall->comm_recv.timeout = timeout;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
}
-smx_action_t SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size,
+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_assert(rdv, "No rendez-vous point defined for irecv");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_IRECV;
- req->comm_irecv.rdv = rdv;
- req->comm_irecv.dst_buff = dst_buff;
- req->comm_irecv.dst_buff_size = dst_buff_size;
- req->comm_irecv.match_fun = match_fun;
- req->comm_irecv.data = data;
+ simcall->call = SIMCALL_COMM_IRECV;
+ simcall->comm_irecv.rdv = rdv;
+ simcall->comm_irecv.dst_buff = dst_buff;
+ simcall->comm_irecv.dst_buff_size = dst_buff_size;
+ simcall->comm_irecv.match_fun = match_fun;
+ simcall->comm_irecv.data = data;
- SIMIX_request_push(req->issuer);
- return req->comm_irecv.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_irecv.result;
}
-void SIMIX_req_comm_destroy(smx_action_t comm)
+void simcall_comm_destroy(smx_action_t comm)
{
xbt_assert(comm, "Invalid parameter");
- /* FIXME remove this request type: comms are auto-destroyed now */
+ /* FIXME remove this simcall type: comms are auto-destroyed now */
/*
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = simcall_mine();
- req->call = REQ_COMM_DESTROY;
- req->comm_destroy.comm = comm;
+ simcall->call = SIMCALL_COMM_DESTROY;
+ simcall->comm_destroy.comm = comm;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
*/
}
-void SIMIX_req_comm_cancel(smx_action_t comm)
+void simcall_comm_cancel(smx_action_t comm)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_CANCEL;
- req->comm_cancel.comm = comm;
+ simcall->call = SIMCALL_COMM_CANCEL;
+ simcall->comm_cancel.comm = comm;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-unsigned int SIMIX_req_comm_waitany(xbt_dynar_t comms)
+unsigned int simcall_comm_waitany(xbt_dynar_t comms)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_WAITANY;
- req->comm_waitany.comms = comms;
+ simcall->call = SIMCALL_COMM_WAITANY;
+ simcall->comm_waitany.comms = comms;
- SIMIX_request_push(req->issuer);
- return req->comm_waitany.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_waitany.result;
}
-int SIMIX_req_comm_testany(xbt_dynar_t comms)
+int simcall_comm_testany(xbt_dynar_t comms)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
if (xbt_dynar_is_empty(comms))
return -1;
- req->call = REQ_COMM_TESTANY;
- req->comm_testany.comms = comms;
+ simcall->call = SIMCALL_COMM_TESTANY;
+ simcall->comm_testany.comms = comms;
- SIMIX_request_push(req->issuer);
- return req->comm_testany.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_testany.result;
}
-void SIMIX_req_comm_wait(smx_action_t comm, double timeout)
+void simcall_comm_wait(smx_action_t comm, double timeout)
{
xbt_assert(isfinite(timeout), "timeout is not finite!");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_WAIT;
- req->comm_wait.comm = comm;
- req->comm_wait.timeout = timeout;
+ simcall->call = SIMCALL_COMM_WAIT;
+ simcall->comm_wait.comm = comm;
+ simcall->comm_wait.timeout = timeout;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
#ifdef HAVE_TRACING
* \param execution The execution action
* \param category The tracing category
*/
-void SIMIX_req_set_category(smx_action_t action, const char *category)
+void simcall_set_category(smx_action_t action, const char *category)
{
if (category == NULL) {
return;
}
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_SET_CATEGORY;
- req->set_category.action = action;
- req->set_category.category = category;
+ simcall->call = SIMCALL_SET_CATEGORY;
+ simcall->set_category.action = action;
+ simcall->set_category.category = category;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
#endif
-int SIMIX_req_comm_test(smx_action_t comm)
+int simcall_comm_test(smx_action_t comm)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_TEST;
- req->comm_test.comm = comm;
+ simcall->call = SIMCALL_COMM_TEST;
+ simcall->comm_test.comm = comm;
- SIMIX_request_push(req->issuer);
- return req->comm_test.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_test.result;
}
-double SIMIX_req_comm_get_remains(smx_action_t comm)
+double simcall_comm_get_remains(smx_action_t comm)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_GET_REMAINS;
- req->comm_get_remains.comm = comm;
+ simcall->call = SIMCALL_COMM_GET_REMAINS;
+ simcall->comm_get_remains.comm = comm;
- SIMIX_request_push(req->issuer);
- return req->comm_get_remains.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_get_remains.result;
}
-e_smx_state_t SIMIX_req_comm_get_state(smx_action_t comm)
+e_smx_state_t simcall_comm_get_state(smx_action_t comm)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_GET_STATE;
- req->comm_get_state.comm = comm;
+ simcall->call = SIMCALL_COMM_GET_STATE;
+ simcall->comm_get_state.comm = comm;
- SIMIX_request_push(req->issuer);
- return req->comm_get_state.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_get_state.result;
}
-void *SIMIX_req_comm_get_src_data(smx_action_t comm)
+void *simcall_comm_get_src_data(smx_action_t comm)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_GET_SRC_DATA;
- req->comm_get_src_data.comm = comm;
+ simcall->call = SIMCALL_COMM_GET_SRC_DATA;
+ simcall->comm_get_src_data.comm = comm;
- SIMIX_request_push(req->issuer);
- return req->comm_get_src_data.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_get_src_data.result;
}
-void *SIMIX_req_comm_get_dst_data(smx_action_t comm)
+void *simcall_comm_get_dst_data(smx_action_t comm)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_GET_DST_DATA;
- req->comm_get_dst_data.comm = comm;
+ simcall->call = SIMCALL_COMM_GET_DST_DATA;
+ simcall->comm_get_dst_data.comm = comm;
- SIMIX_request_push(req->issuer);
- return req->comm_get_dst_data.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_get_dst_data.result;
}
-smx_process_t SIMIX_req_comm_get_src_proc(smx_action_t comm)
+smx_process_t simcall_comm_get_src_proc(smx_action_t comm)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_GET_SRC_PROC;
- req->comm_get_src_proc.comm = comm;
+ simcall->call = SIMCALL_COMM_GET_SRC_PROC;
+ simcall->comm_get_src_proc.comm = comm;
- SIMIX_request_push(req->issuer);
- return req->comm_get_src_proc.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_get_src_proc.result;
}
-smx_process_t SIMIX_req_comm_get_dst_proc(smx_action_t comm)
+smx_process_t simcall_comm_get_dst_proc(smx_action_t comm)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_GET_DST_PROC;
- req->comm_get_dst_proc.comm = comm;
+ simcall->call = SIMCALL_COMM_GET_DST_PROC;
+ simcall->comm_get_dst_proc.comm = comm;
- SIMIX_request_push(req->issuer);
- return req->comm_get_dst_proc.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_get_dst_proc.result;
}
#ifdef HAVE_LATENCY_BOUND_TRACKING
-int SIMIX_req_comm_is_latency_bounded(smx_action_t comm)
+int simcall_comm_is_latency_bounded(smx_action_t comm)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COMM_IS_LATENCY_BOUNDED;
- req->comm_is_latency_bounded.comm = comm;
+ simcall->call = SIMCALL_COMM_IS_LATENCY_BOUNDED;
+ simcall->comm_is_latency_bounded.comm = comm;
- SIMIX_request_push(req->issuer);
- return req->comm_is_latency_bounded.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->comm_is_latency_bounded.result;
}
#endif
-smx_mutex_t SIMIX_req_mutex_init(void)
+smx_mutex_t simcall_mutex_init(void)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_MUTEX_INIT;
+ simcall->call = SIMCALL_MUTEX_INIT;
- SIMIX_request_push(req->issuer);
- return req->mutex_init.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->mutex_init.result;
}
-void SIMIX_req_mutex_destroy(smx_mutex_t mutex)
+void simcall_mutex_destroy(smx_mutex_t mutex)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_MUTEX_DESTROY;
- req->mutex_destroy.mutex = mutex;
+ simcall->call = SIMCALL_MUTEX_DESTROY;
+ simcall->mutex_destroy.mutex = mutex;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-void SIMIX_req_mutex_lock(smx_mutex_t mutex)
+void simcall_mutex_lock(smx_mutex_t mutex)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_MUTEX_LOCK;
- req->mutex_lock.mutex = mutex;
+ simcall->call = SIMCALL_MUTEX_LOCK;
+ simcall->mutex_lock.mutex = mutex;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-int SIMIX_req_mutex_trylock(smx_mutex_t mutex)
+int simcall_mutex_trylock(smx_mutex_t mutex)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_MUTEX_TRYLOCK;
- req->mutex_trylock.mutex = mutex;
+ simcall->call = SIMCALL_MUTEX_TRYLOCK;
+ simcall->mutex_trylock.mutex = mutex;
- SIMIX_request_push(req->issuer);
- return req->mutex_trylock.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->mutex_trylock.result;
}
-void SIMIX_req_mutex_unlock(smx_mutex_t mutex)
+void simcall_mutex_unlock(smx_mutex_t mutex)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_MUTEX_UNLOCK;
- req->mutex_unlock.mutex = mutex;
+ simcall->call = SIMCALL_MUTEX_UNLOCK;
+ simcall->mutex_unlock.mutex = mutex;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-smx_cond_t SIMIX_req_cond_init(void)
+smx_cond_t simcall_cond_init(void)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COND_INIT;
+ simcall->call = SIMCALL_COND_INIT;
- SIMIX_request_push(req->issuer);
- return req->cond_init.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->cond_init.result;
}
-void SIMIX_req_cond_destroy(smx_cond_t cond)
+void simcall_cond_destroy(smx_cond_t cond)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COND_DESTROY;
- req->cond_destroy.cond = cond;
+ simcall->call = SIMCALL_COND_DESTROY;
+ simcall->cond_destroy.cond = cond;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-void SIMIX_req_cond_signal(smx_cond_t cond)
+void simcall_cond_signal(smx_cond_t cond)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COND_SIGNAL;
- req->cond_signal.cond = cond;
+ simcall->call = SIMCALL_COND_SIGNAL;
+ simcall->cond_signal.cond = cond;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-void SIMIX_req_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
+void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COND_WAIT;
- req->cond_wait.cond = cond;
- req->cond_wait.mutex = mutex;
+ simcall->call = SIMCALL_COND_WAIT;
+ simcall->cond_wait.cond = cond;
+ simcall->cond_wait.mutex = mutex;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-void SIMIX_req_cond_wait_timeout(smx_cond_t cond,
+void simcall_cond_wait_timeout(smx_cond_t cond,
smx_mutex_t mutex,
double timeout)
{
xbt_assert(isfinite(timeout), "timeout is not finite!");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COND_WAIT_TIMEOUT;
- req->cond_wait_timeout.cond = cond;
- req->cond_wait_timeout.mutex = mutex;
- req->cond_wait_timeout.timeout = timeout;
+ simcall->call = SIMCALL_COND_WAIT_TIMEOUT;
+ simcall->cond_wait_timeout.cond = cond;
+ simcall->cond_wait_timeout.mutex = mutex;
+ simcall->cond_wait_timeout.timeout = timeout;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-void SIMIX_req_cond_broadcast(smx_cond_t cond)
+void simcall_cond_broadcast(smx_cond_t cond)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_COND_BROADCAST;
- req->cond_broadcast.cond = cond;
+ simcall->call = SIMCALL_COND_BROADCAST;
+ simcall->cond_broadcast.cond = cond;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-smx_sem_t SIMIX_req_sem_init(int capacity)
+smx_sem_t simcall_sem_init(int capacity)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_SEM_INIT;
- req->sem_init.capacity = capacity;
+ simcall->call = SIMCALL_SEM_INIT;
+ simcall->sem_init.capacity = capacity;
- SIMIX_request_push(req->issuer);
- return req->sem_init.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->sem_init.result;
}
-void SIMIX_req_sem_destroy(smx_sem_t sem)
+void simcall_sem_destroy(smx_sem_t sem)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_SEM_DESTROY;
- req->sem_destroy.sem = sem;
+ simcall->call = SIMCALL_SEM_DESTROY;
+ simcall->sem_destroy.sem = sem;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-void SIMIX_req_sem_release(smx_sem_t sem)
+void simcall_sem_release(smx_sem_t sem)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_SEM_RELEASE;
- req->sem_release.sem = sem;
+ simcall->call = SIMCALL_SEM_RELEASE;
+ simcall->sem_release.sem = sem;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-int SIMIX_req_sem_would_block(smx_sem_t sem)
+int simcall_sem_would_block(smx_sem_t sem)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_SEM_WOULD_BLOCK;
- req->sem_would_block.sem = sem;
+ simcall->call = SIMCALL_SEM_WOULD_BLOCK;
+ simcall->sem_would_block.sem = sem;
- SIMIX_request_push(req->issuer);
- return req->sem_would_block.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->sem_would_block.result;
}
-void SIMIX_req_sem_acquire(smx_sem_t sem)
+void simcall_sem_acquire(smx_sem_t sem)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_SEM_ACQUIRE;
- req->sem_acquire.sem = sem;
+ simcall->call = SIMCALL_SEM_ACQUIRE;
+ simcall->sem_acquire.sem = sem;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-void SIMIX_req_sem_acquire_timeout(smx_sem_t sem, double timeout)
+void simcall_sem_acquire_timeout(smx_sem_t sem, double timeout)
{
xbt_assert(isfinite(timeout), "timeout is not finite!");
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_SEM_ACQUIRE_TIMEOUT;
- req->sem_acquire_timeout.sem = sem;
- req->sem_acquire_timeout.timeout = timeout;
+ simcall->call = SIMCALL_SEM_ACQUIRE_TIMEOUT;
+ simcall->sem_acquire_timeout.sem = sem;
+ simcall->sem_acquire_timeout.timeout = timeout;
- SIMIX_request_push(req->issuer);
+ SIMIX_simcall_push(simcall->issuer);
}
-int SIMIX_req_sem_get_capacity(smx_sem_t sem)
+int simcall_sem_get_capacity(smx_sem_t sem)
{
- smx_req_t req = SIMIX_req_mine();
+ smx_simcall_t simcall = SIMIX_simcall_mine();
- req->call = REQ_SEM_GET_CAPACITY;
- req->sem_get_capacity.sem = sem;
+ simcall->call = SIMCALL_SEM_GET_CAPACITY;
+ simcall->sem_get_capacity.sem = sem;
- SIMIX_request_push(req->issuer);
- return req->sem_get_capacity.result;
+ SIMIX_simcall_push(simcall->issuer);
+ return simcall->sem_get_capacity.result;
}
-void SIMIX_req_file_read(char* name)
+void simcall_file_read(char* name)
{
- smx_req_t req = SIMIX_req_mine();
-
- req->call = REQ_FILE_READ;
- req->file_read.name = name;
- SIMIX_request_push(req->issuer);
+ smx_simcall_t simcall = SIMIX_simcall_mine();
+ simcall->call = SIMCALL_FILE_READ;
+ simcall->file_read.name = name;
+ SIMIX_simcall_push(simcall->issuer);
}
/* ************************************************************************** */
-/** @brief returns a printable string representing the request kind */
-const char *SIMIX_request_name(int kind) {
- return request_names[kind];
+/** @brief returns a printable string representing a simcall */
+const char *SIMIX_simcall_name(e_smx_simcall_t kind) {
+ return simcall_names[kind];
}
print_request("New recv", request);
mailbox = smpi_process_mailbox();
// FIXME: SIMIX does not yet support non-contiguous datatypes
- request->action = SIMIX_req_comm_irecv(mailbox, request->buf, &request->size, &match_recv, request);
+ request->action = simcall_comm_irecv(mailbox, request->buf, &request->size, &match_recv, request);
} else {
print_request("New send", request);
mailbox = smpi_process_remote_mailbox(
XBT_DEBUG("Send request %p is not detached (buf: %p)",request,request->buf);
}
request->action =
- SIMIX_req_comm_isend(mailbox, request->size, -1.0,
+ simcall_comm_isend(mailbox, request->size, -1.0,
request->buf, request->size,
&match_send,
&smpi_mpi_request_free_voidp, // how to free the userdata if a detached send fails
detached);
#ifdef HAVE_TRACING
- SIMIX_req_set_category (request->action, TRACE_internal_smpi_get_category());
+ simcall_set_category (request->action, TRACE_internal_smpi_get_category());
#endif
}
}
if ((*request)->action == NULL)
flag = 1;
else
- flag = SIMIX_req_comm_test((*request)->action);
+ flag = simcall_comm_test((*request)->action);
if(flag) {
smpi_mpi_wait(request, status);
}
}
}
if(size > 0) {
- i = SIMIX_req_comm_testany(comms);
+ i = simcall_comm_testany(comms);
// FIXME: MPI_UNDEFINED or does SIMIX have a return code?
if(i != MPI_UNDEFINED) {
*index = map[i];
{
print_request("Waiting", *request);
if ((*request)->action != NULL) { // this is not a detached send
- SIMIX_req_comm_wait((*request)->action, -1.0);
+ simcall_comm_wait((*request)->action, -1.0);
finish_wait(request, status);
}
// FIXME for a detached send, finish_wait is not called:
}
}
if(size > 0) {
- i = SIMIX_req_comm_waitany(comms);
+ i = simcall_comm_waitany(comms);
// FIXME: MPI_UNDEFINED or does SIMIX have a return code?
if (i != MPI_UNDEFINED) {
index = map[i];
host = SIMIX_host_self();
XBT_DEBUG("Handle real computation time: %f flops", flops);
- action = SIMIX_req_host_execute("computation", host, flops, 1);
+ action = simcall_host_execute("computation", host, flops, 1);
#ifdef HAVE_TRACING
- SIMIX_req_set_category (action, TRACE_internal_smpi_get_category());
+ simcall_set_category (action, TRACE_internal_smpi_get_category());
#endif
- SIMIX_req_host_execution_wait(action);
+ simcall_host_execution_wait(action);
}
static void smpi_execute(double duration)
proc = SIMIX_process_self();
index = atoi((*argv)[1]);
data = smpi_process_remote_data(index);
- SIMIX_req_process_set_data(proc, data);
+ simcall_process_set_data(proc, data);
if (*argc > 2) {
free((*argv)[1]);
memmove(&(*argv)[1], &(*argv)[2], sizeof(char *) * (*argc - 2));
{
// wait for all pending asynchronous comms to finish
while (SIMIX_process_has_pending_comms(SIMIX_process_self())) {
- SIMIX_req_process_sleep(1);
+ simcall_process_sleep(1);
}
}
process_data[i]->index = i;
process_data[i]->argc = NULL;
process_data[i]->argv = NULL;
- process_data[i]->mailbox = SIMIX_req_rdv_create(get_mailbox_name(name, i));
+ process_data[i]->mailbox = simcall_rdv_create(get_mailbox_name(name, i));
process_data[i]->timer = xbt_os_timer_new();
group = smpi_group_new(1);
process_data[i]->comm_self = smpi_comm_new(group);
for (i = 0; i < count; i++) {
smpi_comm_destroy(process_data[i]->comm_self);
xbt_os_timer_free(process_data[i]->timer);
- SIMIX_req_rdv_destroy(process_data[i]->mailbox);
+ simcall_rdv_destroy(process_data[i]->mailbox);
xbt_free(process_data[i]);
}
xbt_free(process_data);
smpi_bench_end();
smpi_process_destroy();
// FIXME: should kill all processes in comm instead
- SIMIX_req_process_kill(SIMIX_process_self());
+ simcall_process_kill(SIMIX_process_self());
return MPI_SUCCESS;
}
smx_process_t self = SIMIX_process_self();
xbt_thread_t t =
(xbt_thread_t) SIMIX_process_self_get_data(self);
- SIMIX_req_process_set_data(self, t->father_data);
+ simcall_process_set_data(self, t->father_data);
t->code(t->userparam);
if (t->joinable) {
t->done = 1;
res->code = code;
res->father_data = SIMIX_process_self_get_data(SIMIX_process_self());
/* char*name = bprintf("%s#%p",SIMIX_process_self_get_name(), param); */
- SIMIX_req_process_create(&res->s_process, name,
+ simcall_process_create(&res->s_process, name,
xbt_thread_create_wrapper, res,
SIMIX_host_self_get_name(), 0, NULL,
/*props */ NULL);
void xbt_thread_cancel(xbt_thread_t thread)
{
- SIMIX_req_process_kill(thread->s_process);
+ simcall_process_kill(thread->s_process);
free(thread->name);
free(thread);
}
void xbt_thread_exit()
{
- SIMIX_req_process_kill(SIMIX_process_self());
+ simcall_process_kill(SIMIX_process_self());
}
xbt_thread_t xbt_thread_self(void)
xbt_mutex_t xbt_mutex_init(void)
{
- return (xbt_mutex_t) SIMIX_req_mutex_init();
+ return (xbt_mutex_t) simcall_mutex_init();
}
void xbt_mutex_acquire(xbt_mutex_t mutex)
{
- SIMIX_req_mutex_lock((smx_mutex_t) mutex);
+ simcall_mutex_lock((smx_mutex_t) mutex);
}
void xbt_mutex_release(xbt_mutex_t mutex)
{
- SIMIX_req_mutex_unlock((smx_mutex_t) mutex);
+ simcall_mutex_unlock((smx_mutex_t) mutex);
}
void xbt_mutex_destroy(xbt_mutex_t mutex)
{
- SIMIX_req_mutex_destroy((smx_mutex_t) mutex);
+ simcall_mutex_destroy((smx_mutex_t) mutex);
}
/***** condition related functions *****/
xbt_cond_t xbt_cond_init(void)
{
- return (xbt_cond_t) SIMIX_req_cond_init();
+ return (xbt_cond_t) simcall_cond_init();
}
void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex)
{
- SIMIX_req_cond_wait((smx_cond_t) cond, (smx_mutex_t) mutex);
+ simcall_cond_wait((smx_cond_t) cond, (smx_mutex_t) mutex);
}
void xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay)
{
- SIMIX_req_cond_wait_timeout((smx_cond_t) cond, (smx_mutex_t) mutex, delay);
+ simcall_cond_wait_timeout((smx_cond_t) cond, (smx_mutex_t) mutex, delay);
}
void xbt_cond_signal(xbt_cond_t cond)
{
- SIMIX_req_cond_signal((smx_cond_t) cond);
+ simcall_cond_signal((smx_cond_t) cond);
}
void xbt_cond_broadcast(xbt_cond_t cond)
{
- SIMIX_req_cond_broadcast((smx_cond_t) cond);
+ simcall_cond_broadcast((smx_cond_t) cond);
}
void xbt_cond_destroy(xbt_cond_t cond)
{
- SIMIX_req_cond_destroy((smx_cond_t) cond);
+ simcall_cond_destroy((smx_cond_t) cond);
}
*/
void xbt_sleep(double sec)
{
- SIMIX_req_process_sleep(sec);
+ simcall_process_sleep(sec);
}
const char *xbt_procname(void)