X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0e0cb631580d4ee1271998cf2bcaec6c99e48282..444fd32bb5976fd3fd81197e6c321f21a5ed34b2:/src/msg/global.c diff --git a/src/msg/global.c b/src/msg/global.c index 35816d77c4..4f0cf72bb6 100644 --- a/src/msg/global.c +++ b/src/msg/global.c @@ -22,6 +22,7 @@ MSG_Global_t msg_global = NULL; * \brief This section describes the functions you need to know to * set up a simulation. You should have a look at \ref MSG_examples * to have an overview of their usage. + * \htmlonly \endhtmlonly */ /********************************* MSG **************************************/ @@ -29,19 +30,15 @@ MSG_Global_t msg_global = NULL; /** \ingroup msg_simulation * \brief Initialize some MSG internal data. */ -void MSG_global_init(void) +void MSG_global_init_args(int *argc, char **argv) { - int argc=0; - char **argv=NULL; - - CRITICAL0("Function MSG_global_init() is deprecated by MSG_global_init_args()."); - MSG_global_init_args(&argc,argv); + MSG_global_init(argc,argv); } /** \ingroup msg_simulation * \brief Initialize some MSG internal data. */ -void MSG_global_init_args(int *argc, char **argv) +void MSG_global_init(int *argc, char **argv) { if (!msg_global) { surf_init(argc, argv); /* Initialize some common structures. Warning, it sets msg_global=NULL */ @@ -209,7 +206,7 @@ void MSG_paje_output(const char *filename) len = strlen(filename); if((len \endhtmlonly + * * * For convenience, the simulator provides the notion of channel * that is close to the tag notion in MPI. A channel is not a @@ -275,26 +266,6 @@ MSG_error_t MSG_set_channel_number(int number) return MSG_OK; } -/** \ingroup m_simulation - * \brief Set the sharing policy used for the links - * - * This function can be called to change the sharing policy used for the links - (see \ref paper_tcp). By default the store and forward mechanism is used - with a parameter equal to 0.1. This function has to be called before creating - any link. - * \param mode the sharing policy used for the links: can be either - MSG_STORE_AND_FORWARD or MSG_TCP. - * \param param a parameter for the sharing policy. It has to be >0. It is - currently used only for the MSG_STORE_AND_FORWARD flavor and represents the - granularity of the communications (i.e. the packet size). - */ -MSG_error_t MSG_set_sharing_policy(MSG_sharing_t mode, double param) -{ - CRITICAL0("MSG_set_sharing_policy: this function is now deprecated and useless. Store and forward does not exist anymore. Please stop using it."); - - return MSG_OK; -} - /** \ingroup m_channel_management * \brief Return the number of channel in the simulation. * @@ -329,12 +300,12 @@ MSG_error_t MSG_main(void) if(xbt_fifo_size(msg_global->process_to_run) && (elapsed_time>0)) { DEBUG0("**************************************************"); } - if((__stop_at_time>0) && (MSG_getClock() >= __stop_at_time)) { + if((__stop_at_time>0) && (MSG_get_clock() >= __stop_at_time)) { DEBUG0("Let's stop here!"); } while ((process = xbt_fifo_pop(msg_global->process_to_run))) { - DEBUG3("Scheduling %s(%d) on %s", + DEBUG3("Scheduling %s(%d) on %s", process->name,process->simdata->PID, process->simdata->host->name); msg_global->current_process = process; @@ -358,7 +329,7 @@ MSG_error_t MSG_main(void) } if(!state_modifications) { - DEBUG1("%g : Calling surf_solve",MSG_getClock()); + DEBUG1("%g : Calling surf_solve",MSG_get_clock()); elapsed_time = surf_solve(); DEBUG1("Elapsed_time %g",elapsed_time); @@ -376,7 +347,7 @@ MSG_error_t MSG_main(void) process = MSG_process_create_with_arguments(args->name, args->code, args->data, args->host, args->argc,args->argv); - if(args->kill_time > MSG_getClock()) { + if(args->kill_time > MSG_get_clock()) { surf_timer_resource->extension_public->set(args->kill_time, (void*) &MSG_process_kill, (void*) process); @@ -430,33 +401,29 @@ MSG_error_t MSG_main(void) } if ((nbprocess=xbt_fifo_size(msg_global->process_list)) == 0) { - fprintf(stderr, - "MSG: Congratulations ! Simulation terminated : all process are over\n"); + INFO0("Congratulations ! Simulation terminated : all process are over"); return MSG_OK; } else { xbt_fifo_item_t item = NULL; - fprintf(stderr,"MSG: Oops ! Deadlock or code not perfectly clean.\n"); - fprintf(stderr,"MSG: %d processes are still running, waiting for something.\n", - nbprocess); + INFO0("Oops ! Deadlock or code not perfectly clean."); + INFO1("MSG: %d processes are still running, waiting for something.", + nbprocess); /* List the process and their state */ - fprintf(stderr,"MSG: () on : .\n"); + INFO0("MSG: () on : ."); xbt_fifo_foreach(msg_global->process_list,item,process,m_process_t) { simdata_process_t p_simdata = (simdata_process_t) process->simdata; simdata_host_t h_simdata=(simdata_host_t)p_simdata->host->simdata; - fprintf(stderr,"MSG: %s(%d) on %s: ", + INFO4("MSG: %s(%d) on %s: %s", process->name,p_simdata->PID, - p_simdata->host->name); - - if (process->simdata->blocked) - fprintf(stderr,"[blocked] "); - if (process->simdata->suspended) - fprintf(stderr,"[suspended] "); + p_simdata->host->name, + (process->simdata->blocked)?"[blocked] " + :((process->simdata->suspended)?"[suspended] ":"")); for (i=0; imax_channel; i++) { if (h_simdata->sleeping[i] == process) { - fprintf(stderr,"Listening on channel %d.\n",i); + INFO1("\tListening on channel %d.",i); break; } } @@ -464,18 +431,18 @@ MSG_error_t MSG_main(void) if(p_simdata->waiting_task) { if(p_simdata->waiting_task->simdata->compute) { if(p_simdata->put_host) - fprintf(stderr,"Trying to send a task to Host %s, channel %d.\n", - p_simdata->put_host->name, p_simdata->put_channel); + INFO2("\tTrying to send a task to Host %s, channel %d.", + p_simdata->put_host->name, p_simdata->put_channel); else - fprintf(stderr,"Waiting for %s to finish.\n",p_simdata->waiting_task->name); + INFO1("Waiting for %s to finish.",p_simdata->waiting_task->name); } else if (p_simdata->waiting_task->simdata->comm) - fprintf(stderr,"Waiting for %s to be finished transfered.\n", + INFO1("Waiting for %s to be finished transfered.", p_simdata->waiting_task->name); else - fprintf(stderr,"UNKNOWN STATUS. Please report this bug.\n"); + INFO0("UNKNOWN STATUS. Please report this bug."); } else { /* Must be trying to put a task somewhere */ - fprintf(stderr,"UNKNOWN STATUS. Please report this bug.\n"); + INFO0("UNKNOWN STATUS. Please report this bug."); } } } @@ -485,6 +452,7 @@ MSG_error_t MSG_main(void) xbt_abort(); } + INFO0("Return a Warning."); return MSG_WARNING; } } @@ -501,7 +469,7 @@ int MSG_process_killall(int reset_PIDs) m_process_t p = NULL; m_process_t self = MSG_process_self(); - while((p=xbt_fifo_shift(msg_global->process_list))) { + while((p=xbt_fifo_pop(msg_global->process_list))) { if(p!=self) MSG_process_kill(p); } @@ -529,7 +497,7 @@ MSG_error_t MSG_clean(void) m_process_t p = NULL; - while((p=xbt_fifo_shift(msg_global->process_list))) { + while((p=xbt_fifo_pop(msg_global->process_list))) { MSG_process_kill(p); } xbt_context_exit(); @@ -546,6 +514,7 @@ MSG_error_t MSG_clean(void) fclose(msg_global->paje_output); msg_global->paje_output = NULL; } + msg_config_finalize(); free(msg_global); surf_exit(); @@ -553,14 +522,6 @@ MSG_error_t MSG_clean(void) } -/** \ingroup msg_easier_life - * \brief A clock (in second). - * \deprecated Use MSG_get_clock - */ -double MSG_getClock(void) { - return surf_get_clock(); -} - /** \ingroup msg_easier_life * \brief A clock (in second). */