X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5b1bf4b927630226493504bec19ea7356f8e70ff..23976cb525fd51c66ef8e1234cdc5626fca83990:/examples/msg/trace-user-variables/trace-user-variables.c diff --git a/examples/msg/trace-user-variables/trace-user-variables.c b/examples/msg/trace-user-variables/trace-user-variables.c index 5e6a05735c..f25f77b26b 100644 --- a/examples/msg/trace-user-variables/trace-user-variables.c +++ b/examples/msg/trace-user-variables/trace-user-variables.c @@ -1,32 +1,22 @@ -/* Copyright (c) 2010, 2012-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010, 2012-2016. 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. */ -/** @addtogroup MSG_examples - * - * - tracing/user_variables.c: 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 #include "simgrid/msg.h" XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); -static int master(int argc, char *argv[]) +static int trace_fun(int argc, char *argv[]) { const char *hostname = MSG_host_get_name(MSG_host_self()); - int i; //the hostname has an empty HDD with a capacity of 100000 (bytes) TRACE_host_variable_set(hostname, "HDD_capacity", 100000); TRACE_host_variable_set(hostname, "HDD_utilization", 0); - for (i = 0; i < 10; i++) { + for (int i = 0; i < 10; i++) { //create and execute a task just to make the simulated time advance msg_task_t task = MSG_task_create("task", 10000, 0, NULL); MSG_task_execute (task); @@ -36,7 +26,7 @@ static int master(int argc, char *argv[]) TRACE_host_variable_add(hostname, "HDD_utilization", 100); } - for (i = 0; i < 10; i++) { + for (int i = 0; i < 10; i++) { //create and execute a task just to make the simulated time advance msg_task_t task = MSG_task_create("task", 10000, 0, NULL); MSG_task_execute (task); @@ -61,8 +51,8 @@ int main(int argc, char *argv[]) TRACE_host_variable_declare("HDD_utilization"); //register functions and launch deployment - MSG_function_register("master", master); - MSG_function_register("slave", master); + MSG_function_register("master", trace_fun); + MSG_function_register("worker", trace_fun); MSG_launch_application(argv[2]); MSG_main();