Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
do not throw an exception if category is already created (use INFO instead, with...
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 13 Apr 2010 15:51:49 +0000 (15:51 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 13 Apr 2010 15:51:49 +0000 (15:51 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7554 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/instr/instr.h
src/instr/interface.c

index 3615359..d1a8f5a 100644 (file)
@@ -37,9 +37,9 @@
 
 XBT_PUBLIC(int) TRACE_start_with_mask (const char *filename, int mask);
 XBT_PUBLIC(int) TRACE_end (void);
 
 XBT_PUBLIC(int) TRACE_start_with_mask (const char *filename, int mask);
 XBT_PUBLIC(int) TRACE_end (void);
-XBT_PUBLIC(void) TRACE_category (const char *category);
+XBT_PUBLIC(int) TRACE_category (const char *category);
 XBT_PUBLIC(void) TRACE_define_type (const char *type, const char *parent_type, int final);
 XBT_PUBLIC(void) TRACE_define_type (const char *type, const char *parent_type, int final);
-XBT_PUBLIC(void) TRACE_create_category (const char *category, const char *type, const char *parent_category);
+XBT_PUBLIC(int) TRACE_create_category (const char *category, const char *type, const char *parent_category);
 XBT_PUBLIC(void) TRACE_msg_set_task_category (m_task_t task, const char *category);
 XBT_PUBLIC(void) TRACE_msg_set_process_category (m_process_t process, const char *category);
 XBT_PUBLIC(void) TRACE_set_mask (int mask);
 XBT_PUBLIC(void) TRACE_msg_set_task_category (m_task_t task, const char *category);
 XBT_PUBLIC(void) TRACE_msg_set_process_category (m_process_t process, const char *category);
 XBT_PUBLIC(void) TRACE_set_mask (int mask);
index 33a9e10..61103f8 100644 (file)
@@ -110,15 +110,15 @@ int TRACE_end() {
   return 0;
 }
 
   return 0;
 }
 
-void TRACE_category (const char *category)
+int TRACE_category (const char *category)
 {
 {
-  if (!IS_TRACING) return;
+  if (!IS_TRACING) return 1;
   static int first_time = 1;
   if (first_time){
          TRACE_define_type ("user_type", "0", 1);
          first_time = 0;
   }
   static int first_time = 1;
   if (first_time){
          TRACE_define_type ("user_type", "0", 1);
          first_time = 0;
   }
-  TRACE_create_category (category, "user_type", "0");
+  return TRACE_create_category (category, "user_type", "0");
 }
 
 void TRACE_define_type (const char *type,
 }
 
 void TRACE_define_type (const char *type,
@@ -146,7 +146,7 @@ void TRACE_define_type (const char *type,
   xbt_dict_set (defined_types, type, xbt_strdup("1"), xbt_free);
 }
 
   xbt_dict_set (defined_types, type, xbt_strdup("1"), xbt_free);
 }
 
-void TRACE_create_category (const char *category,
+int TRACE_create_category (const char *category,
                const char *type, const char *parent_category)
 {
   if (!IS_TRACING) return;
                const char *type, const char *parent_category)
 {
   if (!IS_TRACING) return;
@@ -154,14 +154,17 @@ void TRACE_create_category (const char *category,
   //check if type is defined
   if (!xbt_dict_get_or_null (defined_types, type)) {
         THROW1 (tracing_error, TRACE_ERROR_TYPE_NOT_DEFINED, "Type %s is not defined", type);
   //check if type is defined
   if (!xbt_dict_get_or_null (defined_types, type)) {
         THROW1 (tracing_error, TRACE_ERROR_TYPE_NOT_DEFINED, "Type %s is not defined", type);
+        return 1;
   }
   //check if parent_category exists
   if (strcmp(parent_category, "0") && !xbt_dict_get_or_null (created_categories, parent_category)){
      THROW1 (tracing_error, TRACE_ERROR_CATEGORY_NOT_DEFINED, "Category (used as parent) %s is not created", parent_category);
   }
   //check if parent_category exists
   if (strcmp(parent_category, "0") && !xbt_dict_get_or_null (created_categories, parent_category)){
      THROW1 (tracing_error, TRACE_ERROR_CATEGORY_NOT_DEFINED, "Category (used as parent) %s is not created", parent_category);
+     return 1;
   }
   //check if category is created
   if (xbt_dict_get_or_null (created_categories, category)){
   }
   //check if category is created
   if (xbt_dict_get_or_null (created_categories, category)){
-        THROW1 (tracing_error, TRACE_ERROR_CATEGORY_ALREADY_DEFINED, "Category %s is already created", category);
+        INFO1 ("Category %s is already created", category);
+     return 1;
   }
 
   pajeCreateContainer(MSG_get_clock(), category, type, parent_category, category);
   }
 
   pajeCreateContainer(MSG_get_clock(), category, type, parent_category, category);
@@ -174,6 +177,7 @@ void TRACE_create_category (const char *category,
   if (IS_TRACING_PLATFORM) pajeDefineVariableType (state, "HOST", state);
 
   xbt_dict_set (created_categories, category, xbt_strdup("1"), xbt_free);
   if (IS_TRACING_PLATFORM) pajeDefineVariableType (state, "HOST", state);
 
   xbt_dict_set (created_categories, category, xbt_strdup("1"), xbt_free);
+  return 0;
 }
 
 void TRACE_set_mask (int mask)
 }
 
 void TRACE_set_mask (int mask)