-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2018. 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 "simgrid/msg.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+#include <stdio.h> /* snprintf */
-/** @addtogroup MSG_examples
- *
- * @section MSG_ex_models Models-related examples
- *
- * @subsection MSG_ex_PLS Packet level simulators
- *
- * This example demonstrates how to use the bindings to a classical Packet-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 file to see how to declare a platform to be used with the PLS
- * bindings of SimGrid and the tesh file to see how to actually start a simulation in these settings.
- *
- * - <b>ns-3: network-ns3/network-ns3.c</b>. Simple ping-pong using ns-3 instead of the SimGrid network models.
- */
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
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];
/* 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);
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();
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);
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]);
MSG_launch_application(argv[2]);
- res = MSG_main();
+ msg_error_t res = MSG_main();
return res != MSG_OK;
}