X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d9601b8ae97f9ef29cc571b71fa4a41ab9133a2b..906528573f691f73f4a28c8dbaab0258640a3c3a:/src/instr/instr_msg_task.c diff --git a/src/instr/instr_msg_task.c b/src/instr/instr_msg_task.c index 9796fbcd20..e86c41603e 100644 --- a/src/instr/instr_msg_task.c +++ b/src/instr/instr_msg_task.c @@ -10,14 +10,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg, instr, "MSG"); -xbt_dict_t tasks_created = NULL; - /* * TRACE_msg_set_task_category: tracing interface function */ void TRACE_msg_set_task_category(m_task_t task, const char *category) { - if (!tasks_created) tasks_created = xbt_dict_new(); if (!TRACE_is_active()) return; @@ -47,21 +44,18 @@ void TRACE_msg_set_task_category(m_task_t task, const char *category) m_host_t host = MSG_host_self(); container_t host_container = getContainer(host->name); //check to see if there is a container with the task->name - container_t msg = getContainer(task->name); - xbt_assert3(xbt_dict_get_or_null (tasks_created, task->name) == NULL, + xbt_assert3(getContainer(task->name) == NULL, "Task %p(%s). Tracing already knows a task with name %s." "The name of each task must be unique, if --cfg=tracing/msg/task:1 is used.", task, task->name, task->name); - msg = newContainer(task->name, INSTR_MSG_TASK, host_container); + container_t msg = newContainer(task->name, INSTR_MSG_TASK, host_container); type_t type = getType (task->category); if (!type){ - type = newVariableType(task->category, TYPE_VARIABLE, NULL, msg->type); + type = getVariableType(task->category, NULL, msg->type); } - pajeSetVariable(SIMIX_get_clock(), type->id, msg->id, "1"); + new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1); type = getType ("MSG_TASK_STATE"); - pajePushState (MSG_get_clock(), type->id, msg->id, "created"); - - xbt_dict_set (tasks_created, task->name, xbt_strdup("1"), xbt_free); + new_pajePushState (MSG_get_clock(), msg, type, "created"); } } @@ -85,7 +79,7 @@ void TRACE_msg_task_execute_start(m_task_t task) container_t task_container = getContainer (task->name); type_t type = getType ("MSG_TASK_STATE"); - pajePushState (MSG_get_clock(), type->id, task_container->id, "MSG_task_execute"); + new_pajePushState (MSG_get_clock(), task_container, type, "MSG_task_execute"); } void TRACE_msg_task_execute_end(m_task_t task) @@ -98,13 +92,12 @@ void TRACE_msg_task_execute_end(m_task_t task) container_t task_container = getContainer (task->name); type_t type = getType ("MSG_TASK_STATE"); - pajePopState (MSG_get_clock(), type->id, task_container->id); + new_pajePopState (MSG_get_clock(), task_container, type); } /* MSG_task_destroy related functions */ void TRACE_msg_task_destroy(m_task_t task) { - if (!tasks_created) tasks_created = xbt_dict_new(); if (!(TRACE_is_enabled() && TRACE_msg_task_is_enabled() && task->category)) return; @@ -117,8 +110,6 @@ void TRACE_msg_task_destroy(m_task_t task) //free category xbt_free(task->category); task->category = NULL; - - xbt_dict_remove (tasks_created, task->name); return; } @@ -148,15 +139,15 @@ void TRACE_msg_task_get_end(double start_time, m_task_t task) container_t host_container = getContainer(host->name); container_t msg = newContainer(task->name, INSTR_MSG_TASK, host_container); type_t type = getType (task->category); - pajeSetVariable(SIMIX_get_clock(), type->id, msg->id, "1"); + new_pajeSetVariable (SIMIX_get_clock(), msg, type, 1); type = getType ("MSG_TASK_STATE"); - pajePushState (MSG_get_clock(), type->id, msg->id, "created"); + new_pajePushState (MSG_get_clock(), msg, type, "created"); type = getType ("MSG_TASK_LINK"); char key[INSTR_DEFAULT_STR_SIZE]; snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", task->counter); - pajeEndLink(MSG_get_clock(), type->id, "0", "SR", msg->id, key); + new_pajeEndLink (MSG_get_clock(), getRootContainer(), type, msg, "SR", key); } /* MSG_task_put related functions */ @@ -170,12 +161,12 @@ int TRACE_msg_task_put_start(m_task_t task) container_t msg = getContainer (task->name); type_t type = getType ("MSG_TASK_STATE"); - pajePopState (MSG_get_clock(), type->id, msg->id); + new_pajePopState (MSG_get_clock(), msg, type); type = getType ("MSG_TASK_LINK"); char key[INSTR_DEFAULT_STR_SIZE]; snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", task->counter); - pajeStartLink(MSG_get_clock(), type->id, "0", "SR", msg->id, key); + new_pajeStartLink(MSG_get_clock(), getRootContainer(), type, msg, "SR", key); destroyContainer (msg);