From: Lucas Schnorr Date: Tue, 24 May 2011 12:29:45 +0000 (+0200) Subject: [trace] cosmetics, remove TRACE_is_active, use TRACE_is_enabled instead X-Git-Tag: v3_6_rc3~14^2~4 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9a36fae38fd6af831308861de666cc06a4fe89da [trace] cosmetics, remove TRACE_is_active, use TRACE_is_enabled instead --- diff --git a/src/instr/instr_config.c b/src/instr/instr_config.c index 640837e9ab..1bd308f42c 100644 --- a/src/instr/instr_config.c +++ b/src/instr/instr_config.c @@ -73,7 +73,9 @@ int TRACE_start() 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(); @@ -84,7 +86,7 @@ int TRACE_start() int TRACE_end() { - if (!TRACE_is_active()) + if (!trace_active) return 1; /* generate uncategorized graph configuration for triva */ @@ -107,28 +109,11 @@ int TRACE_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"); -} - -int TRACE_is_active (void) -{ - return trace_active; + XBT_DEBUG("Tracing system is shutdown"); + return 0; } int TRACE_needs_platform (void) diff --git a/src/instr/instr_interface.c b/src/instr/instr_interface.c index 5c228a83aa..12966a6ccb 100644 --- a/src/instr/instr_interface.c +++ b/src/instr/instr_interface.c @@ -27,7 +27,7 @@ void TRACE_category(const char *category) 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(), @@ -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 - 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) { - if (!TRACE_is_active()) + if (!TRACE_is_enabled()) 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) { - if (!TRACE_is_active()) + if (!TRACE_is_enabled()) return; if (!mark_type || !mark_value) return; @@ -89,7 +87,7 @@ static void instr_user_variable(double time, double value, InstrUserVariable what) { - if (!TRACE_is_active()) + if (!TRACE_is_enabled()) return; xbt_assert (instr_platform_traced(), diff --git a/src/instr/instr_msg_task.c b/src/instr/instr_msg_task.c index c50a5e9475..b75039ea12 100644 --- a/src/instr/instr_msg_task.c +++ b/src/instr/instr_msg_task.c @@ -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) { - if (!TRACE_is_active()) + if (!TRACE_categorized()) return; xbt_assert(task->category == NULL, "Task %p(%s) already has a category (%s).", diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index fe814c5b6a..bc32e07f7c 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -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); -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); diff --git a/src/instr/instr_resource_utilization.c b/src/instr/instr_resource_utilization.c index a6b588502b..ba5c51b503 100644 --- a/src/instr/instr_resource_utilization.c +++ b/src/instr/instr_resource_utilization.c @@ -84,10 +84,6 @@ void TRACE_surf_link_set_utilization(const char *resource, smx_action_t smx_acti 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; @@ -126,8 +122,6 @@ void TRACE_surf_host_set_utilization(const char *resource, 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; diff --git a/src/instr/instr_simdag.c b/src/instr/instr_simdag.c index dc7c556029..067b954410 100644 --- a/src/instr/instr_simdag.c +++ b/src/instr/instr_simdag.c @@ -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) { - if (!TRACE_is_active()) + if (!TRACE_is_enabled()) return; task->category = xbt_strdup (category); } diff --git a/src/instr/instr_smx.c b/src/instr/instr_smx.c index c9c0bb9b0b..4bc2df01f0 100644 --- a/src/instr/instr_smx.c +++ b/src/instr/instr_smx.c @@ -12,19 +12,19 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_simix, instr, "Tracing Simix"); 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) { - if (!TRACE_is_active()) return; + if (!TRACE_is_enabled()) return; return; } void TRACE_smx_action_destroy(smx_action_t act) { - if (!TRACE_is_active()) return; + if (!TRACE_is_enabled()) return; return; } diff --git a/src/instr/instr_surf.c b/src/instr/instr_surf.c index de520c9112..73926c9050 100644 --- a/src/instr/instr_surf.c +++ b/src/instr/instr_surf.c @@ -24,7 +24,7 @@ void TRACE_surf_release(void) 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); @@ -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) { - if (!TRACE_is_active()) + if (!TRACE_is_enabled()) 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) { - if (!TRACE_is_active()) + if (!TRACE_is_enabled()) 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) { - if (!TRACE_is_active()) + if (!TRACE_is_enabled()) return; if (!TRACE_categorized ()) return; diff --git a/src/msg/msg_mailbox.c b/src/msg/msg_mailbox.c index cd5990b3cb..3f015f1e24 100644 --- a/src/msg/msg_mailbox.c +++ b/src/msg/msg_mailbox.c @@ -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 - 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); diff --git a/src/surf/cpu.c b/src/surf/cpu.c index ee98eed906..1a86a63c3f 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -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 - 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)); diff --git a/src/surf/cpu_im.c b/src/surf/cpu_im.c index 327469dd0a..19f1743728 100644 --- a/src/surf/cpu_im.c +++ b/src/surf/cpu_im.c @@ -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 - if (TRACE_is_active()) { + if (TRACE_is_enabled()) { 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 - 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, @@ -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 - 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; diff --git a/src/surf/network.c b/src/surf/network.c index b294a4c9a7..c8649e155e 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -437,7 +437,7 @@ static void net_update_actions_state(double now, double delta) 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; @@ -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 - if (TRACE_is_active()) { + if (TRACE_is_enabled()) { action->src_name = xbt_strdup(src_name); action->dst_name = xbt_strdup(dst_name); } else { diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index ad0cef7338..e8891fdbb2 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -298,7 +298,7 @@ static void update_actions_state(double now, double delta) 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); diff --git a/src/surf/network_im.c b/src/surf/network_im.c index 38513f4e6f..b5ba6253f1 100644 --- a/src/surf/network_im.c +++ b/src/surf/network_im.c @@ -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 - if (TRACE_is_active()) { + if (TRACE_is_enabled()) { action->src_name = xbt_strdup(src_name); action->dst_name = xbt_strdup(dst_name); } else {