X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e276e9953a9ab5894bbb623fc17ec79512efab5d..806504b9602a886e391b54e458b2c1f7f42d3afb:/src/simix/smx_user.c diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 182c5621c4..b42fc6bf5e 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -1,5 +1,6 @@ #include "private.h" +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix); /** * \brief Returns a host given its name. * @@ -596,7 +597,8 @@ smx_action_t SIMIX_req_rdv_get_head(smx_rdv_t rdv) } smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate, - void *src_buff, size_t src_buff_size, void *data) + void *src_buff, size_t src_buff_size, + int (*match_fun)(void *, void *), void *data) { s_smx_req_t req; @@ -608,13 +610,15 @@ smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate, 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.data = data; SIMIX_request_push(&req); return req.comm_isend.result; } -smx_action_t SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size) +smx_action_t SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, + int (*match_fun)(void *, void *), void *data) { s_smx_req_t req; @@ -624,6 +628,8 @@ smx_action_t SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_bu 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; SIMIX_request_push(&req); return req.comm_irecv.result; @@ -660,6 +666,19 @@ unsigned int SIMIX_req_comm_waitany(xbt_dynar_t comms) return req.comm_waitany.result; } +int SIMIX_req_comm_testany(xbt_dynar_t comms) +{ + s_smx_req_t req; + if (xbt_dynar_length(comms)==0) + return -1; + + req.call = REQ_COMM_TESTANY; + req.comm_testany.comms = comms; + + SIMIX_request_push(&req); + return req.comm_testany.result; +} + void SIMIX_req_comm_wait(smx_action_t comm, double timeout) { s_smx_req_t req; @@ -671,6 +690,26 @@ void SIMIX_req_comm_wait(smx_action_t comm, double timeout) SIMIX_request_push(&req); } +#ifdef HAVE_TRACING +/** + * \brief Set the category of an action. + * + * This functions changes the category only. It calls a surf function. + * \param execution The execution action + * \param category The tracing category + */ +void SIMIX_req_set_category(smx_action_t action, const char *category) +{ + s_smx_req_t req; + + req.call = REQ_SET_CATEGORY; + req.set_category.action = action; + req.set_category.category = category; + + SIMIX_request_push(&req); +} +#endif + int SIMIX_req_comm_test(smx_action_t comm) { s_smx_req_t req; @@ -704,15 +743,26 @@ e_smx_state_t SIMIX_req_comm_get_state(smx_action_t comm) return req.comm_get_state.result; } -void *SIMIX_req_comm_get_data(smx_action_t comm) +void *SIMIX_req_comm_get_src_data(smx_action_t comm) +{ + s_smx_req_t req; + + req.call = REQ_COMM_GET_SRC_DATA; + req.comm_get_src_data.comm = comm; + + SIMIX_request_push(&req); + return req.comm_get_src_data.result; +} + +void *SIMIX_req_comm_get_dst_data(smx_action_t comm) { s_smx_req_t req; - req.call = REQ_COMM_GET_DATA; - req.comm_get_data.comm = comm; + req.call = REQ_COMM_GET_DST_DATA; + req.comm_get_dst_data.comm = comm; SIMIX_request_push(&req); - return req.comm_get_data.result; + return req.comm_get_dst_data.result; } void *SIMIX_req_comm_get_src_buff(smx_action_t comm)