diff --git a/Makefile.am b/Makefile.am index 4a9de2b..ddcbbf8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ umem_test2_SOURCES = umem_test2.c umem_test2_LDADD = -lumem umem_test3_SOURCES = umem_test3.c -umem_test3_LDADD = -lumem +umem_test3_LDADD = -lumem -lumem_malloc libumem_la_SOURCES = init_lib.c \ umem_agent_support.c \ diff --git a/configure.ac b/configure.ac index b56d557..6166f4b 100644 --- a/configure.ac +++ b/configure.ac @@ -7,8 +7,23 @@ AC_PROG_LIBTOOL AC_C_INLINE -AC_CHECK_HEADERS([sys/mman.h sys/sysmacros.h sys/time.h]) -AC_CHECK_FUNCS([issetugid]) +AC_MSG_CHECKING([whether pthread_mutex_t is larger than 24 bytes]) +AC_TRY_RUN( + [ +#include +int main(void){return (sizeof(pthread_mutex_t) > 24);} + ], + [AC_MSG_RESULT(yes)], + [ + AC_MSG_RESULT(no) + AC_DEFINE(UMEM_PTHREAD_MUTEX_TOO_BIG, [1], [need bigger cache]) + AC_MSG_WARN([*** increasing umem cpu cache size to compensate.]) + ] +) + + +AC_CHECK_HEADERS([sys/mman.h sys/sysmacros.h sys/time.h malloc.h]) +AC_CHECK_FUNCS([issetugid mallinfo malloc_stats]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile Doxyfile umem.spec]) diff --git a/umem_test3.c b/umem_test3.c index bcbb231..88845d1 100644 --- a/umem_test3.c +++ b/umem_test3.c @@ -1,14 +1,35 @@ +#include "config.h" #include #include #include +#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) +#include +#endif + +static void minfo(void) +{ +#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) + struct mallinfo mi; + mi = mallinfo(); + printf(" fordblks = %d\n", mi.fordblks); + malloc_stats(); + printf("\n"); +#endif +} + int main (void) { char *p; + minfo(); p = malloc(10); free(p); + minfo(); return EXIT_SUCCESS; } + +/* vim:ts=2:sw=2:et: + */