From: schnorr Date: Fri, 3 Dec 2010 10:40:24 +0000 (+0000) Subject: [trace] do not rely on preprocessor constants to control what is traced (part 1) X-Git-Tag: v3.6_beta2~947 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/24a9a43343e8bb1e6ae073d8a480de24ffcf4d2f [trace] do not rely on preprocessor constants to control what is traced (part 1) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8975 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/instr/instr_interface.c b/src/instr/instr_interface.c index a9ad190612..1c5f19ed5b 100644 --- a/src/instr/instr_interface.c +++ b/src/instr/instr_interface.c @@ -55,35 +55,35 @@ int TRACE_start() pajeDefineEventType("source", "LINK", "source"); pajeDefineEventType("destination", "LINK", "destination"); - if (IS_TRACING_PLATFORM) { + if (TRACE_platform_is_enabled()) { if (TRACE_uncategorized()){ pajeDefineVariableType("power_used", "HOST", "power_used"); pajeDefineVariableType("bandwidth_used", "LINK", "bandwidth_used"); } } - if (IS_TRACING_PROCESSES || IS_TRACING_VOLUME) { + if (TRACE_msg_process_is_enabled() || TRACE_msg_volume_is_enabled()) { //processes grouped by host pajeDefineContainerType("PROCESS", "HOST", "PROCESS"); } - if (IS_TRACING_PROCESSES) { + if (TRACE_msg_process_is_enabled()) { pajeDefineStateType("category", "PROCESS", "category"); pajeDefineStateType("presence", "PROCESS", "presence"); } - if (IS_TRACING_VOLUME) { + if (TRACE_msg_volume_is_enabled()) { pajeDefineLinkType("volume", "0", "PROCESS", "PROCESS", "volume"); } - if (IS_TRACING_TASKS) { + if (TRACE_msg_task_is_enabled()) { //tasks grouped by host pajeDefineContainerType("TASK", "HOST", "TASK"); pajeDefineStateType("category", "TASK", "category"); pajeDefineStateType("presence", "TASK", "presence"); } - if (IS_TRACING_SMPI) { + if (TRACE_smpi_is_enabled()) { if (TRACE_smpi_is_grouped()){ pajeDefineContainerType("MPI_PROCESS", "HOST", "MPI_PROCESS"); }else{ @@ -160,14 +160,14 @@ void TRACE_define_type(const char *type, pajeDefineContainerType(type, parent_type, type); if (final) { //for m_process_t - if (IS_TRACING_PROCESSES) + if (TRACE_msg_process_is_enabled()) pajeDefineContainerType("process", type, "process"); - if (IS_TRACING_PROCESSES) + if (TRACE_msg_process_is_enabled()) pajeDefineStateType("process-state", "process", "process-state"); - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajeDefineContainerType("task", type, "task"); - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajeDefineStateType("task-state", "task", "task-state"); } val_one = xbt_strdup("1"); @@ -224,10 +224,10 @@ int TRACE_create_category_with_color(const char *category, /* for registering application categories on top of platform */ snprintf(state, 100, "b%s", category); - if (IS_TRACING_PLATFORM) + if (TRACE_platform_is_enabled()) pajeDefineVariableTypeWithColor(state, "LINK", state, final_color); snprintf(state, 100, "p%s", category); - if (IS_TRACING_PLATFORM) + if (TRACE_platform_is_enabled()) pajeDefineVariableTypeWithColor(state, "HOST", state, final_color); val_one = xbt_strdup("1"); diff --git a/src/instr/instr_msg_process.c b/src/instr/instr_msg_process.c index f632e27948..9ec328c0a7 100644 --- a/src/instr/instr_msg_process.c +++ b/src/instr/instr_msg_process.c @@ -45,7 +45,7 @@ static void TRACE_msg_process_location(m_process_t process) { char name[200], alias[200]; m_host_t host = NULL; - if (!(IS_TRACING_PROCESSES || IS_TRACING_VOLUME)) + if (!(TRACE_msg_process_is_enabled() || TRACE_msg_volume_is_enabled())) return; host = MSG_process_get_host(process); @@ -56,7 +56,7 @@ static void TRACE_msg_process_location(m_process_t process) if (!xbt_dict_get_or_null(process_containers, alias)) { pajeCreateContainer(MSG_get_clock(), alias, "PROCESS", MSG_host_get_name(host), name); - if (IS_TRACING_PROCESSES) + if (TRACE_msg_process_is_enabled()) pajeSetState(MSG_get_clock(), "category", alias, process->category); xbt_dict_set(process_containers, xbt_strdup(alias), xbt_strdup("1"), xbt_free); @@ -67,7 +67,7 @@ static void TRACE_msg_process_present(m_process_t process) { char alias[200]; m_host_t host = NULL; - if (!IS_TRACING_PROCESSES) + if (!TRACE_msg_process_is_enabled()) return; //updating presence state of this process location @@ -95,9 +95,9 @@ void TRACE_msg_set_process_category(m_process_t process, //create container of type "process" to indicate behavior TRACE_process_container(process, name, 200); - if (IS_TRACING_PROCESSES) + if (TRACE_msg_process_is_enabled()) pajeCreateContainer(MSG_get_clock(), name, "process", category, name); - if (IS_TRACING_PROCESSES) + if (TRACE_msg_process_is_enabled()) pajeSetState(MSG_get_clock(), "process-state", name, "executing"); } @@ -108,12 +108,12 @@ void TRACE_msg_process_change_host(m_process_t process, m_host_t old_host, m_host_t new_host) { char alias[200]; - if (!(IS_TRACING_PROCESSES || IS_TRACING_VOLUME) || !IS_TRACED(process)) + if (!(TRACE_msg_process_is_enabled() || TRACE_msg_volume_is_enabled()) || !IS_TRACED(process)) return; //disabling presence in old_host (__TRACE_msg_process_not_present) TRACE_process_alias_container(process, old_host, alias, 200); - if (IS_TRACING_PROCESSES) + if (TRACE_msg_process_is_enabled()) pajePopState(MSG_get_clock(), "presence", alias); TRACE_msg_process_location(process); @@ -123,7 +123,7 @@ void TRACE_msg_process_change_host(m_process_t process, m_host_t old_host, void TRACE_msg_process_kill(m_process_t process) { char name[200]; - if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) + if (!TRACE_msg_process_is_enabled() || !IS_TRACED(process)) return; TRACE_process_container(process, name, 200); @@ -133,7 +133,7 @@ void TRACE_msg_process_kill(m_process_t process) void TRACE_msg_process_suspend(m_process_t process) { char name[200]; - if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) + if (!TRACE_msg_process_is_enabled() || !IS_TRACED(process)) return; TRACE_process_container(process, name, 200); @@ -143,7 +143,7 @@ void TRACE_msg_process_suspend(m_process_t process) void TRACE_msg_process_resume(m_process_t process) { char name[200]; - if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) + if (!TRACE_msg_process_is_enabled() || !IS_TRACED(process)) return; TRACE_process_container(process, name, 200); @@ -153,7 +153,7 @@ void TRACE_msg_process_resume(m_process_t process) void TRACE_msg_process_sleep_in(m_process_t process) { char name[200]; - if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) + if (!TRACE_msg_process_is_enabled() || !IS_TRACED(process)) return; TRACE_process_container(process, name, 200); @@ -163,7 +163,7 @@ void TRACE_msg_process_sleep_in(m_process_t process) void TRACE_msg_process_sleep_out(m_process_t process) { char name[200]; - if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) + if (!TRACE_msg_process_is_enabled() || !IS_TRACED(process)) return; TRACE_process_container(process, name, 200); @@ -180,9 +180,9 @@ void TRACE_msg_process_end(m_process_t process) host = MSG_process_get_host(process); TRACE_process_container(process, name, 200); TRACE_process_alias_container(process, host, alias, 200); - if (IS_TRACING_PROCESSES) + if (TRACE_msg_process_is_enabled()) pajeDestroyContainer(MSG_get_clock(), "process", name); - if (IS_TRACING_PROCESSES) + if (TRACE_msg_process_is_enabled()) pajeDestroyContainer(MSG_get_clock(), "PROCESS", alias); } diff --git a/src/instr/instr_msg_task.c b/src/instr/instr_msg_task.c index 5dc61c3d21..ae926675e0 100644 --- a/src/instr/instr_msg_task.c +++ b/src/instr/instr_msg_task.c @@ -59,7 +59,7 @@ static void TRACE_task_location(m_task_t task) char *val_one = NULL; m_process_t process = NULL; m_host_t host = NULL; - if (!IS_TRACING_TASKS) + if (!TRACE_msg_task_is_enabled()) return; process = MSG_process_self(); host = MSG_process_get_host(process); @@ -82,7 +82,7 @@ static void TRACE_task_location_present(m_task_t task) char alias[200]; m_process_t process = NULL; m_host_t host = NULL; - if (!IS_TRACING_TASKS) + if (!TRACE_msg_task_is_enabled()) return; //updating presence state of this task location process = MSG_process_self(); @@ -97,7 +97,7 @@ static void TRACE_task_location_not_present(m_task_t task) char alias[200]; m_process_t process = NULL; m_host_t host = NULL; - if (!IS_TRACING_TASKS) + if (!TRACE_msg_task_is_enabled()) return; //updating presence state of this task location process = MSG_process_self(); @@ -126,9 +126,9 @@ void TRACE_msg_set_task_category(m_task_t task, const char *category) TRACE_task_container(task, name, 200); //create container of type "task" to indicate behavior - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajeCreateContainer(MSG_get_clock(), name, "task", category, name); - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajePushState(MSG_get_clock(), "task-state", name, "created"); } @@ -151,7 +151,7 @@ void TRACE_msg_task_execute_start(m_task_t task) return; TRACE_task_container(task, name, 200); - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajePushState(MSG_get_clock(), "task-state", name, "execute"); TRACE_msg_category_set(SIMIX_process_self(), task); @@ -167,7 +167,7 @@ void TRACE_msg_task_execute_end(m_task_t task) return; TRACE_task_container(task, name, 200); - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajePopState(MSG_get_clock(), "task-state", name); TRACE_category_unset(SIMIX_process_self()); @@ -184,7 +184,7 @@ void TRACE_msg_task_destroy(m_task_t task) return; TRACE_task_container(task, name, 200); - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajeDestroyContainer(MSG_get_clock(), "task", name); //finish the location of this task @@ -212,7 +212,7 @@ void TRACE_msg_task_get_end(double start_time, m_task_t task) return; TRACE_task_container(task, name, 200); - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajePopState(MSG_get_clock(), "task-state", name); TRACE_msg_volume_finish(task); @@ -232,9 +232,9 @@ int TRACE_msg_task_put_start(m_task_t task) return 0; TRACE_task_container(task, name, 200); - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajePopState(MSG_get_clock(), "task-state", name); - if (IS_TRACING_TASKS) + if (TRACE_msg_task_is_enabled()) pajePushState(MSG_get_clock(), "task-state", name, "communicate"); TRACE_msg_volume_start(task); diff --git a/src/instr/instr_msg_volume.c b/src/instr/instr_msg_volume.c index 987ca9e066..44a451dad5 100644 --- a/src/instr/instr_msg_volume.c +++ b/src/instr/instr_msg_volume.c @@ -15,7 +15,7 @@ void TRACE_msg_volume_start(m_task_t task) char process_name[200], process_alias[200]; char task_name[200]; double volume = 0; - if (!IS_TRACING_VOLUME) + if (!TRACE_msg_volume_is_enabled()) return; /* check if task is traced */ @@ -44,7 +44,7 @@ void TRACE_msg_volume_finish(m_task_t task) char task_name[200]; m_process_t process = NULL; m_host_t host = NULL; - if (!IS_TRACING_VOLUME) + if (!TRACE_msg_volume_is_enabled()) return; /* check if task is traced */ diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index d49579556a..39a93630e5 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -12,11 +12,6 @@ #ifdef HAVE_TRACING #define IS_TRACED(n) (n->category) -#define IS_TRACING_TASKS (TRACE_msg_task_is_enabled()) -#define IS_TRACING_PLATFORM (TRACE_platform_is_enabled()) -#define IS_TRACING_PROCESSES (TRACE_msg_process_is_enabled()) -#define IS_TRACING_VOLUME (TRACE_msg_volume_is_enabled()) -#define IS_TRACING_SMPI (TRACE_smpi_is_enabled()) #define INSTR_DEFAULT_STR_SIZE 500 diff --git a/src/instr/instr_resource_utilization.c b/src/instr/instr_resource_utilization.c index d68cb878b3..5b9e7952a6 100644 --- a/src/instr/instr_resource_utilization.c +++ b/src/instr/instr_resource_utilization.c @@ -37,7 +37,7 @@ static void __TRACE_surf_check_variable_set_to_zero(double now, 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) + if (TRACE_platform_is_enabled()) pajeSetVariable(now, variable, resource, "0"); xbt_dict_set(platform_variables, resource, array, xbt_dynar_free_voidp); @@ -54,7 +54,7 @@ static void __TRACE_surf_check_variable_set_to_zero(double now, if (flag == 0) { char *var_cpy = xbt_strdup(variable); xbt_dynar_push(array, &var_cpy); - if (IS_TRACING_PLATFORM) + if (TRACE_platform_is_enabled()) pajeSetVariable(now, variable, resource, "0"); } } @@ -79,7 +79,7 @@ static void __TRACE_A_event(smx_action_t action, double now, double delta, const char *variable, const char *resource, double value) { - if (!IS_TRACING_PLATFORM) + if (!TRACE_platform_is_enabled()) return; char valuestr[100]; @@ -104,7 +104,7 @@ static void __TRACE_B_alloc(void) static void __TRACE_B_release(void) { - if (!IS_TRACING_PLATFORM) + if (!TRACE_platform_is_enabled()) return; char *key, *time; @@ -132,7 +132,7 @@ static void __TRACE_B_event(smx_action_t action, double now, double delta, const char *variable, const char *resource, double value) { - if (!IS_TRACING_PLATFORM) + if (!TRACE_platform_is_enabled()) return; char key_time[INSTR_DEFAULT_STR_SIZE]; diff --git a/src/instr/instr_smpi.c b/src/instr/instr_smpi.c index e991af267e..6e5f49502c 100644 --- a/src/instr/instr_smpi.c +++ b/src/instr/instr_smpi.c @@ -57,7 +57,7 @@ void TRACE_smpi_alloc() void TRACE_smpi_start(void) { - if (IS_TRACING_SMPI) { + if (TRACE_smpi_is_enabled()) { TRACE_start(); } } @@ -65,14 +65,14 @@ void TRACE_smpi_start(void) void TRACE_smpi_release(void) { TRACE_surf_release(); - if (IS_TRACING_SMPI) { + if (TRACE_smpi_is_enabled()) { TRACE_end(); } } void TRACE_smpi_init(int rank) { - if (!IS_TRACING_SMPI) + if (!TRACE_smpi_is_enabled()) return; char str[INSTR_DEFAULT_STR_SIZE]; @@ -88,7 +88,7 @@ void TRACE_smpi_init(int rank) void TRACE_smpi_finalize(int rank) { - if (!IS_TRACING_SMPI) + if (!TRACE_smpi_is_enabled()) return; char str[INSTR_DEFAULT_STR_SIZE]; @@ -98,7 +98,7 @@ void TRACE_smpi_finalize(int rank) void TRACE_smpi_collective_in(int rank, int root, const char *operation) { - if (!IS_TRACING_SMPI) + if (!TRACE_smpi_is_enabled()) return; char str[INSTR_DEFAULT_STR_SIZE]; @@ -108,7 +108,7 @@ void TRACE_smpi_collective_in(int rank, int root, const char *operation) void TRACE_smpi_collective_out(int rank, int root, const char *operation) { - if (!IS_TRACING_SMPI) + if (!TRACE_smpi_is_enabled()) return; char str[INSTR_DEFAULT_STR_SIZE]; @@ -118,7 +118,7 @@ void TRACE_smpi_collective_out(int rank, int root, const char *operation) void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation) { - if (!IS_TRACING_SMPI) + if (!TRACE_smpi_is_enabled()) return; char str[INSTR_DEFAULT_STR_SIZE]; @@ -128,7 +128,7 @@ void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation) void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation) { - if (!IS_TRACING_SMPI) + if (!TRACE_smpi_is_enabled()) return; char str[INSTR_DEFAULT_STR_SIZE]; @@ -138,7 +138,7 @@ void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation) void TRACE_smpi_send(int rank, int src, int dst) { - if (!IS_TRACING_SMPI) + if (!TRACE_smpi_is_enabled()) return; char key[INSTR_DEFAULT_STR_SIZE], str[INSTR_DEFAULT_STR_SIZE]; @@ -149,7 +149,7 @@ void TRACE_smpi_send(int rank, int src, int dst) void TRACE_smpi_recv(int rank, int src, int dst) { - if (!IS_TRACING_SMPI) + if (!TRACE_smpi_is_enabled()) return; char key[INSTR_DEFAULT_STR_SIZE], str[INSTR_DEFAULT_STR_SIZE]; diff --git a/src/instr/instr_surf.c b/src/instr/instr_surf.c index d7fe8485df..381224be28 100644 --- a/src/instr/instr_surf.c +++ b/src/instr/instr_surf.c @@ -210,7 +210,7 @@ void TRACE_surf_host_vivaldi_parse(char *host, double x, double y, double h) { char valuestr[100]; - if (!TRACE_is_active() || !IS_TRACING_PLATFORM) + if (!TRACE_is_active() || !TRACE_platform_is_enabled()) return; snprintf(valuestr, 100, "%g", x); @@ -265,7 +265,7 @@ void TRACE_surf_action(surf_action_t surf_action, const char *category) { if (!TRACE_is_active()) return; - if (!IS_TRACING_PLATFORM) + if (!TRACE_platform_is_enabled()) return; if (!category) return; diff --git a/src/instr/instr_variables.c b/src/instr/instr_variables.c index 39993fb99b..fd33b7d3fe 100644 --- a/src/instr/instr_variables.c +++ b/src/instr/instr_variables.c @@ -16,7 +16,7 @@ void TRACE_user_link_variable(double time, const char *src, const char *dst, const char *variable, double value, const char *what) { - if (!TRACE_is_active() || !IS_TRACING_PLATFORM) + if (!TRACE_is_active() || !TRACE_platform_is_enabled()) return; char valuestr[100]; @@ -51,7 +51,7 @@ void TRACE_user_host_variable(double time, const char *variable, double value, const char *what) { char valuestr[100]; - if (!TRACE_is_active() || !IS_TRACING_PLATFORM) + if (!TRACE_is_active() || !TRACE_platform_is_enabled()) return; snprintf(valuestr, 100, "%g", value);