Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
trace cosmetics
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 1 Oct 2010 15:20:45 +0000 (15:20 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 1 Oct 2010 15:20:45 +0000 (15:20 +0000)
details:
- remove "__" from beginning of some functions name
- making some functions static
- moving a function to other file, making it static

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

src/instr/interface.c
src/instr/private.h
src/instr/resource_utilization.c
src/instr/surf_instr.c

index 7c42143..d8f0bf8 100644 (file)
@@ -90,7 +90,7 @@ int TRACE_start ()
   created_categories = xbt_dict_new();
   __TRACE_msg_init();
   __TRACE_category_init ();
   created_categories = xbt_dict_new();
   __TRACE_msg_init();
   __TRACE_category_init ();
-  __TRACE_surf_init();
+  TRACE_surf_init();
   __TRACE_msg_process_init ();
   __TRACE_smpi_init ();
 
   __TRACE_msg_process_init ();
   __TRACE_smpi_init ();
 
index eefc370..ca7b704 100644 (file)
@@ -109,10 +109,8 @@ void TRACE_smx_action_communicate (smx_action_t act, smx_process_t proc);
 void TRACE_smx_action_destroy (smx_action_t act);
 
 /* from surf.c */
 void TRACE_smx_action_destroy (smx_action_t act);
 
 /* from surf.c */
-void __TRACE_surf_init (void);
-void __TRACE_surf_finalize (void);
-void __TRACE_surf_check_variable_set_to_zero (double now, const char *variable, const char *resource);
-void __TRACE_surf_set_resource_variable (double date, const char *variable, const char *resource, double value);
+void TRACE_surf_init (void);
+void TRACE_surf_finalize (void);
 void TRACE_surf_host_declaration (char *name, double power);
 void TRACE_surf_host_set_power (double date, char *resource, double power);
 void TRACE_surf_host_define_id (const char *name, int host_id);
 void TRACE_surf_host_declaration (char *name, double power);
 void TRACE_surf_host_set_power (double date, char *resource, double power);
 void TRACE_surf_host_define_id (const char *name, int host_id);
index afb26ee..ef31072 100644 (file)
@@ -10,6 +10,9 @@
 
 #define VARIABLE_SEPARATOR '#'
 
 
 #define VARIABLE_SEPARATOR '#'
 
+//to check if variables were previously set to 0, otherwise paje won't simulate them
+static xbt_dict_t platform_variables; /* host or link name -> array of categories */
+
 //B
 static xbt_dict_t method_b_dict;
 
 //B
 static xbt_dict_t method_b_dict;
 
@@ -58,6 +61,35 @@ static void __TRACE_define_method (char *method)
   }
 }
 
   }
 }
 
+//used by all methods
+static void __TRACE_surf_check_variable_set_to_zero (double now, const char *variable, const char *resource)
+{
+  /* check if we have to set it to 0 */
+  if (!xbt_dict_get_or_null (platform_variables, resource)){
+    xbt_dynar_t array = xbt_dynar_new(sizeof(char*), xbt_free);
+    char *var_cpy = xbt_strdup(variable);
+    xbt_dynar_push (array, &var_cpy);
+    if (IS_TRACING_PLATFORM) pajeSetVariable (now, variable, resource, "0");
+    xbt_dict_set (platform_variables, resource, array, xbt_dynar_free_voidp);
+  }else{
+    xbt_dynar_t array = xbt_dict_get (platform_variables, resource);
+    unsigned int i;
+    char* cat;
+    int flag = 0;
+    xbt_dynar_foreach (array, i, cat) {
+      if (strcmp(variable, cat)==0){
+        flag = 1;
+      }
+    }
+    if (flag==0){
+      char *var_cpy = xbt_strdup(variable);
+      xbt_dynar_push (array, &var_cpy);
+      if (IS_TRACING_PLATFORM) pajeSetVariable (now, variable, resource, "0");
+    }
+  }
+  /* end of check */
+}
+
 //A
 static void __TRACE_surf_resource_utilization_A (double now, double delta, const char *variable, const char *resource, double value)
 {
 //A
 static void __TRACE_surf_resource_utilization_A (double now, double delta, const char *variable, const char *resource, double value)
 {
@@ -355,6 +387,8 @@ void __TRACE_surf_resource_utilization_event (smx_action_t action, double now, d
 
 void __TRACE_surf_resource_utilization_initialize ()
 {
 
 void __TRACE_surf_resource_utilization_initialize ()
 {
+  platform_variables = xbt_dict_new();
+
   __TRACE_define_method (_TRACE_platform_method());
 
   if (currentMethod == methodA){
   __TRACE_define_method (_TRACE_platform_method());
 
   if (currentMethod == methodA){
index a559cf7..a7b424b 100644 (file)
@@ -14,58 +14,29 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(tracing_surf,tracing,"Tracing Surf");
 
 static xbt_dict_t created_links;
 static xbt_dict_t host_containers;
 
 static xbt_dict_t created_links;
 static xbt_dict_t host_containers;
-static xbt_dict_t platform_variables; /* host or link name -> array of categories */
 static xbt_dict_t resource_variables; /* (host|link)#variable -> value */
 
 /* to trace gtnets */
 static xbt_dict_t gtnets_src; /* %p (action) -> %s */
 static xbt_dict_t gtnets_dst; /* %p (action) -> %s */
 
 static xbt_dict_t resource_variables; /* (host|link)#variable -> value */
 
 /* to trace gtnets */
 static xbt_dict_t gtnets_src; /* %p (action) -> %s */
 static xbt_dict_t gtnets_dst; /* %p (action) -> %s */
 
-void __TRACE_surf_init (void)
+void TRACE_surf_init (void)
 {
   created_links = xbt_dict_new();
 {
   created_links = xbt_dict_new();
-  platform_variables = xbt_dict_new();
   host_containers = xbt_dict_new();
   resource_variables = xbt_dict_new ();
   gtnets_src = xbt_dict_new ();
   gtnets_dst = xbt_dict_new ();
   host_containers = xbt_dict_new();
   resource_variables = xbt_dict_new ();
   gtnets_src = xbt_dict_new ();
   gtnets_dst = xbt_dict_new ();
+
   __TRACE_surf_resource_utilization_initialize();
 }
 
   __TRACE_surf_resource_utilization_initialize();
 }
 
-void __TRACE_surf_finalize (void)
+void TRACE_surf_finalize (void)
 {
   __TRACE_surf_resource_utilization_finalize();
 }
 
 {
   __TRACE_surf_resource_utilization_finalize();
 }
 
-void __TRACE_surf_check_variable_set_to_zero (double now, const char *variable, const char *resource)
-{
-  /* check if we have to set it to 0 */
-  if (!xbt_dict_get_or_null (platform_variables, resource)){
-    xbt_dynar_t array = xbt_dynar_new(sizeof(char*), xbt_free);
-    char *var_cpy = xbt_strdup(variable);
-    xbt_dynar_push (array, &var_cpy);
-    if (IS_TRACING_PLATFORM) pajeSetVariable (now, variable, resource, "0");
-    xbt_dict_set (platform_variables, resource, array, xbt_dynar_free_voidp);
-  }else{
-    xbt_dynar_t array = xbt_dict_get (platform_variables, resource);
-    unsigned int i;
-    char* cat;
-    int flag = 0;
-    xbt_dynar_foreach (array, i, cat) {
-      if (strcmp(variable, cat)==0){
-        flag = 1;
-      }
-    }
-    if (flag==0){
-      char *var_cpy = xbt_strdup(variable);
-      xbt_dynar_push (array, &var_cpy);
-      if (IS_TRACING_PLATFORM) pajeSetVariable (now, variable, resource, "0");
-    }
-  }
-  /* end of check */
-}
-
-void __TRACE_surf_set_resource_variable (double date, const char *variable, const char *resource, double value)
+static void __TRACE_surf_set_resource_variable (double date, const char *variable, const char *resource, double value)
 {
        char aux[100], key[100];
        char *last_value = NULL;
 {
        char aux[100], key[100];
        char *last_value = NULL;
@@ -203,7 +174,7 @@ void TRACE_msg_clean (void)
 {
   char *key, *value;
   xbt_dict_cursor_t cursor = NULL;
 {
   char *key, *value;
   xbt_dict_cursor_t cursor = NULL;
-  __TRACE_surf_finalize();
+  TRACE_surf_finalize();
 
   /* get all host from host_containers */
   xbt_dict_foreach(host_containers, cursor, key, value) {
 
   /* get all host from host_containers */
   xbt_dict_foreach(host_containers, cursor, key, value) {