Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
React sainly when flexml is not installed
[simgrid.git] / src / msg / global.c
index 5db4445..2d000f4 100644 (file)
@@ -14,7 +14,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(global, msg,
 MSG_Global_t msg_global = NULL;
 
 /* static void MarkAsFailed(m_task_t t, TBX_HashTable_t failedProcessList); */
-/* static xbt_fifo_t MSG_buildFailedHostList(long double a, long double b); */
+/* static xbt_fifo_t MSG_buildFailedHostList(double a, double b); */
 
 /** \defgroup msg_simulation   MSG simulation Functions
  *  \brief This section describes the functions you need to know to
@@ -32,8 +32,7 @@ void MSG_global_init(void)
   int argc=0;
   char **argv=NULL;
 
-  CRITICAL0("Please stop using this function. Use MSG_global_init_args instead.");
-  DIE_IMPOSSIBLE;
+  CRITICAL0("Function MSG_global_init() is deprecated by MSG_global_init_args().");
   MSG_global_init_args(&argc,argv);
 }
 
@@ -43,9 +42,10 @@ void MSG_global_init(void)
 void MSG_global_init_args(int *argc, char **argv)
 {
   if (!msg_global) {
+    surf_init(argc, argv);     /* Initialize some common structures. Warning, it sets msg_global=NULL */
+     
     msg_global = xbt_new0(s_MSG_Global_t,1);
 
-    surf_init(argc, argv);     /* Initialize some common structures */
     xbt_context_init();
     msg_global->host = xbt_fifo_new();
     msg_global->process_to_run = xbt_fifo_new();
@@ -199,7 +199,7 @@ void MSG_paje_output(const char *filename)
   int len;
 
   xbt_assert0(msg_global, "Initialize MSG first\n");
-  xbt_assert0(!msg_global->paje_output, "Paje output allready defined\n");
+  xbt_assert0(!msg_global->paje_output, "Paje output already defined\n");
   xbt_assert0(filename, "Need a real file name\n");
 
   len = strlen(filename);
@@ -208,8 +208,6 @@ void MSG_paje_output(const char *filename)
              filename,ext);
   }
 
-  xbt_assert0(filename, "Need a real file name\n");
-
   msg_global->paje_output=fopen(filename,"w");
   xbt_assert1(msg_global->paje_output, "Failed to open %s \n",filename);
 
@@ -228,7 +226,7 @@ void MSG_paje_output(const char *filename)
  */
 void MSG_set_verbosity(MSG_outputmode_t mode)
 {
-  CRITICAL0("MSG_set_verbosity : Not implemented yet.");
+  CRITICAL0("MSG_set_verbosity : Deprecated function. Use the XBT logging interface.");
 }
 
 /** \defgroup m_channel_management    Understanding channels
@@ -274,7 +272,7 @@ MSG_error_t MSG_set_channel_number(int number)
    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, long double param)
+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.");
   
@@ -321,11 +319,11 @@ MSG_error_t MSG_main(void)
       xbt_context_schedule(process->simdata->context);
       msg_global->current_process = NULL;
     }
-    DEBUG1("%Lg : Calling surf_solve",MSG_getClock());
+    DEBUG1("%lg : Calling surf_solve",MSG_getClock());
     elapsed_time = surf_solve();
     DEBUG1("Elapsed_time %lg",elapsed_time);
 
-/*     fprintf(stderr, "====== %Lg =====\n",Now); */
+/*     fprintf(stderr, "====== %lg =====\n",Now); */
 /*     if (elapsed_time==0.0) { */
 /*       fprintf(stderr, "No change in time\n"); */
 /*     } */
@@ -465,7 +463,7 @@ MSG_error_t MSG_main(void)
   
 /* } */
 
-/* static xbt_fifo_t MSG_buildFailedHostList(long double begin, long double end) */
+/* static xbt_fifo_t MSG_buildFailedHostList(double begin, double end) */
 /* { */
 /*   xbt_fifo_t failedHostList = xbt_fifo_new(); */
 /*   m_host_t host = NULL; */
@@ -532,17 +530,25 @@ MSG_error_t MSG_clean(void)
     fclose(msg_global->paje_output);
     msg_global->paje_output = NULL;
   }
-  xbt_free(msg_global);
+  free(msg_global);
   surf_finalize();
 
   return MSG_OK;
 }
 
 
+/** \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).
  */
-long double MSG_getClock(void) {
+double MSG_get_clock(void) {
   return surf_get_clock();
 }