Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] checking if platform is traced in tracing API
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Dec 2010 16:45:00 +0000 (16:45 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Dec 2010 16:45:00 +0000 (16:45 +0000)
details:
- for the features that need a known platform to work

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9192 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/instr/instr_interface.c
src/instr/instr_private.h
src/instr/instr_routing.c
src/instr/instr_variables.c

index 2b03005..6c547ee 100644 (file)
@@ -23,12 +23,9 @@ void TRACE_category_with_color (const char *category, const char *color)
 {
   if (!TRACE_is_active())
     return;
-//
-//  {
-//    //check if hosts have been created
-//    xbt_assert1 (allHostTypes != NULL && xbt_dict_length(allHostTypes) != 0,
-//        "%s must be called after environment creation", __FUNCTION__);
-//  }
+
+  xbt_assert1 (instr_platform_traced(),
+      "%s must be called after environment creation", __FUNCTION__);
 
   //check if category is already created
   char *created = xbt_dict_get_or_null(created_categories, category);
index c8faa85..051fb32 100644 (file)
@@ -187,6 +187,7 @@ void instr_destroy_platform (void);
 void instr_new_user_variable_type (const char *new_typename, const char *color);
 void instr_new_user_link_variable_type  (const char *new_typename, const char *color);
 void instr_new_user_host_variable_type  (const char *new_typename, const char *color);
+int instr_platform_traced (void);
 
 #endif /* HAVE_TRACING */
 #endif /* INSTR_PRIVATE_H_ */
index 03663d5..3ed7eed 100644 (file)
@@ -47,6 +47,7 @@ typedef struct s_container {
   xbt_dict_t children;
 }s_container_t;
 
+static int platform_created = 0;            /* indicate whether the platform file has been traced */
 static type_t rootType = NULL;              /* the root type */
 static container_t rootContainer = NULL;    /* the root container */
 static xbt_dynar_t currentContainer = NULL; /* push and pop, used only in creation */
@@ -456,6 +457,7 @@ static void instr_routing_parse_end_platform ()
 {
   currentContainer = NULL;
   recursiveGraphExtraction (rootContainer);
+  platform_created = 1;
 }
 
 /*
@@ -584,5 +586,10 @@ void instr_new_user_host_variable_type  (const char *new_typename, const char *c
   recursiveNewUserHostVariableType (new_typename, color, rootType);
 }
 
+int instr_platform_traced ()
+{
+  return platform_created;
+}
+
 #endif /* HAVE_TRACING */
 
index 7e894f7..608186b 100644 (file)
@@ -17,6 +17,9 @@ void TRACE_user_link_variable(double time, const char *resource,
   if (!TRACE_is_active())
     return;
 
+  xbt_assert1 (instr_platform_traced(),
+      "%s must be called after environment creation", __FUNCTION__);
+
   char valuestr[100];
   snprintf(valuestr, 100, "%g", value);
 
@@ -41,6 +44,9 @@ void TRACE_user_host_variable(double time, const char *variable,
   if (!TRACE_is_active())
     return;
 
+  xbt_assert1 (instr_platform_traced(),
+      "%s must be called after environment creation", __FUNCTION__);
+
   char valuestr[100];
   snprintf(valuestr, 100, "%g", value);