aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/modules/mp/chained_pool
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-23 23:30:42 +1000
committerDavid Walter Seikel2012-01-23 23:30:42 +1000
commit825a3d837a33f226c879cd02ad15c3fba57e8b2c (patch)
tree75f57bd9c4253508d338dc79ba8e57a7abc42255 /libraries/eina/src/modules/mp/chained_pool
parentAdd ability to disable the test harness, or the Lua compile test. (diff)
downloadSledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.zip
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.gz
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.bz2
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.xz
Update the EFL to what I'm actually using, coz I'm using some stuff not yet released.
Diffstat (limited to 'libraries/eina/src/modules/mp/chained_pool')
-rw-r--r--libraries/eina/src/modules/mp/chained_pool/Makefile.in4
-rw-r--r--libraries/eina/src/modules/mp/chained_pool/eina_chained_mempool.c31
2 files changed, 30 insertions, 5 deletions
diff --git a/libraries/eina/src/modules/mp/chained_pool/Makefile.in b/libraries/eina/src/modules/mp/chained_pool/Makefile.in
index b728672..03b639f 100644
--- a/libraries/eina/src/modules/mp/chained_pool/Makefile.in
+++ b/libraries/eina/src/modules/mp/chained_pool/Makefile.in
@@ -163,7 +163,9 @@ EFL_SIMD_FLAGS = @EFL_SIMD_FLAGS@
163EGREP = @EGREP@ 163EGREP = @EGREP@
164EINA_CFLAGS = @EINA_CFLAGS@ 164EINA_CFLAGS = @EINA_CFLAGS@
165EINA_CONFIGURE_DEFAULT_MEMPOOL = @EINA_CONFIGURE_DEFAULT_MEMPOOL@ 165EINA_CONFIGURE_DEFAULT_MEMPOOL = @EINA_CONFIGURE_DEFAULT_MEMPOOL@
166EINA_CONFIGURE_ENABLE_LOG = @EINA_CONFIGURE_ENABLE_LOG@
166EINA_CONFIGURE_HAVE_DEBUG_THREADS = @EINA_CONFIGURE_HAVE_DEBUG_THREADS@ 167EINA_CONFIGURE_HAVE_DEBUG_THREADS = @EINA_CONFIGURE_HAVE_DEBUG_THREADS@
168EINA_CONFIGURE_HAVE_DIRENT_H = @EINA_CONFIGURE_HAVE_DIRENT_H@
167EINA_CONFIGURE_HAVE_INTTYPES_H = @EINA_CONFIGURE_HAVE_INTTYPES_H@ 169EINA_CONFIGURE_HAVE_INTTYPES_H = @EINA_CONFIGURE_HAVE_INTTYPES_H@
168EINA_CONFIGURE_HAVE_ON_OFF_THREADS = @EINA_CONFIGURE_HAVE_ON_OFF_THREADS@ 170EINA_CONFIGURE_HAVE_ON_OFF_THREADS = @EINA_CONFIGURE_HAVE_ON_OFF_THREADS@
169EINA_CONFIGURE_HAVE_STDINT_H = @EINA_CONFIGURE_HAVE_STDINT_H@ 171EINA_CONFIGURE_HAVE_STDINT_H = @EINA_CONFIGURE_HAVE_STDINT_H@
@@ -215,8 +217,6 @@ PACKAGE_URL = @PACKAGE_URL@
215PACKAGE_VERSION = @PACKAGE_VERSION@ 217PACKAGE_VERSION = @PACKAGE_VERSION@
216PATH_SEPARATOR = @PATH_SEPARATOR@ 218PATH_SEPARATOR = @PATH_SEPARATOR@
217PKG_CONFIG = @PKG_CONFIG@ 219PKG_CONFIG = @PKG_CONFIG@
218PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
219PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
220RANLIB = @RANLIB@ 220RANLIB = @RANLIB@
221SED = @SED@ 221SED = @SED@
222SET_MAKE = @SET_MAKE@ 222SET_MAKE = @SET_MAKE@
diff --git a/libraries/eina/src/modules/mp/chained_pool/eina_chained_mempool.c b/libraries/eina/src/modules/mp/chained_pool/eina_chained_mempool.c
index 009b62b..020d0ad 100644
--- a/libraries/eina/src/modules/mp/chained_pool/eina_chained_mempool.c
+++ b/libraries/eina/src/modules/mp/chained_pool/eina_chained_mempool.c
@@ -31,6 +31,10 @@
31# endif 31# endif
32#endif 32#endif
33 33
34#ifdef EINA_DEBUG_MALLOC
35# include <malloc.h>
36#endif
37
34#ifdef EFL_HAVE_WIN32_THREADS 38#ifdef EFL_HAVE_WIN32_THREADS
35# define WIN32_LEAN_AND_MEAN 39# define WIN32_LEAN_AND_MEAN
36# include <windows.h> 40# include <windows.h>
@@ -51,7 +55,7 @@
51# include <valgrind/memcheck.h> 55# include <valgrind/memcheck.h>
52#endif 56#endif
53 57
54#ifdef DEBUG 58#if defined DEBUG || defined EINA_DEBUG_MALLOC
55#include <assert.h> 59#include <assert.h>
56#include "eina_log.h" 60#include "eina_log.h"
57 61
@@ -74,6 +78,9 @@ struct _Chained_Mempool
74 int alloc_size; 78 int alloc_size;
75 int group_size; 79 int group_size;
76 int usage; 80 int usage;
81#ifdef EINA_DEBUG_MALLOC
82 int minimal_size;
83#endif
77#ifdef EFL_DEBUG_THREADS 84#ifdef EFL_DEBUG_THREADS
78 pthread_t self; 85 pthread_t self;
79#endif 86#endif
@@ -125,6 +132,20 @@ _eina_chained_mp_pool_new(Chained_Mempool *pool)
125 return NULL; 132 return NULL;
126 } 133 }
127 134
135#ifdef EINA_DEBUG_MALLOC
136 {
137 size_t sz;
138
139 sz = malloc_usable_size(p);
140 if (sz - pool->minimal_size > 0)
141 INF("Just allocated %0.2f%% to much memory in '%s' for one block of size %i that means %i bytes to much.",
142 ((float)(sz - pool->minimal_size) * 100) / (float) (pool->alloc_size),
143 pool->name,
144 pool->alloc_size,
145 sz - pool->minimal_size);
146 }
147#endif
148
128 alignof = eina_mempool_alignof(sizeof(Chained_Pool)); 149 alignof = eina_mempool_alignof(sizeof(Chained_Pool));
129 ptr = (unsigned char *)p + alignof; 150 ptr = (unsigned char *)p + alignof;
130 p->usage = 0; 151 p->usage = 0;
@@ -444,6 +465,10 @@ eina_chained_mempool_init(const char *context,
444 memcpy((char *)mp->name, context, length); 465 memcpy((char *)mp->name, context, length);
445 } 466 }
446 467
468#ifdef EINA_DEBUG_MALLOC
469 mp->minimal_size = item_size * mp->pool_size + sizeof(Chained_Pool);
470#endif
471
447 mp->item_alloc = eina_mempool_alignof(item_size); 472 mp->item_alloc = eina_mempool_alignof(item_size);
448 mp->group_size = mp->item_alloc * mp->pool_size; 473 mp->group_size = mp->item_alloc * mp->pool_size;
449 mp->alloc_size = mp->group_size + eina_mempool_alignof(sizeof(Chained_Pool)); 474 mp->alloc_size = mp->group_size + eina_mempool_alignof(sizeof(Chained_Pool));
@@ -517,7 +542,7 @@ static Eina_Mempool_Backend _eina_chained_mp_backend = {
517 542
518Eina_Bool chained_init(void) 543Eina_Bool chained_init(void)
519{ 544{
520#ifdef DEBUG 545#if defined DEBUG || defined EINA_DEBUG_MALLOC
521 _eina_chained_mp_log_dom = eina_log_domain_register("eina_mempool", 546 _eina_chained_mp_log_dom = eina_log_domain_register("eina_mempool",
522 EINA_LOG_COLOR_DEFAULT); 547 EINA_LOG_COLOR_DEFAULT);
523 if (_eina_chained_mp_log_dom < 0) 548 if (_eina_chained_mp_log_dom < 0)
@@ -533,7 +558,7 @@ Eina_Bool chained_init(void)
533void chained_shutdown(void) 558void chained_shutdown(void)
534{ 559{
535 eina_mempool_unregister(&_eina_chained_mp_backend); 560 eina_mempool_unregister(&_eina_chained_mp_backend);
536#ifdef DEBUG 561#if defined DEBUG || defined EINA_DEBUG_MALLOC
537 eina_log_domain_unregister(_eina_chained_mp_log_dom); 562 eina_log_domain_unregister(_eina_chained_mp_log_dom);
538 _eina_chained_mp_log_dom = -1; 563 _eina_chained_mp_log_dom = -1;
539#endif 564#endif