From 5928e78bef31beea241b2640eea8c559c28df754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lau=20Mercadal=20Meli=C3=A0?= Date: Wed, 12 Jun 2019 15:30:38 +0200 Subject: [PATCH] Increases static buffer for `calloc` to 8MB Change-Id: I9bc031d4766943e98199d7dd7b1bf7829fcc2e5b --- ChangeLog | 1 + src/common/common.h | 4 ++++ src/tracer/wrappers/API/wrapper.c | 4 +--- src/tracer/wrappers/MALLOC/malloc_wrapper.c | 10 +++++----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60e6371c..7399dd50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ ChangeLog * 11Jun2019 Fixes bug in MPI_Wait where the input request is not copied for later processing * 25Apr2019 Fixes race conditions between thread creations and PEBS samples * 17Apr2019 Fixes bug in pebs sampling store misses identification + * 03Jun2019 Increases static buffer for `calloc` to 8MB * 02Apr2019 Adds support for changing num_threads in OpenMP parallel constructs * 29Mar2019 Changes order in which MPI env vars are checked to discover process' task id during auto init * 28Mar2019 Extends support for PEBS sampling on Skylake processors, xml 'period' attribute changed to 'frequency' diff --git a/src/common/common.h b/src/common/common.h index 526e2ba8..aba7f686 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -58,6 +58,10 @@ #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) +#define KB * 1024 +#define MB * 1024 KB +#define GB * 1024 MB + #define MPTRACE_ERROR(x) \ if ( (x) != 0 ) return (-1) diff --git a/src/tracer/wrappers/API/wrapper.c b/src/tracer/wrappers/API/wrapper.c index 4115bf15..59b451c6 100644 --- a/src/tracer/wrappers/API/wrapper.c +++ b/src/tracer/wrappers/API/wrapper.c @@ -298,8 +298,6 @@ unsigned int min_BufferSize = EVT_NUM; unsigned int buffer_size = EVT_NUM; unsigned file_size = 0; -#define MBytes *1024*1024 - static unsigned current_NumOfThreads = 1; static unsigned maximum_NumOfThreads = 1; @@ -2294,7 +2292,7 @@ int Extrae_Flush_Wrapper (Buffer_t *buffer) check_size = !hasMinimumTracingTime || (hasMinimumTracingTime && (TIME > MinimumTracingTime+initTracingTime)); if (file_size > 0 && check_size) { - if ((current_size = Buffer_GetFileSize (buffer)) >= file_size MBytes) + if ((current_size = Buffer_GetFileSize (buffer)) >= file_size MB) { if (THREADID == 0) { diff --git a/src/tracer/wrappers/MALLOC/malloc_wrapper.c b/src/tracer/wrappers/MALLOC/malloc_wrapper.c index 39a5d549..a954a1f8 100644 --- a/src/tracer/wrappers/MALLOC/malloc_wrapper.c +++ b/src/tracer/wrappers/MALLOC/malloc_wrapper.c @@ -232,7 +232,7 @@ void *malloc (size_t s) return res; } -#define DLSYM_CALLOC_SIZE 8192 +#define DLSYM_CALLOC_SIZE 8 MB /* * Static buffer to return when calloc is called from within dlsym and we don't * have the pointer to the real calloc function @@ -332,10 +332,10 @@ void *calloc (size_t nmemb, size_t size) /* Check if the requested size fits in the static buffer */ if ((nmemb*size) > DLSYM_CALLOC_SIZE) { - fprintf (stderr, PACKAGE_NAME - ": The size requested by calloc is bigger" - " than DLSYM_CALLOC_SIZE, please increase its" - " value and recompile.\n"); + fprintf(stderr, PACKAGE_NAME + ": The size requested by calloc (%zu) is bigger" + " than DLSYM_CALLOC_SIZE, please increase its value and" + "recompile.\n", nmemb*size); abort(); }