Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr/gitroot/simgrid/simgrid
[simgrid.git] / examples / msg / tracing / user_variables.c
index 1a4e607..b338130 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010. The SimGrid Team.
+/* Copyright (c) 2010, 2012-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -6,26 +6,18 @@
 
 /** @addtogroup MSG_examples
  * 
- * - <b>tracing/user_variables.c</b>: This program demonstrates how to
- * trace user variables associated to the hosts of the platform file.
- * You might want to run this program with the following parameters:
- * --cfg=tracing:1
- * --cfg=tracing/platform:1
+ * - <b>tracing/user_variables.c</b>: This program demonstrates how to trace user variables associated to the hosts of
+ * the platform file. You might want to run this program with the following parameters:
+ * --cfg=tracing:yes
+ * --cfg=tracing/platform:yes
  * (See \ref tracing_tracing_options for details)
  */
 
-#include <stdio.h>
-#include "msg/msg.h"
-#include "xbt/sysdep.h"         /* calloc, printf */
+#include "simgrid/msg.h"
 
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
-int master(int argc, char *argv[]);
-
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
 {
   const char *hostname = MSG_host_get_name(MSG_host_self());
   int i;
@@ -56,7 +48,6 @@ int master(int argc, char *argv[])
   return 0;
 }
 
-/** Main function */
 int main(int argc, char *argv[])
 {
   MSG_init(&argc, argv);
@@ -65,9 +56,7 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  char *platform_file = argv[1];
-  char *deployment_file = argv[2];
-  MSG_create_environment(platform_file);
+  MSG_create_environment(argv[1]);
 
   //declaring user variables
   TRACE_host_variable_declare("HDD_capacity");
@@ -76,7 +65,7 @@ int main(int argc, char *argv[])
   //register functions and launch deployment
   MSG_function_register("master", master);
   MSG_function_register("slave", master);
-  MSG_launch_application(deployment_file);
+  MSG_launch_application(argv[2]);
 
   MSG_main();
 
@@ -100,11 +89,10 @@ int main(int argc, char *argv[])
     xbt_dynar_free (&link_variables);
   }
 
-  //create a customized triva graph configuration file
+  //create a customized viva graph configuration file
   FILE *fp;
-  fp = fopen ("triva_graph.plist", "w");
+  fp = fopen ("viva_graph.plist", "w");
   if (!fp){
-    MSG_clean();
     return 1;
   }
   fprintf (fp, "{\n node = (");
@@ -135,6 +123,5 @@ int main(int argc, char *argv[])
   fprintf (fp, "}\n");
   fclose (fp);
 
-  MSG_clean();
   return 0;
 }