X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/253aec39d6b6cdae39cd320f47f952b7cd665048..ba7ceb6bb4bbcfed5106581edeab7fea90c8e26c:/examples/msg/tracing/link_srcdst_user_variables.c diff --git a/examples/msg/tracing/link_srcdst_user_variables.c b/examples/msg/tracing/link_srcdst_user_variables.c index 63a19e9004..632f2d3162 100644 --- a/examples/msg/tracing/link_srcdst_user_variables.c +++ b/examples/msg/tracing/link_srcdst_user_variables.c @@ -1,28 +1,24 @@ -/* Copyright (c) 2012. The SimGrid Team. +/* Copyright (c) 2012-2015. 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. */ -#include +#include /** @addtogroup MSG_examples * - * - tracing/link_srcdst_user_variables.c: This program demonstrates how to - * trace user variables associated to the links of the platform file. Instead of - * providing the name of the link to update one of its variable, this example shows - * how to provide two hosts as parameter (source and destination, use their names as - * defined in the platform file). The tracing mechanism will get the route between - * these two hosts, if there is one defined in the platform file, and update the variable - * of all the links of that route to the value provided. + * - tracing/link_srcdst_user_variables.c: This program demonstrates how to trace user variables associated to + * the links of the platform file. Instead of providing the name of the link to update one of its variable, this + * example shows how to provide two hosts as parameter (source and destination, use their names as defined in the + * platform file). The tracing mechanism will get the route between these two hosts, if there is one defined in the + * platform file, and update the variable of all the links of that route to the value provided. * 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) */ -int master(int argc, char *argv[]); - //dump function to create and execute a task static void create_and_execute_task (void) { @@ -31,18 +27,11 @@ static void create_and_execute_task (void) MSG_task_destroy (task); } -int master(int argc, char *argv[]) +static int master(int argc, char *argv[]) { - int i; - //Set initial values for the link user variables - // - //This example uses source and destination where - //source and destination are the name of hosts in - //the platform file. - // - //The functions will set/change the value of the variable - //for all links in the route between source and destination. + //This example uses source and destination wheresource and destination are the name of hosts inthe platform file. + //The functions will set/change the value of the variablefor all links in the route between source and destination. //Set the Link_Capacity variable TRACE_link_srcdst_variable_set("Tremblay", "Bourassa", "Link_Capacity", 12.34); @@ -53,7 +42,7 @@ int master(int argc, char *argv[]) TRACE_link_srcdst_variable_set("Fafard", "Ginette", "Link_Utilization", 3.4); //run the simulation, update my variables accordingly - for (i = 0; i < 10; i++) { + for (int i = 0; i < 10; i++) { create_and_execute_task (); //Add to link user variables @@ -61,7 +50,7 @@ int master(int argc, char *argv[]) TRACE_link_srcdst_variable_add ("Fafard", "Ginette", "Link_Utilization", 7.8); } - for (i = 0; i < 10; i++) { + for (int i = 0; i < 10; i++) { create_and_execute_task (); //Subtract from link user variables @@ -72,7 +61,6 @@ int master(int argc, char *argv[]) return 0; } -/** Main function */ int main(int argc, char *argv[]) { MSG_init(&argc, argv); @@ -81,9 +69,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 link user variables (one without, another with a RGB color) TRACE_link_variable_declare("Link_Capacity"); @@ -92,7 +78,7 @@ int main(int argc, char *argv[]) //register "master" and "slave" 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(); return 0;