From: schnorr Date: Mon, 12 Apr 2010 15:35:26 +0000 (+0000) Subject: parameter "--trace" to control whether to trace masterslave examples X-Git-Tag: SVN~203 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/98565a6c0f5af14d8b0c0104570b927a56d0845c?ds=sidebyside parameter "--trace" to control whether to trace masterslave examples git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7538 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/examples/msg/masterslave/masterslave_forwarder.c b/examples/msg/masterslave/masterslave_forwarder.c index 50807a036c..257b27640c 100644 --- a/examples/msg/masterslave/masterslave_forwarder.c +++ b/examples/msg/masterslave/masterslave_forwarder.c @@ -208,8 +208,20 @@ MSG_error_t test_all(const char *platform_file, const char *application_file) int main(int argc, char *argv[]) { MSG_error_t res = MSG_OK; + int is_tracing = 0; + int i; - TRACE_start ("zmsg_test.trace"); + for (i = 0; i < argc; i++){ + if (!strcmp (argv[i], "--trace")){ + is_tracing = 1; + } + } + + if (is_tracing) { + //if TRACE_start is not called, all other tracing + //functions will be disabled + TRACE_start ("simulation.trace"); + } TRACE_host_variable_declare ("is_slave"); TRACE_host_variable_declare ("is_master"); TRACE_host_variable_declare ("task_creation"); diff --git a/examples/msg/masterslave/masterslave_mailbox.c b/examples/msg/masterslave/masterslave_mailbox.c index 6341506ab6..aaf70208e4 100644 --- a/examples/msg/masterslave/masterslave_mailbox.c +++ b/examples/msg/masterslave/masterslave_mailbox.c @@ -126,8 +126,20 @@ MSG_error_t test_all(const char *platform_file, int main(int argc, char *argv[]) { MSG_error_t res = MSG_OK; + int is_tracing = 0; + int i; + + for (i = 0; i < argc; i++){ + if (!strcmp (argv[i], "--trace")){ + is_tracing = 1; + } + } - TRACE_start ("zmsg_test.trace"); + if (is_tracing){ + //if TRACE_start is not called, all other tracing + //functions will be disabled + TRACE_start ("simulation.trace"); + } TRACE_host_variable_declare ("is_slave"); TRACE_host_variable_declare ("is_master"); TRACE_host_variable_declare ("task_creation"); @@ -145,7 +157,9 @@ int main(int argc, char *argv[]) SIMIX_message_sizes_output("toto.txt"); MSG_clean(); - TRACE_end(); + if (is_tracing){ + TRACE_end(); + } if(res==MSG_OK) return 0;