Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] cosmetics, remove TRACE_is_active, use TRACE_is_enabled instead
authorLucas Schnorr <Lucas.Schnorr@inf.ufrgs.br>
Tue, 24 May 2011 12:29:45 +0000 (14:29 +0200)
committerLucas Schnorr <Lucas.Schnorr@inf.ufrgs.br>
Tue, 24 May 2011 12:42:26 +0000 (14:42 +0200)
14 files changed:
src/instr/instr_config.c
src/instr/instr_interface.c
src/instr/instr_msg_task.c
src/instr/instr_private.h
src/instr/instr_resource_utilization.c
src/instr/instr_simdag.c
src/instr/instr_smx.c
src/instr/instr_surf.c
src/msg/msg_mailbox.c
src/surf/cpu.c
src/surf/cpu_im.c
src/surf/network.c
src/surf/network_gtnets.c
src/surf/network_im.c

index 640837e..1bd308f 100644 (file)
@@ -73,7 +73,9 @@ int TRACE_start()
   TRACE_paje_start();
 
   /* activate trace */
   TRACE_paje_start();
 
   /* activate trace */
-  TRACE_activate ();
+  xbt_assert (trace_active==0, "Tracing is already active.");
+  trace_active = 1;
+  XBT_DEBUG ("Tracing is on");
 
   /* other trace initialization */
   created_categories = xbt_dict_new();
 
   /* other trace initialization */
   created_categories = xbt_dict_new();
@@ -84,7 +86,7 @@ int TRACE_start()
 
 int TRACE_end()
 {
 
 int TRACE_end()
 {
-  if (!TRACE_is_active())
+  if (!trace_active)
     return 1;
 
   /* generate uncategorized graph configuration for triva */
     return 1;
 
   /* generate uncategorized graph configuration for triva */
@@ -107,28 +109,11 @@ int TRACE_end()
   /* close the trace file */
   TRACE_paje_end();
 
   /* close the trace file */
   TRACE_paje_end();
 
-  /* activate trace */
-  TRACE_desactivate ();
-  XBT_DEBUG("Tracing system is shutdown");
-  return 0;
-}
-
-void TRACE_activate (void)
-{
-  xbt_assert (trace_active==0, "Tracing is already active.");
-  trace_active = 1;
-  XBT_DEBUG ("Tracing is on");
-}
-
-void TRACE_desactivate (void)
-{
+  /* de-activate trace */
   trace_active = 0;
   XBT_DEBUG ("Tracing is off");
   trace_active = 0;
   XBT_DEBUG ("Tracing is off");
-}
-
-int TRACE_is_active (void)
-{
-  return trace_active;
+  XBT_DEBUG("Tracing system is shutdown");
+  return 0;
 }
 
 int TRACE_needs_platform (void)
 }
 
 int TRACE_needs_platform (void)
index 5c228a8..12966a6 100644 (file)
@@ -27,7 +27,7 @@ void TRACE_category(const char *category)
 
 void TRACE_category_with_color (const char *category, const char *color)
 {
 
 void TRACE_category_with_color (const char *category, const char *color)
 {
-  if (!(TRACE_is_active() && category != NULL))
+  if (!(TRACE_categorized() && category != NULL))
     return;
 
   xbt_assert (instr_platform_traced(),
     return;
 
   xbt_assert (instr_platform_traced(),
@@ -53,14 +53,12 @@ void TRACE_category_with_color (const char *category, const char *color)
   XBT_DEBUG("CAT,declare %s, %s", category, final_color);
 
   //define the type of this category on top of hosts and links
   XBT_DEBUG("CAT,declare %s, %s", category, final_color);
 
   //define the type of this category on top of hosts and links
-  if (TRACE_categorized ()){
-    instr_new_variable_type (category, final_color);
-  }
+  instr_new_variable_type (category, final_color);
 }
 
 void TRACE_declare_mark(const char *mark_type)
 {
 }
 
 void TRACE_declare_mark(const char *mark_type)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_is_enabled())
     return;
   if (!mark_type)
     return;
     return;
   if (!mark_type)
     return;
@@ -71,7 +69,7 @@ void TRACE_declare_mark(const char *mark_type)
 
 void TRACE_mark(const char *mark_type, const char *mark_value)
 {
 
 void TRACE_mark(const char *mark_type, const char *mark_value)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_is_enabled())
     return;
   if (!mark_type || !mark_value)
     return;
     return;
   if (!mark_type || !mark_value)
     return;
@@ -89,7 +87,7 @@ static void instr_user_variable(double time,
                          double value,
                          InstrUserVariable what)
 {
                          double value,
                          InstrUserVariable what)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_is_enabled())
     return;
 
   xbt_assert (instr_platform_traced(),
     return;
 
   xbt_assert (instr_platform_traced(),
index c50a5e9..b75039e 100644 (file)
@@ -15,7 +15,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg, instr, "MSG");
  */
 void TRACE_msg_set_task_category(m_task_t task, const char *category)
 {
  */
 void TRACE_msg_set_task_category(m_task_t task, const char *category)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_categorized())
     return;
 
   xbt_assert(task->category == NULL, "Task %p(%s) already has a category (%s).",
     return;
 
   xbt_assert(task->category == NULL, "Task %p(%s) already has a category (%s).",
index fe814c5..bc32e07 100644 (file)
@@ -152,9 +152,6 @@ void TRACE_smpi_recv(int rank, int src, int dst);
 /* from instr_config.c */
 int TRACE_start (void);
 int TRACE_end (void);
 /* from instr_config.c */
 int TRACE_start (void);
 int TRACE_end (void);
-void TRACE_activate (void);
-void TRACE_desactivate (void);
-int TRACE_is_active (void);
 int TRACE_needs_platform (void);
 int TRACE_is_enabled(void);
 int TRACE_platform(void);
 int TRACE_needs_platform (void);
 int TRACE_is_enabled(void);
 int TRACE_platform(void);
index a6b5885..ba5c51b 100644 (file)
@@ -84,10 +84,6 @@ void TRACE_surf_link_set_utilization(const char *resource, smx_action_t smx_acti
                                      double value, double now,
                                      double delta)
 {
                                      double value, double now,
                                      double delta)
 {
-  if (!TRACE_is_active())
-    return;
-  if (!value)
-    return;
   //only trace link utilization if link is known by tracing mechanism
   if (!knownContainerWithName(resource))
     return;
   //only trace link utilization if link is known by tracing mechanism
   if (!knownContainerWithName(resource))
     return;
@@ -126,8 +122,6 @@ void TRACE_surf_host_set_utilization(const char *resource,
                                      double value, double now,
                                      double delta)
 {
                                      double value, double now,
                                      double delta)
 {
-  if (!TRACE_is_active())
-    return;
   //only trace host utilization if host is known by tracing mechanism
   if (!knownContainerWithName(resource))
     return;
   //only trace host utilization if host is known by tracing mechanism
   if (!knownContainerWithName(resource))
     return;
index dc7c556..067b954 100644 (file)
@@ -22,7 +22,7 @@ void TRACE_sd_task_destroy(SD_task_t task)
 
 void TRACE_sd_set_task_category(SD_task_t task, const char *category)
 {
 
 void TRACE_sd_set_task_category(SD_task_t task, const char *category)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_is_enabled())
     return;
   task->category = xbt_strdup (category);
 }
     return;
   task->category = xbt_strdup (category);
 }
index c9c0bb9..4bc2df0 100644 (file)
@@ -12,19 +12,19 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_simix, instr, "Tracing Simix");
 
 void TRACE_smx_host_execute(smx_action_t act)
 {
 
 void TRACE_smx_host_execute(smx_action_t act)
 {
-  if (!TRACE_is_active()) return;
+  if (!TRACE_is_enabled()) return;
   return;
 }
 
 void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc)
 {
   return;
 }
 
 void TRACE_smx_action_communicate(smx_action_t act, smx_process_t proc)
 {
-  if (!TRACE_is_active()) return;
+  if (!TRACE_is_enabled()) return;
   return;
 }
 
 void TRACE_smx_action_destroy(smx_action_t act)
 {
   return;
 }
 
 void TRACE_smx_action_destroy(smx_action_t act)
 {
-  if (!TRACE_is_active()) return;
+  if (!TRACE_is_enabled()) return;
   return;
 }
 
   return;
 }
 
index de520c9..73926c9 100644 (file)
@@ -24,7 +24,7 @@ void TRACE_surf_release(void)
 
 void TRACE_surf_host_set_power(double date, const char *resource, double power)
 {
 
 void TRACE_surf_host_set_power(double date, const char *resource, double power)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_is_enabled())
     return;
 
   container_t container = getContainerByName(resource);
     return;
 
   container_t container = getContainerByName(resource);
@@ -34,7 +34,7 @@ void TRACE_surf_host_set_power(double date, const char *resource, double power)
 
 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth)
 {
 
 void TRACE_surf_link_set_bandwidth(double date, const char *resource, double bandwidth)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_is_enabled())
     return;
 
   container_t container = getContainerByName(resource);
     return;
 
   container_t container = getContainerByName(resource);
@@ -45,7 +45,7 @@ void TRACE_surf_link_set_bandwidth(double date, const char *resource, double ban
 //FIXME: this function is not used (latency availability traces support exists in surf network models?)
 void TRACE_surf_link_set_latency(double date, const char *resource, double latency)
 {
 //FIXME: this function is not used (latency availability traces support exists in surf network models?)
 void TRACE_surf_link_set_latency(double date, const char *resource, double latency)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_is_enabled())
     return;
 
   container_t container = getContainerByName(resource);
     return;
 
   container_t container = getContainerByName(resource);
@@ -70,7 +70,7 @@ void TRACE_surf_gtnets_destroy(void *action)
 
 void TRACE_surf_action(surf_action_t surf_action, const char *category)
 {
 
 void TRACE_surf_action(surf_action_t surf_action, const char *category)
 {
-  if (!TRACE_is_active())
+  if (!TRACE_is_enabled())
     return;
   if (!TRACE_categorized ())
     return;
     return;
   if (!TRACE_categorized ())
     return;
index cd5990b..3f015f1 100644 (file)
@@ -158,7 +158,7 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
   /* Try to send it by calling SIMIX network layer */
   TRY {
 #ifdef HAVE_TRACING
   /* Try to send it by calling SIMIX network layer */
   TRY {
 #ifdef HAVE_TRACING
-    if (TRACE_is_active()) {
+    if (TRACE_is_enabled()) {
       comm = SIMIX_req_comm_isend(mailbox, t_simdata->message_size,
                                   t_simdata->rate, task, sizeof(void *),
                                   NULL, NULL, 0);
       comm = SIMIX_req_comm_isend(mailbox, t_simdata->message_size,
                                   t_simdata->rate, task, sizeof(void *),
                                   NULL, NULL, 0);
index ee98eed..1a86a63 100644 (file)
@@ -201,7 +201,7 @@ static void cpu_update_actions_state(double now, double delta)
 
   xbt_swag_foreach_safe(action, next_action, running_actions) {
 #ifdef HAVE_TRACING
 
   xbt_swag_foreach_safe(action, next_action, running_actions) {
 #ifdef HAVE_TRACING
-    if (TRACE_is_active()) {
+    if (TRACE_is_enabled()) {
       cpu_Cas01_t x =
         lmm_constraint_id(lmm_get_cnst_from_var
                           (cpu_maxmin_system, action->variable, 0));
       cpu_Cas01_t x =
         lmm_constraint_id(lmm_get_cnst_from_var
                           (cpu_maxmin_system, action->variable, 0));
index 327469d..19f1743 100644 (file)
@@ -234,7 +234,7 @@ static void cpu_im_update_remains(cpu_Cas01_im_t cpu, double now)
                                           (action).variable) * (now -
                                                                 cpu->last_update));
 #ifdef HAVE_TRACING
                                           (action).variable) * (now -
                                                                 cpu->last_update));
 #ifdef HAVE_TRACING
-      if (TRACE_is_active()) {
+      if (TRACE_is_enabled()) {
         TRACE_surf_host_set_utilization(cpu->generic_resource.name,
                                         action->
                                         generic_lmm_action.generic_action.
         TRACE_surf_host_set_utilization(cpu->generic_resource.name,
                                         action->
                                         generic_lmm_action.generic_action.
@@ -327,7 +327,7 @@ static void cpu_im_update_actions_state(double now, double delta)
     GENERIC_ACTION(action).finish = surf_get_clock();
     /* set the remains to 0 due to precision problems when updating the remaining amount */
 #ifdef HAVE_TRACING
     GENERIC_ACTION(action).finish = surf_get_clock();
     /* set the remains to 0 due to precision problems when updating the remaining amount */
 #ifdef HAVE_TRACING
-    if (TRACE_is_active()) {
+    if (TRACE_is_enabled()) {
       cpu_Cas01_im_t cpu = ((cpu_Cas01_im_t)(action->cpu));
       TRACE_surf_host_set_utilization(cpu->generic_resource.name,
           action->generic_lmm_action.generic_action.data,
       cpu_Cas01_im_t cpu = ((cpu_Cas01_im_t)(action->cpu));
       TRACE_surf_host_set_utilization(cpu->generic_resource.name,
           action->generic_lmm_action.generic_action.data,
@@ -342,7 +342,7 @@ static void cpu_im_update_actions_state(double now, double delta)
     cpu_im_update_remains(action->cpu, surf_get_clock());
   }
 #ifdef HAVE_TRACING
     cpu_im_update_remains(action->cpu, surf_get_clock());
   }
 #ifdef HAVE_TRACING
-  if (TRACE_is_active()) {
+  if (TRACE_is_enabled()) {
     //defining the last timestamp that we can safely dump to trace file
     //without losing the event ascending order (considering all CPU's)
     void **data;
     //defining the last timestamp that we can safely dump to trace file
     //without losing the event ascending order (considering all CPU's)
     void **data;
index b294a4c..c8649e1 100644 (file)
@@ -437,7 +437,7 @@ static void net_update_actions_state(double now, double delta)
                                    action->weight);
     }
 #ifdef HAVE_TRACING
                                    action->weight);
     }
 #ifdef HAVE_TRACING
-    if (TRACE_is_active()) {
+    if (TRACE_is_enabled()) {
       xbt_dynar_t route = global_routing->get_route(action->src_name,
                                                     action->dst_name);
       link_CM02_t link;
       xbt_dynar_t route = global_routing->get_route(action->src_name,
                                                     action->dst_name);
       link_CM02_t link;
@@ -732,7 +732,7 @@ static surf_action_t net_communicate(const char *src_name,
   /* LARGE PLATFORMS HACK:
      expand also with src->link and dst->link */
 #ifdef HAVE_TRACING
   /* LARGE PLATFORMS HACK:
      expand also with src->link and dst->link */
 #ifdef HAVE_TRACING
-  if (TRACE_is_active()) {
+  if (TRACE_is_enabled()) {
     action->src_name = xbt_strdup(src_name);
     action->dst_name = xbt_strdup(dst_name);
   } else {
     action->src_name = xbt_strdup(src_name);
     action->dst_name = xbt_strdup(dst_name);
   } else {
index ad0cef7..e8891fd 100644 (file)
@@ -298,7 +298,7 @@ static void update_actions_state(double now, double delta)
              action->generic_action.remains);
 
 #ifdef HAVE_TRACING
              action->generic_action.remains);
 
 #ifdef HAVE_TRACING
-      if (TRACE_is_active()) {
+      if (TRACE_is_enabled()) {
         double last_amount_sent = (action->generic_action.cost - action->last_remains);
         double amount_sent = (action->generic_action.cost - action->generic_action.remains);
 
         double last_amount_sent = (action->generic_action.cost - action->last_remains);
         double amount_sent = (action->generic_action.cost - action->generic_action.remains);
 
index 38513f4..b5ba625 100644 (file)
@@ -781,7 +781,7 @@ static surf_action_t im_net_communicate(const char *src_name,
   /* LARGE PLATFORMS HACK:
      expand also with src->link and dst->link */
 #ifdef HAVE_TRACING
   /* LARGE PLATFORMS HACK:
      expand also with src->link and dst->link */
 #ifdef HAVE_TRACING
-  if (TRACE_is_active()) {
+  if (TRACE_is_enabled()) {
     action->src_name = xbt_strdup(src_name);
     action->dst_name = xbt_strdup(dst_name);
   } else {
     action->src_name = xbt_strdup(src_name);
     action->dst_name = xbt_strdup(dst_name);
   } else {