X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a9a7fce452bf5dc36bde5c1e0090b91922d13588..972791c2823bfc1694d827b1e943eb725847e2d8:/examples/msg/actions/actions.c diff --git a/examples/msg/actions/actions.c b/examples/msg/actions/actions.c index 25baa9a7b3..e43c1d45f5 100644 --- a/examples/msg/actions/actions.c +++ b/examples/msg/actions/actions.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010. The SimGrid Team. +/* Copyright (c) 2009-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -6,10 +6,9 @@ #include #include -#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */ +#include "simgrid/msg.h" /* Yeah! If you want to use msg, you need to include simgrid/msg.h */ #include "simgrid/simix.h" /* semaphores for the barrier */ #include "xbt.h" /* calloc, printf */ -#include "instr/instr_private.h" #include /** @addtogroup MSG_examples @@ -108,7 +107,7 @@ static void action_send(const char *const *action) sprintf(to, "%s_%s", MSG_process_get_name(MSG_process_self()), action[2]); - ACT_DEBUG("Entering Send: %s (size: %lg)", NAME, size); + ACT_DEBUG("Entering Send: %s (size: %g)", NAME, size); if (size < 65536) { action_Isend(action); } else { @@ -231,8 +230,8 @@ static void action_barrier(const char *const *action) processes_arrived_sofar--; if (!processes_arrived_sofar) { - simcall_cond_destroy(cond); - simcall_mutex_destroy(mutex); + SIMIX_cond_destroy(cond); + SIMIX_mutex_destroy(mutex); mutex = NULL; } } @@ -437,8 +436,8 @@ static void action_comm_size(const char *const *action) static void action_compute(const char *const *action) { - const char *amout = action[2]; - msg_task_t task = MSG_task_create("task", parse_double(amout), 0, NULL); + const char *amount = action[2]; + msg_task_t task = MSG_task_create("task", parse_double(amount), 0, NULL); double clock = MSG_get_clock(); ACT_DEBUG("Entering %s", NAME); @@ -479,16 +478,17 @@ int main(int argc, char *argv[]) /* Check the given arguments */ MSG_init(&argc, argv); - if (argc < 3) { - printf("Usage: %s platform_file deployment_file [action_files]\n", argv[0]); - printf - ("example: %s msg_platform.xml msg_deployment.xml actions # if all actions are in the same file\n", - argv[0]); - printf - ("example: %s msg_platform.xml msg_deployment.xml # if actions are in separate files, specified in deployment\n", - argv[0]); - exit(1); - } + /* Explicit initialization of the action module is required now*/ + MSG_action_init(); + + xbt_assert(argc > 2, + "Usage: %s platform_file deployment_file [action_files]\n" + "\t# if all actions are in the same file\n" + "\tExample: %s msg_platform.xml msg_deployment.xml actions\n" + "\t# if actions are in separate files, specified in deployment\n" + "\tExample: %s msg_platform.xml msg_deployment.xml ", + argv[0],argv[0],argv[0]); + printf("WARNING: THIS BINARY IS KINDA DEPRECATED\n" "This example is still relevant if you want to learn about MSG-based trace replay, " "but if you want to simulate MPI-like traces, you should use the newer version " @@ -522,8 +522,8 @@ int main(int argc, char *argv[]) XBT_INFO("Simulation time %g", MSG_get_clock()); - if (res == MSG_OK) - return 0; - else - return 1; + /* Explicit finalization of the action module is required now*/ + MSG_action_exit(); + + return res != MSG_OK; } /* end_of_main */