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.
* 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.
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)
(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().
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)
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)
sudo yum -y -q install pcre-devel pcre-static
sudo yum -y -q install git-core
sudo yum -y -q install ruby ruby-devel
-sudo yum -y -q install libunwind
+sudo yum -y -q install libunwind libunwind-devel
which_svn=`which svn` #svn necessary
which_gcc=`which gcc` #gcc gcc necessary
p Testing the Parallel Matrix Multiplication
-! timeout 15
+! timeout 60
$ ./pmm/msg_pmm --log=msg_pmm.thres:verbose --log=no_loc ${srcdir:=.}/../platforms/cluster.xml ${srcdir:=.}/pmm/pmm_9_deploy.xml
> [c-0.me:node:(1) 0.000000] [msg_pmm/VERBOSE] Create job 0
> [c-0.me:node:(1) 0.000000] [msg_pmm/VERBOSE] Create job 1
include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi")
-add_executable(MM_mpi MM_mpi.c 2.5D_MM.c Summa.c topo.c param.c Matrix_init.c)
+add_executable(MM_mpi MM_mpi.c 2.5D_MM.c Summa.c Matrix_init.c)
### Add definitions for compile
if(NOT WIN32)
*/
-#include "topo.h"
-#include "param.h"
#include "Matrix_init.h"
#include "2.5D_MM.h"
#include "xbt/log.h"
while(loop==1);
#endif
- int opt, display = 0;
- char *conf_file = NULL;
+ int opt = 0;
optind = 1;
//get the parameter from command line
- while ((opt = getopt(argc, argv, "hdf:r:c:M:N:K:B:G:g:k:P:")) != -1) {
+ while ((opt = getopt(argc, argv, "hr:c:M:N:K:B:G:g:k:P:")) != -1) {
switch(opt) {
case 'h':
XBT_INFO(
" -k I group rank(default: %zu)\n"
" -r I processor row size (default: %zu)\n"
" -c I processor col size (default: %zu)\n"
- " -f {Filename} provide the file with the configuration\n"
- " -d display the configuration file on the stderr\n"
" -h help\n",
m, n, k, Block_size, NB_groups, group, key, row, col);
return 0;
/*case 'P':
str_mask = strdup(optarg);
break;*/
- case 'f':
- conf_file = strdup(optarg);
- break;
- case 'd':
- display = 1;
- break;
}
}
- if( display == 1 ){
- print_conf(MPI_COMM_WORLD, myrank,NULL,NULL);
- MPI_Barrier(MPI_COMM_WORLD);
- MPI_Finalize();
- exit(0);
- }
- char **conf;
- //char ***conf_all;
- if(conf_file == NULL){
- conf = get_conf(MPI_COMM_WORLD, "default_conf", -1);
- }else{
- conf = get_conf(MPI_COMM_WORLD, conf_file, -1);
- //conf_all = get_conf_all(conf_file);
- }
- if(conf == NULL){
- XBT_INFO(
- "No configuration for me inside the file\n");
- }else{
-
-
- if(NB_groups !=1){
- /* Get my group number from the config file */
- group = (size_t)atoi(conf[4]);
- }
- }
+++ /dev/null
-/*!
- * get the parameter specific to the process from a file
- *
- */
-
-#include "topo.h"
-#include "param.h"
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <mpi.h>
-#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(MM_param,
- "Messages specific for this msg example");
-
-int match(const char *s, char p);
-char** get_list_param(const char* input);
-int match(const char *s, char p)
-{
- int c = 0;
- while (*s != '\0') {
- if (strncmp(s++, &p, 1)) continue;
- c++;
- }
- return c;
-}
-
-char** get_list_param(const char* input){
- if(input==NULL) return NULL;
- char *line = strdup(input);
- int size = match(line, ' ');
- char **list_param = malloc(size*sizeof(char*));
- char *pch = strtok (line," \t\n");
- int i = 0;
- while (pch != NULL)
- {
- if(strcmp(pch,"") != 0 ) {
- list_param[i] = pch;
- i++;
- }
- pch = strtok (NULL, " \t\n");
- }
- return list_param;
-}
-
-char** get_conf(MPI_Comm comm, const char * filename, int mynoderank)
-{
- if(filename == NULL) return NULL;
- if(mynoderank == -1){
- MPI_Comm comm_node;
- split_comm_intra_node(comm, &comm_node, -1);
- MPI_Comm_rank ( comm_node, &mynoderank );
- MPI_Comm_free(&comm_node);
- }
- char name[MPI_MAX_PROCESSOR_NAME];
- int len;
- MPI_Get_processor_name(name, &len);
- FILE* conf;
- conf = fopen(filename, "r");
- if (conf == NULL) {
- XBT_DEBUG(
- "Try to open the configuration file %s\n", filename);
- perror("fopen");
- return NULL;
- }
- char *machine_name = NULL;
- size_t number = 0;
- int err = 1;
- int index = -1;
-
-
- /* Try to find the line correponding to this processor */
- while((err = getdelim(&machine_name, &number, ' ', conf)) != -1) {
- while(err == 1){
- err = getdelim(&machine_name, &number, ' ', conf);
- }
- if(err == -1) break;
- XBT_DEBUG(
- "read: %s cmp to %s\n", machine_name, name);
- /* the first element is in machine_name
- it's normally a processor name */
- /* remove the delimiter before doing the comparison*/
- machine_name[strlen(machine_name)-1] = 0;
-
- if(strcmp(machine_name,name) == 0){
- /* the machine name match */
-
- /* try to get for which process with the index*/
- char* char_index=NULL;
- err = getdelim(&char_index, &number, ' ', conf);
- while(err == 1){
- err = getdelim(&char_index, &number, ' ', conf);
- }
- if(err == -1) break;
-
- index=atoi(char_index);
- XBT_DEBUG(
- "read: %d cmp to %d\n",
- index, mynoderank);
-
- if(index == mynoderank){
- /* we have found the good line
- * we rebuild the line to get every information*/
- char* line = NULL;
- number = 0;
- if (getline(&line,&number,conf) == -1)
- xbt_die("Cannot get line");
- char* line1 = NULL;
- asprintf(&line1,"%s %s %s",name,char_index,line);
- return get_list_param(line1);
- }
- }
-
- /*prepare for the next line*/
- free(machine_name);
- machine_name = NULL;
- number = 0;
- err = getline(&machine_name, &number, conf);
- if (err >= 1) {
- free(machine_name);
- machine_name = NULL;
- number = 0;
- }
-
- }
- XBT_DEBUG(
- "No configuration for %s %d\n", name, mynoderank );
- return NULL;
-}
-
-
-
-
-void print_conf(MPI_Comm comm, int rank, FILE* file, char * default_options){
- char name[MPI_MAX_PROCESSOR_NAME];
- int len;
- MPI_Get_processor_name(name, &len);
- if(file == NULL) file = stdout;
-
- MPI_Comm comm_node;
- split_comm_intra_node(comm, &comm_node, 0);
-
- char ** names = get_names(comm);
- int* index = get_index( comm, comm_node);
- MPI_Comm_free(&comm_node);
- int size;
- MPI_Comm_size(comm, &size);
- int i=0;
- if(rank == 0){
- fprintf(file, "#processor_name index USER ARGS (like the cpu binding ...)\n");
- for(i = 0; i < size; i++){
- if(default_options != NULL)
- fprintf(file, "%s %d %s\n", names[i],index[i],default_options);
- else
- fprintf(file, "%s %d\n", names[i],index[i]);
- }
- }
- free(names);
- free(index);
- return;
-}
+++ /dev/null
-#ifndef param_H_
-#define param_H_
-
-#include <stdio.h>
-
-/*!
- * \page param Provide specific parameters to some processes
- * List of functions:
- * - get_conf - reads a file and returns the specific parameters for the process
- * - print_conf - prints the file for the platform used for this execution
- *
- * here an examples of file:
- *
- * \include utils/param_template_file.txt
- *
- * each process will get the list of arguments specific to its.
- *
- * for example, the process 3<sup>th</sup> on the node1 will receive a pointer
- * on an array of char*:
- *
- *
- * "node1" "2" "node1_arg21" "node1_arg22" "node1_arg2"
- */
-
-/*! reads a file and returns the specific parameters for the process */
-char** get_conf(MPI_Comm comm, const char * filename, int mynoderank);
-
-
-/*! prints the file for the platform used for this execution */
-void print_conf(MPI_Comm comm, int rank, FILE* file, char * default_options);
-
-#endif /*param_H_*/
+++ /dev/null
-node1 0 node1_arg01 node1_arg02 node1_arg03
-node1 1 node1_arg11 node1_arg12 node1_arg13
-node1 2 node1_arg21 node1_arg22 node1_arg23
-node1 3 node1_arg31 node1_arg32 node1_arg33
-node2 0 node2_arg01 node2_arg02 node2_arg03
-node2 1 node2_arg11 node2_arg12 node2_arg13
-node3 0 node3_arg01 node3_arg02 node3_arg03
-node3 1 node3_arg11 node3_arg12 node3_arg13
-node3 2 node3_arg21 node3_arg22 node3_arg23
+++ /dev/null
-/*!
- * get the information of which thread are on the same node
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "topo.h"
-
-int split_comm_intra_node(MPI_Comm comm, MPI_Comm* comm_intra, int key) {
- // collect processor names
- char name[MPI_MAX_PROCESSOR_NAME];
- int len;
- int size;
- char** names = get_names(comm);
- int color = -1;
- int i = 0;
-
- MPI_Get_processor_name(name, &len);
- MPI_Comm_size(comm, &size);
- while (i < size){
- if (strcmp(name, names[i]) == 0) {
- break;
- }
- i++;
- }
- color = i;
- free(names);
- // split the communicator
- return MPI_Comm_split(comm, color, key, comm_intra);
-}
-
-char** get_names(MPI_Comm comm){
- char name[MPI_MAX_PROCESSOR_NAME];
- int len;
- int size;
- int i;
- char** friendly_names;
- char* names;
-
- MPI_Get_processor_name(name, &len);
- MPI_Comm_size(comm, &size);
- friendly_names = malloc(sizeof(char*) * size);
- names = malloc(sizeof(char) * MPI_MAX_PROCESSOR_NAME * size);
-
- MPI_Allgather(name, MPI_MAX_PROCESSOR_NAME, MPI_CHAR, names,
- MPI_MAX_PROCESSOR_NAME, MPI_CHAR, comm);
-
- for( i = 0; i < size;i++) friendly_names[i] = &names[MPI_MAX_PROCESSOR_NAME * i];
- return friendly_names;
-}
-
-int* get_index(MPI_Comm comm, MPI_Comm comm_intra){
- int rank = 0;
- int size;
- int* index;
-
- MPI_Comm_rank(comm_intra, &rank);
- MPI_Comm_size(comm, &size);
- index = (int*)malloc(sizeof(int) * size);
- MPI_Allgather(&rank, 1, MPI_INT, index, 1, MPI_INT, comm);
- return index;
-}
-
+++ /dev/null
-#ifndef topo_H_
-#define topo_H_
-#include <mpi.h>
-
-/*!
- * \defgroup topo.h
- * file related to the plateform description.
- *
- * provide a communicator between the process on the same node*/
-int split_comm_intra_node(MPI_Comm comm, MPI_Comm* comm_intra, int key);
-
-
-int* get_index(MPI_Comm comm, MPI_Comm comm_intra);
-char** get_names(MPI_Comm comm);
-
-#endif /*topo_H_*/
@simgrid_need_asprintf@
@simgrid_need_vasprintf@
+#include <stdio.h> /* FILE, getline if it exists */
+
/* Use that config to declare missing elements */
#ifdef SIMGRID_NEED_GETLINE
#include <stdlib.h> /* size_t */
-#include <stdio.h> /* FILE* */
XBT_PUBLIC(long) getline(char **lineptr, size_t * n, FILE * stream);
-#else
-#ifndef _GNU_SOURCE
- #define _GNU_SOURCE
-#endif
-#include <stdio.h>
#endif
+
#include <stdarg.h>
/* snprintf related functions */
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@
#ifndef XBT_MISC_H
#define XBT_MISC_H
+/* Define _GNU_SOURCE for getline, isfinite, etc. */
+#ifndef _GNU_SOURCE
+ #define _GNU_SOURCE
+#endif
+
/* Attributes are only in recent versions of GCC */
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4))
# define _XBT_GNUC_PRINTF( format_idx, arg_idx ) \
#ifndef _XBT_SYSDEP_H
#define _XBT_SYSDEP_H
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h> /* va_list */
-
#include "xbt/log.h"
#include "xbt/misc.h"
#include "xbt/asserts.h"
#include "simgrid_config.h"
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h> /* va_list */
+
SG_BEGIN_DECL()
/* They live in asserts.h, but need to be declared before this module.
#ifndef _SURF_MAXMIN_H
#define _SURF_MAXMIN_H
-#include <math.h>
#include "portable.h"
#include "xbt/misc.h"
#include "surf/datatypes.h"
+#include <math.h>
extern double sg_maxmin_precision;
#define MAXMIN_PRECISION sg_maxmin_precision
#include "xbt/heap.h"
#include "xbt/dict.h"
-#include <stdlib.h>
-#include <math.h>
SG_BEGIN_DECL()
*/
-#include <stdio.h>
-
#include "xbt/asserts.h"
#include "xbt/dynar.h"
#include "instr/jedule/jedule_platform.h"
#include "instr/jedule/jedule_output.h"
+#include <stdio.h>
+
#ifdef HAVE_JEDULE
XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule");
if (reg.start_addr == std_heap){ // only save the std heap (and not the raw one)
MC_snapshot_add_region(snapshot, 0, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
}
+ i++;
} else {
if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
+ i++;
+ reg = maps->regions[i];
+ while(reg.pathname == NULL && (reg.prot & PROT_WRITE) && i < maps->mapsize){
+ MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
+ i++;
+ reg = maps->regions[i];
+ }
+ }else{
+ i++;
}
}
+ }else{
+ i++;
}
- i++;
}
free_memory_map(maps);
void *heap = NULL;
/* Save the std heap and the writable mapped pages of libsimgrid */
- while (i < maps->mapsize && nb_reg < 3) {
+ while (i < maps->mapsize) {
reg = maps->regions[i];
if ((reg.prot & PROT_WRITE)){
if (maps->regions[i].pathname == NULL){
heap = snapshot->regions[nb_reg]->data;
nb_reg++;
}
+ i++;
} else {
if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
- nb_reg++;
start_data_libsimgrid = reg.start_addr;
+ nb_reg++;
+ i++;
+ reg = maps->regions[i];
+ while(reg.pathname == NULL && (reg.prot & PROT_WRITE) && i < maps->mapsize){
+ MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
+ i++;
+ reg = maps->regions[i];
+ nb_reg++;
+ }
} else {
if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
MC_snapshot_add_region(snapshot, 2, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
nb_reg++;
}
+ i++;
}
}
}else if ((reg.prot & PROT_READ)){
}
}
}
+ i++;
+ }else{
+ i++;
}
- i++;
}
snapshot->stacks = take_snapshot_stacks(heap);
//XBT_INFO("Variable : %s - address : NULL", current_variable->name);
xbt_strbuff_append(variables, bprintf("%s=NULL\n", current_variable->name));
}else if(((long)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1,variable_value_t)->value.address) > 0xffffffff) || ((long)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1,variable_value_t)->value.address) < (long)start_text_binary)){
- //XBT_INFO("Variable : %s - value : %d", current_variable->name, (int)(long long int)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address));
- xbt_strbuff_append(variables, bprintf("%s=%d\n", current_variable->name, (int)(long long int)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address)));
+ //XBT_INFO("Variable : %s - value : %zd", current_variable->name, (size_t)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address));
+ xbt_strbuff_append(variables, bprintf("%s=%zd\n", current_variable->name, (size_t)*((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address)));
}else{
//XBT_INFO("Variable : %s - address : %p", current_variable->name, *((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address));
xbt_strbuff_append(variables, bprintf("%s=%p\n", current_variable->name, *((void**)xbt_dynar_get_as(compose, xbt_dynar_length(compose) - 1, variable_value_t)->value.address)));
#include "smx_private.h"
#include "mc/mc.h"
#include "xbt/ex.h"
-
-#ifndef _SVID_SOURCE
-# define _SVID_SOURCE /* strdup() */
-#endif
-#ifndef _ISOC99_SOURCE
-# define _ISOC99_SOURCE /* isfinite() */
-#endif
-#ifndef _ISO_C99_SOURCE
-# define _ISO_C99_SOURCE /* isfinite() */
-#endif
#include <math.h> /* isfinite() */
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <math.h> // sqrt
#include "private.h"
#include "xbt/dict.h"
#include "xbt/sysdep.h"
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
+#include <math.h> // sqrt
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include "surf/random_mgr.h"
#include "xbt/sysdep.h"
#include "gras_config.h" /*_XBT_WIN32*/
+#include <math.h>
+#include <stdlib.h>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(random, surf, "Random part of surf");
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <ctype.h>
-
#include "surf_private.h"
#include "xbt/module.h"
#include "mc/mc.h"
#include "surf/surf_resource.h"
#include "xbt/xbt_os_thread.h"
+#include <ctype.h>
+
XBT_LOG_NEW_CATEGORY(surf, "All SURF categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf,
"Logging specific to SURF (kernel)");
/* surf_config: configuration infrastructure for the simulation world */
+#include "xbt/misc.h"
#include "xbt/config.h"
#include "xbt/log.h"
#include "xbt/str.h"
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <pcre.h> /* regular expression library */
-
#include "simgrid/platf_interface.h" // platform creation API internal interface
#include "surf_routing_private.h"
#include "surf/surf_routing.h"
#include "surf/surfxml_parse_values.h"
+#include <pcre.h> /* regular expression library */
+
/**
* @ingroup SURF_build_api
* @brief A library containing all known workstations
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <pcre.h> /* regular expression library */
-
#include "simgrid/platf_interface.h" // platform creation API internal interface
#include "surf_routing_private.h"
#include "surf/surf_routing.h"
#include "surf/surfxml_parse_values.h"
+#include <pcre.h> /* regular expression library */
+
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
static int no_bypassroute_declared = 1;
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
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->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;
void free(void *p)
{
- xbt_mheap_t mdp = __mmalloc_current_heap ?: (xbt_mheap_t) mmalloc_preinit();
+ if (p != NULL) {
+ xbt_mheap_t mdp = __mmalloc_current_heap ?: (xbt_mheap_t) mmalloc_preinit();
- LOCK(mdp);
- mfree(mdp, p);
- UNLOCK(mdp);
+ LOCK(mdp);
+ mfree(mdp, p);
+ UNLOCK(mdp);
+ }
}
#endif
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <math.h> /* floor */
-
#include "portable.h"
#include "xbt/sysdep.h"
#include "gras/virtu.h"
#include "xbt/xbt_os_time.h" /* private */
+#include <math.h> /* floor */
+
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_virtu);
double xbt_time(void)
{
#endif
-#include <stdlib.h>
-#include <stdio.h>
#include "surf/maxmin.h"
#include "xbt/module.h"
#include "xbt/xbt_os_time.h"
#include "xbt/sysdep.h" /* time manipulation for benchmarking */
+#include <stdlib.h>
+#include <stdio.h>
+
double date;
double float_random(double max);
#pragma hdrstop
#endif
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
#include "surf/trace_mgr.h"
#include "surf/surf.h"
#include "xbt/log.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
"Messages specific for surf example");