Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New cmake option "enable_mallocators", useful to disable mallocators.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 11 Oct 2012 14:10:14 +0000 (16:10 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 11 Oct 2012 15:33:29 +0000 (17:33 +0200)
ChangeLog
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/Option.cmake
include/simgrid_config.h.in
src/xbt/mallocator.c

index fe1d304..de39bdf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    and LDFLAGS.
  * Enable tracing by default. This modules rocks you should use it.
  * Use default cmake things to detect lua instead of home grown ones.
    and LDFLAGS.
  * Enable tracing by default. This modules rocks you should use it.
  * Use default cmake things to detect lua instead of home grown ones.
+ * New option "enable_mallocators" to disable mallocators, for debugging
+   purpose ("on" by default).
 
  Documentation:
  * Split the doc into a user guide and a reference guide.
 
  Documentation:
  * Split the doc into a user guide and a reference guide.
@@ -22,7 +24,7 @@ SimGrid (3.8) NOT RELEASED; urgency=low
  * Make it impossible to link against the wrong version of the lib
  * Bug fixes that made the host (and link) failures unusable.
  * Add a way to auto-restart process when the host in which they are
  * Make it impossible to link against the wrong version of the lib
  * Bug fixes that made the host (and link) failures unusable.
  * Add a way to auto-restart process when the host in which they are
-   executing comes back (ON_FAILURE="RESTART" on deployment file, 
+   executing comes back (ON_FAILURE="RESTART" on deployment file,
    MSG_process_auto_restart_set).
  * Use the "msg_" prefix for all datatypes (instead of m_, msg_ and MSG_),
    please stop using the old ones, they are DEPRECATED.
    MSG_process_auto_restart_set).
  * Use the "msg_" prefix for all datatypes (instead of m_, msg_ and MSG_),
    please stop using the old ones, they are DEPRECATED.
@@ -53,9 +55,9 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    communication_amount structures is now done seamlessly thanks to the chosen
    assumptions.
  * New function SD_workstation_dump to display various information
    communication_amount structures is now done seamlessly thanks to the chosen
    assumptions.
  * New function SD_workstation_dump to display various information
- * New function SD_task_set_rate to throttle the bandwidth allowed to be used 
-   by a SD_TASK_COMM_E2E typed task. This rate depends on both the nominal 
-   bandwidth on the route onto which the task is  scheduled and the amount of 
+ * New function SD_task_set_rate to throttle the bandwidth allowed to be used
+   by a SD_TASK_COMM_E2E typed task. This rate depends on both the nominal
+   bandwidth on the route onto which the task is  scheduled and the amount of
    data to transfer.
    To divide the nominal bandwidth by 2, the rate then has to be :
                      rate = bandwidth/(2*amount)
    data to transfer.
    To divide the nominal bandwidth by 2, the rate then has to be :
                      rate = bandwidth/(2*amount)
@@ -63,14 +65,14 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    (from their beginning)
  * Increasing source code coverage (src/simdag is now covered at 95.8%
    on average)
    (from their beginning)
  * Increasing source code coverage (src/simdag is now covered at 95.8%
    on average)
-   
+
  SMPI:
  * Re-implement time-independent trace replay using SMPI (at the
    smpi_smp_* level) instead of MSG. This should replace
    examples/msg/actions/actions.c
  * Implement the exchange of non-contiguous data.
    [Khalid Hasanov & Jean-Noel Quintin] Thanks for the patch, guys.
  SMPI:
  * Re-implement time-independent trace replay using SMPI (at the
    smpi_smp_* level) instead of MSG. This should replace
    examples/msg/actions/actions.c
  * Implement the exchange of non-contiguous data.
    [Khalid Hasanov & Jean-Noel Quintin] Thanks for the patch, guys.
-   
+
  XBT:
  * Functions xbt_dict_hash() and xbt_dict_hash_ext() are made public,
    and renamed to xbt_str_hash() and xbt_str_hash_ext().
  XBT:
  * Functions xbt_dict_hash() and xbt_dict_hash_ext() are made public,
    and renamed to xbt_str_hash() and xbt_str_hash_ext().
index 0162d0a..5f1d02e 100644 (file)
@@ -197,6 +197,12 @@ else(enable_latency_bound_tracking)
   endif(enable_gtnets)
 endif(enable_latency_bound_tracking)
 
   endif(enable_gtnets)
 endif(enable_latency_bound_tracking)
 
+if(enable_mallocators)
+  SET(MALLOCATOR_IS_WANTED 1)
+else(enable_mallocators)
+  SET(MALLOCATOR_IS_WANTED 0)
+endif(enable_mallocators)
+
 if(enable_model-checking AND HAVE_MMAP)
   SET(HAVE_MC 1)
   SET(MMALLOC_WANT_OVERRIDE_LEGACY 1)
 if(enable_model-checking AND HAVE_MMAP)
   SET(HAVE_MC 1)
   SET(MMALLOC_WANT_OVERRIDE_LEGACY 1)
index 0cdc764..9a66066 100644 (file)
@@ -26,6 +26,7 @@ option(enable_tracing "Tracing simulations for visualization." on)
 option(enable_latency_bound_tracking "" off)
 option(enable_coverage "Enable coverage." off)
 option(enable_memcheck "Enable memcheck." off)
 option(enable_latency_bound_tracking "" off)
 option(enable_coverage "Enable coverage." off)
 option(enable_memcheck "Enable memcheck." off)
+option(enable_mallocators "Enable mallocators (for debugging purpose)." on)
 option(enable_print_message "Enable print message during config." off)
 option(enable_model-checking "Turn this on to experiment with our prototype of model-checker (hinders the simulation's performance even if turned of at runtime)" off)
 option(enable_lib_static "" off)
 option(enable_print_message "Enable print message during config." off)
 option(enable_model-checking "Turn this on to experiment with our prototype of model-checker (hinders the simulation's performance even if turned of at runtime)" off)
 option(enable_lib_static "" off)
index c995230..1c5edc8 100644 (file)
@@ -121,6 +121,9 @@ XBT_PUBLIC(char *) bvprintf(const char *fmt, va_list ap);
 XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
 /** @} */
 
 XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
 /** @} */
 
+/* Whether mallocators should be enabled or not. */
+#define MALLOCATOR_IS_WANTED @MALLOCATOR_IS_WANTED@
+
 /* Define if xbt contexts are based on our threads implementation or not */
 #cmakedefine CONTEXT_THREADS @CONTEXT_THREADS@
 
 /* Define if xbt contexts are based on our threads implementation or not */
 #cmakedefine CONTEXT_THREADS @CONTEXT_THREADS@
 
index 285c846..e6753e1 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator, xbt, "Mallocators");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator, xbt, "Mallocators");
 
-
-/* Change to 0 to completely disable mallocators. */
-#define MALLOCATOR_IS_WANTED 1
-
 /* Mallocators and memory mess introduced by model-checking do not mix well
  * together: the mallocator will give standard memory when we are using raw
  * memory (so these blocks are killed on restore) and the contrary (so these
 /* Mallocators and memory mess introduced by model-checking do not mix well
  * together: the mallocator will give standard memory when we are using raw
  * memory (so these blocks are killed on restore) and the contrary (so these
@@ -53,7 +49,8 @@ xbt_mallocator_t xbt_mallocator_new(int size,
   xbt_assert(new_f != NULL && free_f != NULL, "invalid parameter");
 
   m = xbt_new0(s_xbt_mallocator_t, 1);
   xbt_assert(new_f != NULL && free_f != NULL, "invalid parameter");
 
   m = xbt_new0(s_xbt_mallocator_t, 1);
-  XBT_VERB("Create mallocator %p", m);
+  XBT_VERB("Create mallocator %p (%s)",
+           m, MALLOCATOR_IS_ENABLED ? "enabled" : "disabled");
   m->current_size = 0;
   m->new_f = new_f;
   m->free_f = free_f;
   m->current_size = 0;
   m->new_f = new_f;
   m->free_f = free_f;
@@ -64,8 +61,6 @@ xbt_mallocator_t xbt_mallocator_new(int size,
     m->max_size = size;
     m->mutex = xbt_os_mutex_init();
   } else {
     m->max_size = size;
     m->mutex = xbt_os_mutex_init();
   } else {
-    if (!MALLOCATOR_IS_WANTED) /* Warn to avoid to commit debugging settings */
-      XBT_WARN("Mallocator is disabled!");
     m->objects = NULL;
     m->max_size = 0;
     m->mutex = NULL;
     m->objects = NULL;
     m->max_size = 0;
     m->mutex = NULL;