diff options
Diffstat (limited to 'malloc')
-rw-r--r-- | malloc/arena.c | 20 | ||||
-rw-r--r-- | malloc/malloc.c | 40 |
2 files changed, 0 insertions, 60 deletions
diff --git a/malloc/arena.c b/malloc/arena.c index 5088a253ec..71678a9dc4 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -37,14 +37,6 @@ mmap threshold, so that requests with a size just below that threshold can be fulfilled without creating too many heaps. */ - -#ifndef THREAD_STATS -# define THREAD_STATS 0 -#endif - -/* If THREAD_STATS is non-zero, some statistics on mutex locking are - computed. */ - /***************************************************************************/ #define top(ar_ptr) ((ar_ptr)->top) @@ -79,13 +71,6 @@ static mutex_t list_lock = MUTEX_INITIALIZER; static size_t narenas = 1; static mstate free_list; -#if THREAD_STATS -static int stat_n_heaps; -# define THREAD_STAT(x) x -#else -# define THREAD_STAT(x) do ; while (0) -#endif - /* Mapped memory in non-main arenas (reliable only for NO_THREADS). */ static unsigned long arena_mem; @@ -593,7 +578,6 @@ new_heap (size_t size, size_t top_pad) h = (heap_info *) p2; h->size = size; h->mprotect_size = size; - THREAD_STAT (stat_n_heaps++); LIBC_PROBE (memory_heap_new, 2, h, h->size); return h; } @@ -777,8 +761,6 @@ _int_new_arena (size_t size) (void) mutex_unlock (&list_lock); - THREAD_STAT (++(a->stat_lock_loop)); - return a; } @@ -800,7 +782,6 @@ get_free_list (void) LIBC_PROBE (memory_arena_reuse_free_list, 1, result); (void) mutex_lock (&result->mutex); tsd_setspecific (arena_key, (void *) result); - THREAD_STAT (++(result->stat_lock_loop)); } } @@ -840,7 +821,6 @@ reused_arena (mstate avoid_arena) out: LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena); tsd_setspecific (arena_key, (void *) result); - THREAD_STAT (++(result->stat_lock_loop)); next_to_use = result->next; return result; diff --git a/malloc/malloc.c b/malloc/malloc.c index 813e94eea3..4f209995ad 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1672,11 +1672,6 @@ struct malloc_state /* Flags (formerly in max_fast). */ int flags; -#if THREAD_STATS - /* Statistics for locking. Only used if THREAD_STATS is defined. */ - long stat_lock_direct, stat_lock_loop, stat_lock_wait; -#endif - /* Fastbins */ mfastbinptr fastbinsY[NFASTBINS]; @@ -3010,17 +3005,7 @@ __libc_realloc (void *oldmem, size_t bytes) } ar_ptr = arena_for_chunk (oldp); -#if THREAD_STATS - if (!mutex_trylock (&ar_ptr->mutex)) - ++(ar_ptr->stat_lock_direct); - else - { - (void) mutex_lock (&ar_ptr->mutex); - ++(ar_ptr->stat_lock_wait); - } -#else (void) mutex_lock (&ar_ptr->mutex); -#endif newp = _int_realloc (ar_ptr, oldp, oldsize, nb); @@ -3929,16 +3914,7 @@ _int_free (mstate av, mchunkptr p, int have_lock) else if (!chunk_is_mmapped(p)) { if (! have_lock) { -#if THREAD_STATS - if(!mutex_trylock(&av->mutex)) - ++(av->stat_lock_direct); - else { - (void)mutex_lock(&av->mutex); - ++(av->stat_lock_wait); - } -#else (void)mutex_lock(&av->mutex); -#endif locked = 1; } @@ -4681,9 +4657,6 @@ __malloc_stats (void) int i; mstate ar_ptr; unsigned int in_use_b = mp_.mmapped_mem, system_b = in_use_b; -#if THREAD_STATS - long stat_lock_direct = 0, stat_lock_loop = 0, stat_lock_wait = 0; -#endif if (__malloc_initialized < 0) ptmalloc_init (); @@ -4706,11 +4679,6 @@ __malloc_stats (void) #endif system_b += mi.arena; in_use_b += mi.uordblks; -#if THREAD_STATS - stat_lock_direct += ar_ptr->stat_lock_direct; - stat_lock_loop += ar_ptr->stat_lock_loop; - stat_lock_wait += ar_ptr->stat_lock_wait; -#endif (void) mutex_unlock (&ar_ptr->mutex); ar_ptr = ar_ptr->next; if (ar_ptr == &main_arena) @@ -4722,14 +4690,6 @@ __malloc_stats (void) fprintf (stderr, "max mmap regions = %10u\n", (unsigned int) mp_.max_n_mmaps); fprintf (stderr, "max mmap bytes = %10lu\n", (unsigned long) mp_.max_mmapped_mem); -#if THREAD_STATS - fprintf (stderr, "heaps created = %10d\n", stat_n_heaps); - fprintf (stderr, "locked directly = %10ld\n", stat_lock_direct); - fprintf (stderr, "locked in loop = %10ld\n", stat_lock_loop); - fprintf (stderr, "locked waiting = %10ld\n", stat_lock_wait); - fprintf (stderr, "locked total = %10ld\n", - stat_lock_direct + stat_lock_loop + stat_lock_wait); -#endif ((_IO_FILE *) stderr)->_flags2 |= old_flags2; _IO_funlockfile (stderr); } |