Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
new variable for surf_action_t to contain its tracing category
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 8 Oct 2010 16:00:10 +0000 (16:00 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 8 Oct 2010 16:00:10 +0000 (16:00 +0000)
details:
- and function to set it (to be used by forthcoming modifications)
- xbt_free to release in all action_unref of instrumented models

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

src/include/surf/surf.h
src/instr/private.h
src/instr/surf_instr.c
src/surf/cpu.c
src/surf/cpu_im.c
src/surf/network.c
src/surf/network_gtnets.c
src/surf/network_vivaldi.c
src/surf/surf_action.c

index 58fe9f5..1c50601 100644 (file)
@@ -83,6 +83,9 @@ XBT_PUBLIC(void) model_help(const char* category, s_surf_model_description_t * t
        void *data;              /**< for your convenience */
        int refcount;
        surf_model_t model_type;
+#ifdef HAVE_TRACING
+       char *category;          /**< tracing category for categorized resource utilization monitoring */
+#endif
      } s_surf_action_t;
 
      typedef struct surf_action_lmm {
index af9692d..97bb8c9 100644 (file)
@@ -109,6 +109,7 @@ void TRACE_surf_link_set_bandwidth (double date, void *link, double bandwidth);
 void TRACE_surf_link_set_latency (double date, void *link, double latency);
 void TRACE_surf_save_onelink (void);
 int TRACE_surf_link_is_traced (void *link);
+void TRACE_surf_action (surf_action_t surf_action, const char *category);
 
 //for tracing gtnets
 void TRACE_surf_gtnets_communicate (void *action, int src, int dst);
index 5e1573d..bc89131 100644 (file)
@@ -232,4 +232,13 @@ int TRACE_surf_link_is_traced (void *link)
   }
 }
 
+void TRACE_surf_action (surf_action_t surf_action, const char *category)
+{
+  if (!IS_TRACING_PLATFORM) return;
+  if (!category){
+    xbt_die ("invalid tracing category");
+  }
+  surf_action->category = xbt_new (char, strlen (category)+1);
+  strncpy (surf_action->category, category, strlen(category)+1);
+}
 #endif
index b55c297..e36b315 100644 (file)
@@ -151,6 +151,9 @@ static int cpu_action_unref(surf_action_t action)
     if (((surf_action_cpu_Cas01_t) action)->variable)
       lmm_variable_free(cpu_maxmin_system,
                         ((surf_action_cpu_Cas01_t) action)->variable);
+#ifdef HAVE_TRACING
+    if (action->category) xbt_free (action->category);
+#endif
     free(action);
     return 1;
   }
index 66faee8..d5196dc 100644 (file)
@@ -175,6 +175,9 @@ static int cpu_im_action_unref(surf_action_t action)
     xbt_swag_remove(action,
                     ((cpu_Cas01_im_t) ACTION_GET_CPU(action))->action_set);
     xbt_swag_insert(ACTION_GET_CPU(action), cpu_im_modified_cpu);
+#ifdef HAVE_TRACING
+    if (action->category) xbt_free (action->category);
+#endif
     free(action);
     return 1;
   }
index ceb9713..49046b6 100644 (file)
@@ -258,6 +258,7 @@ static int net_action_unref(surf_action_t action)
 #ifdef HAVE_TRACING
     xbt_free (((surf_action_network_CM02_t)action)->src_name);
     xbt_free (((surf_action_network_CM02_t)action)->dst_name);
+    if (action->category) xbt_free (action->category);
 #endif
     free(action);
     return 1;
index 7076f77..ea448bd 100644 (file)
@@ -179,6 +179,9 @@ static int action_unref(surf_action_t action)
   action->refcount--;
   if (!action->refcount) {
     xbt_swag_remove(action, action->state_set);
+#ifdef HAVE_TRACING
+    if (action->category) xbt_free (action->category);
+#endif
     free(action);
     return 1;
   }
index c25b582..5698b44 100644 (file)
@@ -46,6 +46,9 @@ static int netviva_action_unref(surf_action_t action)
   action->refcount--;
   if (!action->refcount) {
     xbt_swag_remove(action, action->state_set);
+#ifdef HAVE_TRACING
+    if (action->category) xbt_free (action->category);
+#endif
     free(action);
     return 1;
   }
index 7a5734d..f3768b3 100644 (file)
@@ -33,6 +33,9 @@ void *surf_action_new(size_t size, double cost, surf_model_t model,
   action->start = surf_get_clock();
   action->finish = -1.0;
   action->model_type = model;
+#ifdef HAVE_TRACING
+  action->category = NULL;
+#endif
 
   if (failed)
     action->state_set = model->states.failed_action_set;