X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4882091cfbf6ba61a576e0706b4fd03520b07fbc..00d88e621b125609f0de3b123b97174100a28f4c:/src/msg/global.c diff --git a/src/msg/global.c b/src/msg/global.c index 9160e07c5d..a85b6c53f2 100644 --- a/src/msg/global.c +++ b/src/msg/global.c @@ -11,6 +11,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(global, msg, "Logging specific to MSG (global)"); +int __stop_at_time = -1.0 ; + MSG_Global_t msg_global = NULL; /* static void MarkAsFailed(m_task_t t, TBX_HashTable_t failedProcessList); */ @@ -235,8 +237,8 @@ void MSG_paje_output(const char *filename) } } -/** \ingroup msg_simulation - * \brief Defines the verbosity of the simulation. +/** @deprecated Defines the verbosity of the simulation. + * @ingroup msg_simulation */ void MSG_set_verbosity(MSG_outputmode_t mode) { @@ -324,13 +326,19 @@ MSG_error_t MSG_main(void) /* xbt_fifo_size(msg_global->process_to_run) */ while (1) { xbt_context_empty_trash(); + if(xbt_fifo_size(msg_global->process_to_run) && (elapsed_time>0)) { + DEBUG0("**************************************************"); + } + if((__stop_at_time>0) && (MSG_getClock() >= __stop_at_time)) { + DEBUG0("Let's stop here!"); + } + while ((process = xbt_fifo_pop(msg_global->process_to_run))) { -/* fprintf(stderr,"-> %s (%d)\n",process->name, process->simdata->PID); */ DEBUG3("Scheduling %s(%d) on %s", process->name,process->simdata->PID, process->simdata->host->name); msg_global->current_process = process; - fflush(NULL); +/* fflush(NULL); */ xbt_context_schedule(process->simdata->context); msg_global->current_process = NULL; } @@ -351,6 +359,31 @@ MSG_error_t MSG_main(void) surf_action_t action = NULL; surf_resource_t resource = NULL; m_task_t task = NULL; + + void *fun = NULL; + void *arg = NULL; + while (surf_timer_resource->extension_public->get(&fun,(void*)&arg)) { + DEBUG2("got %p %p", fun, arg); + if(fun==MSG_process_create_with_arguments) { + process_arg_t args = arg; + DEBUG2("Launching %s on %s", args->name, args->host->name); + process = MSG_process_create_with_arguments(args->name, args->code, + args->data, args->host, + args->argc,args->argv); + if(args->kill_time > MSG_getClock()) { + surf_timer_resource->extension_public->set(args->kill_time, + (void*) &MSG_process_kill, + (void*) process); + } + xbt_free(args); + } + if(fun==MSG_process_kill) { + process = arg; + DEBUG3("Killing %s(%d) on %s", process->name, process->simdata->PID, + process->simdata->host->name); + MSG_process_kill(process); + } + } xbt_dynar_foreach(resource_list, i, resource) { while ((action = @@ -360,7 +393,6 @@ MSG_error_t MSG_main(void) if(task) { int _cursor; DEBUG1("** %s failed **",task->name); -/* fprintf(stderr,"** %s **\n",task->name); */ xbt_dynar_foreach(task->simdata->sleeping,_cursor,process) { DEBUG3("\t preparing to wake up %s(%d) on %s", process->name,process->simdata->PID, @@ -377,7 +409,6 @@ MSG_error_t MSG_main(void) if(task) { int _cursor; DEBUG1("** %s done **",task->name); -/* fprintf(stderr,"** %s **\n",task->name); */ xbt_dynar_foreach(task->simdata->sleeping,_cursor,process) { DEBUG3("\t preparing to wake up %s(%d) on %s", process->name,process->simdata->PID,