From: mquinson Date: Tue, 19 May 2009 12:08:53 +0000 (+0000) Subject: Display the status of simulated processes when receiving SIGINT X-Git-Tag: SVN~1338 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f49f36235140dd615cde7be572de6fb50721557e Display the status of simulated processes when receiving SIGINT git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6301 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/ChangeLog b/ChangeLog index f1ba131696..3b9859ff98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,6 +34,8 @@ SimGrid (3.4-svn) unstable; urgency=high [Bug: if MSG_task_get_sender() is called after sender exit, bad things happen] * Fix a bug which prevented suspend/resume to work properly + * Display the status of simulated processes when receiving SIGINT + This fixes a regression of v3.3. due to the introduction of SIMIX SIMIX: * Add SIMIX_process_set_name() to change the name of the current diff --git a/src/msg/global.c b/src/msg/global.c index 329b1bd76c..75caaaf2e7 100644 --- a/src/msg/global.c +++ b/src/msg/global.c @@ -141,21 +141,6 @@ int MSG_get_channel_number(void) return msg_global->max_channel; } -void __MSG_display_process_status(void) -{ -} - - -/* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */ -#include - -static void _XBT_CALL inthandler(int ignored) -{ - INFO0("CTRL-C pressed. Displaying status and bailing out"); - __MSG_display_process_status(); - exit(1); -} - /** \ingroup msg_simulation * \brief Launch the MSG simulation */ @@ -166,9 +151,6 @@ MSG_error_t MSG_main(void) xbt_fifo_t actions_done = xbt_fifo_new(); xbt_fifo_t actions_failed = xbt_fifo_new(); - /* Prepare to display some more info when dying on Ctrl-C pressing */ - signal(SIGINT, inthandler); - /* Clean IO before the run */ fflush(stdout); fflush(stderr); diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index 9bcb36dd1d..cf43c42af9 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -97,6 +97,17 @@ static void simix_cfg_init(int *argc, char **argv) } } +/* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */ +#include + +static void _XBT_CALL inthandler(int ignored) +{ + INFO0("CTRL-C pressed. Displaying status and bailing out"); + SIMIX_display_process_status(); + exit(1); +} + + /** * \brief Initialize some SIMIX internal data. * @@ -120,10 +131,13 @@ void SIMIX_global_init(int *argc, char **argv) xbt_swag_new(xbt_swag_offset(proc, process_hookup)); simix_global->current_process = NULL; simix_global->registered_functions = xbt_dict_new(); - + simix_global->create_process_function = NULL; simix_global->kill_process_function = NULL; simix_global->cleanup_process_function = SIMIX_process_cleanup; + + /* Prepare to display some more info when dying on Ctrl-C pressing */ + signal(SIGINT, inthandler); } } @@ -181,15 +195,6 @@ void SIMIX_display_process_status(void) } } -/* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */ -#include - -static void _XBT_CALL inthandler(int ignored) -{ - INFO0("CTRL-C pressed. Displaying status and bailing out"); - SIMIX_display_process_status(); - exit(1); -} /** * \brief Launch the SIMIX simulation, debug purpose @@ -202,9 +207,6 @@ void __SIMIX_main(void) xbt_fifo_t actions_done = xbt_fifo_new(); xbt_fifo_t actions_failed = xbt_fifo_new(); - /* Prepare to display some more info when dying on Ctrl-C pressing */ - signal(SIGINT, inthandler); - /* Clean IO before the run */ fflush(stdout); fflush(stderr); @@ -271,7 +273,7 @@ void SIMIX_process_killall() return; } -/** +/** * \brief Clean the SIMIX simulation * * This functions remove all memories needed to the SIMIX execution @@ -291,7 +293,7 @@ void SIMIX_clean(void) simix_config_finalize(); free(simix_global); simix_global = NULL; - + surf_exit(); return; @@ -309,8 +311,8 @@ double SIMIX_get_clock(void) } /** - * \brief Finish the simulation initialization - * + * \brief Finish the simulation initialization + * * Must be called before the first call to SIMIX_solve() */ void SIMIX_init(void) { @@ -320,7 +322,7 @@ void SIMIX_init(void) { /** * \brief Does a turn of the simulation * - * Executes a step in the surf simulation, adding to the two lists all the actions that finished on this turn. Schedules all processus in the process_to_run list. + * Executes a step in the surf simulation, adding to the two lists all the actions that finished on this turn. Schedules all processus in the process_to_run list. * \param actions_done List of actions done * \param actions_failed List of actions failed * \return The time spent to execute the simulation or -1 if the simulation ended @@ -337,7 +339,7 @@ double SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed) if (xbt_swag_size(simix_global->process_to_run) && (elapsed_time > 0)) { DEBUG0("**************************************************"); } - + while ((process = xbt_swag_extract(simix_global->process_to_run))) { DEBUG2("Scheduling %s on %s", process->name, process->simdata->smx_host->name);