Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] checking if the user created the environment previously
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Dec 2010 16:44:38 +0000 (16:44 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Dec 2010 16:44:38 +0000 (16:44 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9170 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/instr/instr_interface.c
src/instr/instr_variables.c

index 56cfd6a..a32e80c 100644 (file)
@@ -28,6 +28,12 @@ void TRACE_category_with_color (const char *category, const char *color)
   if (!TRACE_is_active())
     return;
 
   if (!TRACE_is_active())
     return;
 
+  {
+    //check if hosts have been created
+    xbt_assert1 (hosts_types != NULL && xbt_dict_length(hosts_types) != 0,
+        "%s must be called after environment creation", __FUNCTION__);
+  }
+
   //check if category is already created
   char *created = xbt_dict_get_or_null(created_categories, category);
   if (created) return;
   //check if category is already created
   char *created = xbt_dict_get_or_null(created_categories, category);
   if (created) return;
index f7c497e..8cd1703 100644 (file)
@@ -61,6 +61,12 @@ void TRACE_user_host_variable(double time, const char *variable,
   snprintf(valuestr, 100, "%g", value);
 
   if (strcmp(what, "declare") == 0) {
   snprintf(valuestr, 100, "%g", value);
 
   if (strcmp(what, "declare") == 0) {
+    {
+      //check if hosts have been created
+      xbt_assert1 (hosts_types != NULL && xbt_dict_length(hosts_types) != 0,
+          "%s must be called after environment creation", __FUNCTION__);
+    }
+
     char new_type[INSTR_DEFAULT_STR_SIZE];
     xbt_dict_cursor_t cursor = NULL;
     char *type;
     char new_type[INSTR_DEFAULT_STR_SIZE];
     xbt_dict_cursor_t cursor = NULL;
     char *type;