From: schnorr Date: Fri, 8 Oct 2010 16:00:10 +0000 (+0000) Subject: new variable for surf_action_t to contain its tracing category X-Git-Tag: v3_5~439 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/db9bb6fbdfaff4b3e37b928582aa4db0781a6534?hp=d0f997f274ef5e11f6df4ff39926e7ba493ebffa new variable for surf_action_t to contain its tracing category 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 --- diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 58fe9f5d8b..1c506017ef 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -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 { diff --git a/src/instr/private.h b/src/instr/private.h index af9692d735..97bb8c93b8 100644 --- a/src/instr/private.h +++ b/src/instr/private.h @@ -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); diff --git a/src/instr/surf_instr.c b/src/instr/surf_instr.c index 5e1573d0aa..bc8913145a 100644 --- a/src/instr/surf_instr.c +++ b/src/instr/surf_instr.c @@ -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 diff --git a/src/surf/cpu.c b/src/surf/cpu.c index b55c297ae5..e36b315e8e 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -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; } diff --git a/src/surf/cpu_im.c b/src/surf/cpu_im.c index 66faee8c06..d5196dc5a7 100644 --- a/src/surf/cpu_im.c +++ b/src/surf/cpu_im.c @@ -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; } diff --git a/src/surf/network.c b/src/surf/network.c index ceb9713694..49046b63c7 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -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; diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index 7076f77760..ea448bd73e 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -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; } diff --git a/src/surf/network_vivaldi.c b/src/surf/network_vivaldi.c index c25b58239c..5698b44501 100644 --- a/src/surf/network_vivaldi.c +++ b/src/surf/network_vivaldi.c @@ -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; } diff --git a/src/surf/surf_action.c b/src/surf/surf_action.c index 7a5734dab3..f3768b310e 100644 --- a/src/surf/surf_action.c +++ b/src/surf/surf_action.c @@ -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;