Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] declaring xbt_log categories for tracing
[simgrid.git] / src / instr / instr_smx.c
index 45ed73e..75b8b3b 100644 (file)
@@ -8,16 +8,17 @@
 
 #ifdef HAVE_TRACING
 
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_simix, instr, "Tracing Simix");
+
 static long long int counter = 0;       /* to uniquely identify simix actions */
 
 void TRACE_smx_host_execute(smx_action_t act)
 {
-  char *category = NULL;
-  if (!IS_TRACING)
+  if (!TRACE_is_active())
     return;
 
   act->counter = counter++;
-  category = TRACE_category_get(SIMIX_process_self());
+  char *category = TRACE_category_get(SIMIX_process_self());
   if (category) {
     act->category = xbt_new(char, strlen(category) + 1);
     strncpy(act->category, category, strlen(category) + 1);
@@ -27,12 +28,11 @@ void TRACE_smx_host_execute(smx_action_t act)
 
 void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc)
 {
-  char *category = NULL;
-  if (!IS_TRACING)
+  if (!TRACE_is_active())
     return;
 
   act->counter = counter++;
-  category = TRACE_category_get(proc);
+  char *category = TRACE_category_get(proc);
   if (category) {
     act->category = xbt_strdup(category);
   }
@@ -41,7 +41,7 @@ void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc)
 
 void TRACE_smx_action_destroy(smx_action_t act)
 {
-  if (!IS_TRACING)
+  if (!TRACE_is_active())
     return;
 
   if (act->category) {