A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
further improvement of ChangeLog. Everything should be documented now
[simgrid.git]
/
src
/
msg
/
msg_mailbox.c
diff --git
a/src/msg/msg_mailbox.c
b/src/msg/msg_mailbox.c
index
0164422
..
b8c72c7
100644
(file)
--- a/
src/msg/msg_mailbox.c
+++ b/
src/msg/msg_mailbox.c
@@
-110,9
+110,18
@@
MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t *task, m_host_t host,
{
xbt_ex_t e;
MSG_error_t ret = MSG_OK;
- size_t buff_size = 0;
smx_comm_t comm;
+
+ /* We no longer support getting a task from a specific host */
+ if (host) THROW_UNIMPLEMENTED;
+
CHECK_HOST();
+#ifdef HAVE_TRACING
+ TRACE_msg_task_get_start ();
+ double start_time = MSG_get_clock();
+#endif
+
+ memset(&comm,0,sizeof(comm));
/* Kept for compatibility with older implementation */
xbt_assert1(!MSG_mailbox_get_cond(mailbox),
@@
-123,16
+132,13
@@
MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t *task, m_host_t host,
xbt_assert0(task, "Null pointer for the task storage");
if (*task)
- CRITICAL0
- ("MSG_task_get() was asked to write in a non empty task struct.");
-
- /* We no loger support getting a task from a specific host */
- if(host)
- THROW_UNIMPLEMENTED;
+ CRITICAL0("MSG_task_get() was asked to write in a non empty task struct.");
/* Try to receive it by calling SIMIX network layer */
TRY{
- SIMIX_network_recv(mailbox->rdv, timeout, NULL, &buff_size, &comm);
+ SIMIX_network_recv(mailbox->rdv, timeout, task, NULL, &comm);
+ //INFO2("Got task %s from %s",(*task)->name,mailbox->alias);
+ (*task)->simdata->refcount--;
}
CATCH(e){
switch(e.category){
@@
-143,20
+149,21
@@
MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t *task, m_host_t host,
ret = MSG_TRANSFER_FAILURE;
break;
case timeout_error:
- ret = MSG_T
RANSFER_FAILURE
;
+ ret = MSG_T
IMEOUT
;
break;
default:
- xbt_die(
"Unhandled SIMIX network exception"
);
+ xbt_die(
bprintf("Unhandled SIMIX network exception: %s",e.msg)
);
}
xbt_ex_free(e);
}
- *task = SIMIX_communication_get_data(comm);
-
- /* If the sender didn't decremented the refcount so far then do it */
- if (*task && (*task)->simdata->refcount > 1)
- (*task)->simdata->refcount--;
-
+ if (ret != MSG_HOST_FAILURE &&
+ ret != MSG_TRANSFER_FAILURE &&
+ ret != MSG_TIMEOUT){
+#ifdef HAVE_TRACING
+ TRACE_msg_task_get_end (start_time, *task);
+#endif
+ }
MSG_RETURN(ret);
}
@@
-171,6
+178,11
@@
MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
CHECK_HOST();
+#ifdef HAVE_TRACING
+ int call_end = TRACE_msg_task_put_start (task); //must be after CHECK_HOST()
+#endif
+
+
/* Prepare the task to send */
t_simdata = task->simdata;
t_simdata->sender = process;
@@
-183,7
+195,7
@@
MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
msg_global->sent_msg++;
process->simdata->waiting_task = task;
-
+
/* Try to send it by calling SIMIX network layer */
TRY{
/* Kept for semantical compatibility with older implementation */
@@
-191,7
+203,7
@@
MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
SIMIX_cond_signal(mailbox->cond);
SIMIX_network_send(mailbox->rdv, t_simdata->message_size, t_simdata->rate,
- timeout,
NULL, 0
, &t_simdata->comm, task);
+ timeout,
task, sizeof(void*)
, &t_simdata->comm, task);
}
CATCH(e){
@@
-203,22
+215,20
@@
MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
ret = MSG_TRANSFER_FAILURE;
break;
case timeout_error:
- ret = MSG_T
RANSFER_FAILURE
;
- break;
+ ret = MSG_T
IMEOUT
;
+ break;
default:
- xbt_die(
"Unhandled SIMIX network exception"
);
+ xbt_die(
bprintf("Unhandled SIMIX network exception: %s",e.msg)
);
}
xbt_ex_free(e);
- /* If the receiver end didn't decremented the refcount so far then do it */
- if (t_simdata->refcount > 1)
-
t_simdata->refcount--;
+
+ /* Decrement the refcount only on failure */
+ t_simdata->refcount--;
}
process->simdata->waiting_task = NULL;
-
- /* If the receiver end didn't decremented the refcount so far then do it */
- if (t_simdata->refcount > 1)
- t_simdata->refcount--;
-
+#ifdef HAVE_TRACING
+ if (call_end) TRACE_msg_task_put_end ();
+#endif
MSG_RETURN(ret);
}