X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/98565a6c0f5af14d8b0c0104570b927a56d0845c..375149a349ea537d4ac403ecdf268e80da975e3f:/examples/msg/masterslave/masterslave_forwarder.c diff --git a/examples/msg/masterslave/masterslave_forwarder.c b/examples/msg/masterslave/masterslave_forwarder.c index 257b27640c..312a922b39 100644 --- a/examples/msg/masterslave/masterslave_forwarder.c +++ b/examples/msg/masterslave/masterslave_forwarder.c @@ -1,6 +1,5 @@ -/* $Id$ */ - -/* Copyright (c) 2002,2003,2004 Arnaud Legrand. All rights reserved. */ +/* Copyright (c) 2007, 2008, 2009, 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. */ @@ -18,7 +17,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, int master(int argc, char *argv[]); int slave(int argc, char *argv[]); int forwarder(int argc, char *argv[]); -MSG_error_t test_all(const char *platform_file, const char *application_file); +MSG_error_t test_all(const char *platform_file, + const char *application_file); typedef enum { PORT_22 = 0, @@ -37,8 +37,6 @@ int master(int argc, char *argv[]) double task_comp_size = 0; double task_comm_size = 0; - TRACE_host_variable_set ("is_master", 1); - int i; xbt_assert1(sscanf(argv[1], "%d", &number_of_tasks), @@ -56,9 +54,8 @@ int master(int argc, char *argv[]) for (i = 0; i < number_of_tasks; i++) { sprintf(sprintf_buffer, "Task_%d", i); todo[i] = - MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL); - TRACE_host_variable_set ("task_creation", i); - TRACE_msg_set_task_category (todo[i], "compute"); + MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, + NULL); } } @@ -90,10 +87,9 @@ int master(int argc, char *argv[]) } INFO0 - ("All tasks have been dispatched. Let's tell everybody the computation is over."); - for (i = 0; i < slaves_count; i++){ - m_task_t finalize=MSG_task_create("finalize", 0, 0, FINALIZE); - TRACE_msg_set_task_category(finalize,"finalize"); + ("All tasks have been dispatched. Let's tell everybody the computation is over."); + for (i = 0; i < slaves_count; i++) { + m_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE); MSG_task_put(finalize, slaves[i], PORT_22); } @@ -107,7 +103,6 @@ int master(int argc, char *argv[]) int slave(int argc, char *argv[]) { m_task_t task = NULL; - TRACE_host_variable_set ("is_slave", 1); int res; while (1) { res = MSG_task_get(&(task), PORT_22); @@ -120,7 +115,6 @@ int slave(int argc, char *argv[]) } INFO1("Processing \"%s\"", MSG_task_get_name(task)); - TRACE_host_variable_add ("task_computation", MSG_task_get_compute_duration(task)); MSG_task_execute(task); INFO1("\"%s\" done", MSG_task_get_name(task)); MSG_task_destroy(task); @@ -159,7 +153,7 @@ int forwarder(int argc, char *argv[]) INFO1("Received \"%s\"", MSG_task_get_name(task)); if (MSG_task_get_data(task) == FINALIZE) { INFO0 - ("All tasks have been dispatched. Let's tell everybody the computation is over."); + ("All tasks have been dispatched. Let's tell everybody the computation is over."); for (i = 0; i < slaves_count; i++) MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE), slaves[i], PORT_22); @@ -182,7 +176,8 @@ int forwarder(int argc, char *argv[]) } /* end_of_forwarder */ /** Test function */ -MSG_error_t test_all(const char *platform_file, const char *application_file) +MSG_error_t test_all(const char *platform_file, + const char *application_file) { MSG_error_t res = MSG_OK; @@ -208,26 +203,6 @@ 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; - - 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"); - TRACE_host_variable_declare ("task_computation"); - TRACE_category ("compute"); - TRACE_category ("finalize"); MSG_global_init(&argc, argv); if (argc < 3) { @@ -238,8 +213,6 @@ int main(int argc, char *argv[]) res = test_all(argv[1], argv[2]); MSG_clean(); - TRACE_end (); - if (res == MSG_OK) return 0; else