Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fullduplex support
[simgrid.git] / examples / msg / tracing / ms.c
index 159203c..d63b04d 100644 (file)
@@ -1,6 +1,5 @@
-/*     $Id$     */
-
-/* Copyright (c) 2002,2003,2004 Arnaud Legrand. All rights reserved.        */
+/* Copyright (c) 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -29,6 +28,7 @@ int master(int argc, char *argv[])
   //setting the variable "is_master" (previously declared) to value 1
   TRACE_host_variable_set ("is_master", 1);
 
+  TRACE_mark ("msmark", "start_send_tasks");
   int i;
   for (i = 0; i < number_of_tasks; i++) {
     m_task_t task=NULL;
@@ -42,6 +42,7 @@ int master(int argc, char *argv[])
     TRACE_msg_set_task_category (task, "compute");
     MSG_task_send(task, "master_mailbox");
   }
+  TRACE_mark ("msmark", "finish_send_tasks");
   
    for (i = 0; i < slaves_count; i++) { 
      m_task_t finalize = MSG_task_create ("finalize", 0, 0, 0);
@@ -104,10 +105,16 @@ MSG_error_t test_all(const char *platform_file,
 int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
-  int i;
+
+  MSG_global_init(&argc,argv);
+  if (argc < 3) {
+     printf ("Usage: %s platform_file deployment_file\n",argv[0]);
+     printf ("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
+     exit(1);
+  }
 
   //starting the simulation tracing
-  TRACE_start ("simulation.trace");
+  TRACE_start ();
 
   //declaring user variables
   TRACE_host_variable_declare ("is_slave");
@@ -115,16 +122,13 @@ int main(int argc, char *argv[])
   TRACE_host_variable_declare ("task_creation");
   TRACE_host_variable_declare ("task_computation");
 
+  //declaring user markers
+  TRACE_declare_mark ("msmark");
+
   //declaring user categories
   TRACE_category ("compute");
   TRACE_category ("finalize");
 
-  MSG_global_init(&argc,argv);
-  if (argc < 3) {
-     printf ("Usage: %s platform_file deployment_file\n",argv[0]);
-     printf ("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
-     exit(1);
-  }
   res = test_all(argv[1],argv[2]);
   MSG_clean();