From 46cdade983b7447c8a2e0160b0fc52b90f7aeba2 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Sun, 1 Jun 2014 01:34:32 +0200 Subject: [PATCH] Enable per-thread unwind caching. This is much more performant as libunwind will not also add another serialization point, it will also trigger calls to sigprocmask for every mutex lock/unlock. --- malloctrace.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/malloctrace.cpp b/malloctrace.cpp index d672ef1..cfcf2a8 100644 --- a/malloctrace.cpp +++ b/malloctrace.cpp @@ -407,6 +407,10 @@ void init() real_valloc = findReal("valloc"); real_aligned_alloc = findReal("aligned_alloc"); + if (unw_set_caching_policy(unw_local_addr_space, UNW_CACHE_PER_THREAD)) { + fprintf(stderr, "Failed to enable per-thread libunwind caching.\n"); + } + data.reset(new Data); } -- 2.7.4