Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
parameter "--trace" to control whether to trace masterslave examples
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 12 Apr 2010 15:35:26 +0000 (15:35 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 12 Apr 2010 15:35:26 +0000 (15:35 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7538 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/msg/masterslave/masterslave_forwarder.c
examples/msg/masterslave/masterslave_mailbox.c

index 50807a0..257b276 100644 (file)
@@ -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");
index 6341506..aaf7020 100644 (file)
@@ -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;