|
|
25845f |
commit bdfe308a166b433a841d5c9ae256560c18bce640
|
|
|
25845f |
Author: Ondřej Bílka <neleai@seznam.cz>
|
|
|
25845f |
Date: Mon Feb 10 12:25:04 2014 +0100
|
|
|
25845f |
|
|
|
25845f |
Remove THREAD_STATS.
|
|
|
25845f |
|
|
|
25845f |
A THREAD_STATS macro duplicates gathering information that could be
|
|
|
25845f |
obtained by systemtap probes instead.
|
|
|
25845f |
|
|
|
25845f |
Conflicts:
|
|
|
25845f |
malloc/arena.c
|
|
|
25845f |
malloc/malloc.c
|
|
|
25845f |
|
|
|
25845f |
Textual conflicts due to independent malloc backports.
|
|
|
25845f |
|
|
|
25845f |
diff --git a/malloc/arena.c b/malloc/arena.c
|
|
|
25845f |
index f5e97fadc17ad92d..fe4ec8de614454c9 100644
|
|
|
25845f |
--- a/malloc/arena.c
|
|
|
25845f |
+++ b/malloc/arena.c
|
|
|
25845f |
@@ -40,14 +40,6 @@
|
|
|
25845f |
mmap threshold, so that requests with a size just below that
|
|
|
25845f |
threshold can be fulfilled without creating too many heaps. */
|
|
|
25845f |
|
|
|
25845f |
-
|
|
|
25845f |
-#ifndef THREAD_STATS
|
|
|
25845f |
-#define THREAD_STATS 0
|
|
|
25845f |
-#endif
|
|
|
25845f |
-
|
|
|
25845f |
-/* If THREAD_STATS is non-zero, some statistics on mutex locking are
|
|
|
25845f |
- computed. */
|
|
|
25845f |
-
|
|
|
25845f |
/***************************************************************************/
|
|
|
25845f |
|
|
|
25845f |
#define top(ar_ptr) ((ar_ptr)->top)
|
|
|
25845f |
@@ -101,13 +93,6 @@ static mstate free_list;
|
|
|
25845f |
acquired. */
|
|
|
25845f |
static mutex_t list_lock = MUTEX_INITIALIZER;
|
|
|
25845f |
|
|
|
25845f |
-#if THREAD_STATS
|
|
|
25845f |
-static int stat_n_heaps;
|
|
|
25845f |
-#define THREAD_STAT(x) x
|
|
|
25845f |
-#else
|
|
|
25845f |
-#define THREAD_STAT(x) do ; while(0)
|
|
|
25845f |
-#endif
|
|
|
25845f |
-
|
|
|
25845f |
/* Mapped memory in non-main arenas (reliable only for NO_THREADS). */
|
|
|
25845f |
static unsigned long arena_mem;
|
|
|
25845f |
|
|
|
25845f |
@@ -583,7 +568,6 @@ new_heap(size_t size, size_t top_pad)
|
|
|
25845f |
h = (heap_info *)p2;
|
|
|
25845f |
h->size = size;
|
|
|
25845f |
h->mprotect_size = size;
|
|
|
25845f |
- THREAD_STAT(stat_n_heaps++);
|
|
|
25845f |
LIBC_PROBE (memory_heap_new, 2, h, h->size);
|
|
|
25845f |
return h;
|
|
|
25845f |
}
|
|
|
25845f |
@@ -811,8 +795,6 @@ _int_new_arena(size_t size)
|
|
|
25845f |
|
|
|
25845f |
(void) mutex_lock (&a->mutex);
|
|
|
25845f |
|
|
|
25845f |
- THREAD_STAT(++(a->stat_lock_loop));
|
|
|
25845f |
-
|
|
|
25845f |
return a;
|
|
|
25845f |
}
|
|
|
25845f |
|
|
|
25845f |
@@ -844,7 +826,6 @@ get_free_list (void)
|
|
|
25845f |
LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
|
|
|
25845f |
(void)mutex_lock(&result->mutex);
|
|
|
25845f |
tsd_setspecific(arena_key, (void *)result);
|
|
|
25845f |
- THREAD_STAT(++(result->stat_lock_loop));
|
|
|
25845f |
}
|
|
|
25845f |
}
|
|
|
25845f |
|
|
|
25845f |
@@ -941,7 +922,6 @@ reused_arena (mstate avoid_arena)
|
|
|
25845f |
}
|
|
|
25845f |
LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
|
|
|
25845f |
tsd_setspecific(arena_key, (void *)result);
|
|
|
25845f |
- THREAD_STAT(++(result->stat_lock_loop));
|
|
|
25845f |
next_to_use = result->next;
|
|
|
25845f |
|
|
|
25845f |
return result;
|
|
|
25845f |
diff --git a/malloc/malloc.c b/malloc/malloc.c
|
|
|
25845f |
index fc86b344ee3b3a7c..9d3b24ee0c137a1b 100644
|
|
|
25845f |
--- a/malloc/malloc.c
|
|
|
25845f |
+++ b/malloc/malloc.c
|
|
|
25845f |
@@ -1712,11 +1712,6 @@ struct malloc_state {
|
|
|
25845f |
/* Flags (formerly in max_fast). */
|
|
|
25845f |
int flags;
|
|
|
25845f |
|
|
|
25845f |
-#if THREAD_STATS
|
|
|
25845f |
- /* Statistics for locking. Only used if THREAD_STATS is defined. */
|
|
|
25845f |
- long stat_lock_direct, stat_lock_loop, stat_lock_wait;
|
|
|
25845f |
-#endif
|
|
|
25845f |
-
|
|
|
25845f |
/* Fastbins */
|
|
|
25845f |
mfastbinptr fastbinsY[NFASTBINS];
|
|
|
25845f |
|
|
|
25845f |
@@ -3015,17 +3010,7 @@ __libc_realloc(void* oldmem, size_t bytes)
|
|
|
25845f |
return newmem;
|
|
|
25845f |
}
|
|
|
25845f |
|
|
|
25845f |
-#if THREAD_STATS
|
|
|
25845f |
- if(!mutex_trylock(&ar_ptr->mutex))
|
|
|
25845f |
- ++(ar_ptr->stat_lock_direct);
|
|
|
25845f |
- else {
|
|
|
25845f |
- (void)mutex_lock(&ar_ptr->mutex);
|
|
|
25845f |
- ++(ar_ptr->stat_lock_wait);
|
|
|
25845f |
- }
|
|
|
25845f |
-#else
|
|
|
25845f |
(void)mutex_lock(&ar_ptr->mutex);
|
|
|
25845f |
-#endif
|
|
|
25845f |
-
|
|
|
25845f |
|
|
|
25845f |
newp = _int_realloc(ar_ptr, oldp, oldsize, nb);
|
|
|
25845f |
|
|
|
25845f |
@@ -3941,16 +3926,7 @@ _int_free(mstate av, mchunkptr p, int have_lock)
|
|
|
25845f |
|
|
|
25845f |
else if (!chunk_is_mmapped(p)) {
|
|
|
25845f |
if (! have_lock) {
|
|
|
25845f |
-#if THREAD_STATS
|
|
|
25845f |
- if(!mutex_trylock(&av->mutex))
|
|
|
25845f |
- ++(av->stat_lock_direct);
|
|
|
25845f |
- else {
|
|
|
25845f |
- (void)mutex_lock(&av->mutex);
|
|
|
25845f |
- ++(av->stat_lock_wait);
|
|
|
25845f |
- }
|
|
|
25845f |
-#else
|
|
|
25845f |
(void)mutex_lock(&av->mutex);
|
|
|
25845f |
-#endif
|
|
|
25845f |
locked = 1;
|
|
|
25845f |
}
|
|
|
25845f |
|
|
|
25845f |
@@ -4713,9 +4689,6 @@ __malloc_stats (void)
|
|
|
25845f |
int i;
|
|
|
25845f |
mstate ar_ptr;
|
|
|
25845f |
unsigned int in_use_b = mp_.mmapped_mem, system_b = in_use_b;
|
|
|
25845f |
-#if THREAD_STATS
|
|
|
25845f |
- long stat_lock_direct = 0, stat_lock_loop = 0, stat_lock_wait = 0;
|
|
|
25845f |
-#endif
|
|
|
25845f |
|
|
|
25845f |
if(__malloc_initialized < 0)
|
|
|
25845f |
ptmalloc_init ();
|
|
|
25845f |
@@ -4737,11 +4710,6 @@ __malloc_stats (void)
|
|
|
25845f |
#endif
|
|
|
25845f |
system_b += mi.arena;
|
|
|
25845f |
in_use_b += mi.uordblks;
|
|
|
25845f |
-#if THREAD_STATS
|
|
|
25845f |
- stat_lock_direct += ar_ptr->stat_lock_direct;
|
|
|
25845f |
- stat_lock_loop += ar_ptr->stat_lock_loop;
|
|
|
25845f |
- stat_lock_wait += ar_ptr->stat_lock_wait;
|
|
|
25845f |
-#endif
|
|
|
25845f |
(void)mutex_unlock(&ar_ptr->mutex);
|
|
|
25845f |
ar_ptr = ar_ptr->next;
|
|
|
25845f |
if(ar_ptr == &main_arena) break;
|
|
|
25845f |
@@ -4752,14 +4720,6 @@ __malloc_stats (void)
|
|
|
25845f |
fprintf(stderr, "max mmap regions = %10u\n", (unsigned int)mp_.max_n_mmaps);
|
|
|
25845f |
fprintf(stderr, "max mmap bytes = %10lu\n",
|
|
|
25845f |
(unsigned long)mp_.max_mmapped_mem);
|
|
|
25845f |
-#if THREAD_STATS
|
|
|
25845f |
- fprintf(stderr, "heaps created = %10d\n", stat_n_heaps);
|
|
|
25845f |
- fprintf(stderr, "locked directly = %10ld\n", stat_lock_direct);
|
|
|
25845f |
- fprintf(stderr, "locked in loop = %10ld\n", stat_lock_loop);
|
|
|
25845f |
- fprintf(stderr, "locked waiting = %10ld\n", stat_lock_wait);
|
|
|
25845f |
- fprintf(stderr, "locked total = %10ld\n",
|
|
|
25845f |
- stat_lock_direct + stat_lock_loop + stat_lock_wait);
|
|
|
25845f |
-#endif
|
|
|
25845f |
((_IO_FILE *) stderr)->_flags2 |= old_flags2;
|
|
|
25845f |
_IO_funlockfile (stderr);
|
|
|
25845f |
}
|