X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/11a34a08b64a2c5897a0ce2137fb9e8d37bd7fd2..23eef5ffa2ad4a1d6a5bed99ed932e2592d47793:/examples/msg/network-ns3/network-ns3.c diff --git a/examples/msg/network-ns3/network-ns3.c b/examples/msg/network-ns3/network-ns3.c index 9c2ecf795f..390ca97228 100644 --- a/examples/msg/network-ns3/network-ns3.c +++ b/examples/msg/network-ns3/network-ns3.c @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-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. */ @@ -8,25 +7,10 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); -/** @addtogroup MSG_examples - * - * @section MSG_ex_models Models-related examples - * - * @subsection MSG_ex_PLS Packet level simulators - * - * These examples demonstrate how to use the bindings to classicalPacket-Level Simulators (PLS), as explained in - * \ref pls. The most interesting is probably not the C files since they are unchanged from the other simulations, - * but the associated files, such as the platform files to see how to declare a platform to be used with the PLS - * bindings of SimGrid and the tesh files to see how to actually start a simulation in these settings. - * - * - ns3: Simple ping-pong using ns3 instead of the SimGrid network models. - */ - int timer_start; //set as 1 in the master process //keep a pointer to all surf running tasks. #define NTASKS 1500 -int bool_printed = 0; double start_time, end_time, elapsed_time; double gl_data_size[NTASKS]; msg_task_t gl_task_array[NTASKS]; @@ -51,7 +35,8 @@ static int master(int argc, char *argv[]) /* worker name */ char *workername = argv[2]; int id = xbt_str_parse_int(argv[3], "Invalid ID as argument 3: %s"); //unique id to control statistics - char *id_alias = bprintf("flow_%d", id); + char *id_alias = xbt_malloc(20*sizeof(char)); + snprintf(id_alias, 20, "flow_%d", id); workernames[id] = workername; TRACE_category(id_alias); @@ -71,7 +56,7 @@ static int master(int argc, char *argv[]) timer_start = 1 ; /* time measurement */ - sprintf(id_alias, "%d", id); + snprintf(id_alias,20,"%d", id); start_time = MSG_get_clock(); MSG_task_send(todo, id_alias); end_time = MSG_get_clock(); @@ -116,7 +101,7 @@ static int worker(int argc, char *argv[]) XBT_DEBUG ("Worker started"); int id = xbt_str_parse_int(argv[1], "Invalid id: %s"); - sprintf(id_alias, "%d", id); + snprintf(id_alias,10, "%d", id); msg_error_t a = MSG_task_receive(&(task), id_alias); @@ -140,9 +125,6 @@ static int worker(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - bool_printed = 0; - MSG_init(&argc, argv); xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n" "\tExample: %s platform.xml deployment.xml\n", argv[0], argv[0]); @@ -156,7 +138,7 @@ int main(int argc, char *argv[]) MSG_launch_application(argv[2]); - res = MSG_main(); + msg_error_t res = MSG_main(); return res != MSG_OK; }