From: Arnaud Giersch Date: Thu, 11 Oct 2012 14:10:14 +0000 (+0200) Subject: New cmake option "enable_mallocators", useful to disable mallocators. X-Git-Tag: v3_8~76^2~3 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/81a893de252d864b225de51fe68b40bef3ff17b5 New cmake option "enable_mallocators", useful to disable mallocators. --- diff --git a/ChangeLog b/ChangeLog index fe1d304eec..de39bdf1d3 100644 --- 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. + * 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. @@ -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 - 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. @@ -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 - * 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) @@ -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) - + 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(). diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index 0162d0ad79..5f1d02ea3b 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -197,6 +197,12 @@ else(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) diff --git a/buildtools/Cmake/Option.cmake b/buildtools/Cmake/Option.cmake index 0cdc764033..9a660662ee 100644 --- a/buildtools/Cmake/Option.cmake +++ b/buildtools/Cmake/Option.cmake @@ -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_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) diff --git a/include/simgrid_config.h.in b/include/simgrid_config.h.in index c9952306f8..1c5edc8acf 100644 --- a/include/simgrid_config.h.in +++ b/include/simgrid_config.h.in @@ -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); /** @} */ +/* 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@ diff --git a/src/xbt/mallocator.c b/src/xbt/mallocator.c index 285c8461ba..e6753e1d9c 100644 --- a/src/xbt/mallocator.c +++ b/src/xbt/mallocator.c @@ -14,10 +14,6 @@ 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 @@ -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_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; @@ -64,8 +61,6 @@ xbt_mallocator_t xbt_mallocator_new(int size, 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;