Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] logging messages for category attribution of simix processes
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 6 Dec 2010 00:56:00 +0000 (00:56 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 6 Dec 2010 00:56:00 +0000 (00:56 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8995 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/instr/instr_categories.c

index aee6af8..1f87812 100644 (file)
@@ -8,6 +8,8 @@
 
 #ifdef HAVE_TRACING
 
 
 #ifdef HAVE_TRACING
 
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_category, instr, "Tracing category set/get/del of SMX processes");
+
 static xbt_dict_t current_task_category = NULL;
 
 void TRACE_category_alloc()
 static xbt_dict_t current_task_category = NULL;
 
 void TRACE_category_alloc()
@@ -26,6 +28,7 @@ void TRACE_category_set(smx_process_t proc, const char *category)
   char *var_cpy = NULL;
   snprintf(processid, 100, "%p", proc);
   var_cpy = xbt_strdup(category);
   char *var_cpy = NULL;
   snprintf(processid, 100, "%p", proc);
   var_cpy = xbt_strdup(category);
+  DEBUG2("SET process %p, category %s", proc, category);
   xbt_dict_set(current_task_category, processid, var_cpy, xbt_free);
 }
 
   xbt_dict_set(current_task_category, processid, var_cpy, xbt_free);
 }
 
@@ -33,14 +36,18 @@ char *TRACE_category_get(smx_process_t proc)
 {
   char processid[100];
   snprintf(processid, 100, "%p", proc);
 {
   char processid[100];
   snprintf(processid, 100, "%p", proc);
-  return xbt_dict_get_or_null(current_task_category, processid);
+  char *ret = xbt_dict_get_or_null(current_task_category, processid);
+  DEBUG2("GET process %p, category %s", proc, ret);
+  return ret;
 }
 
 void TRACE_category_unset(smx_process_t proc)
 {
   char processid[100];
   snprintf(processid, 100, "%p", proc);
 }
 
 void TRACE_category_unset(smx_process_t proc)
 {
   char processid[100];
   snprintf(processid, 100, "%p", proc);
-  if (xbt_dict_get_or_null(current_task_category, processid) != NULL) {
+  char *category = xbt_dict_get_or_null(current_task_category, processid);
+  if (category != NULL) {
+    DEBUG2("DEL process %p, category %s", proc, category);
     xbt_dict_remove(current_task_category, processid);
   }
 }
     xbt_dict_remove(current_task_category, processid);
   }
 }