Enable per-thread unwind caching.
authorMilian Wolff <mail@milianw.de>
Sat, 31 May 2014 23:34:32 +0000 (01:34 +0200)
committerMilian Wolff <mail@milianw.de>
Mon, 2 Jun 2014 09:31:36 +0000 (11:31 +0200)
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

index d672ef1..cfcf2a8 100644 (file)
@@ -407,6 +407,10 @@ void init()
     real_valloc = findReal<valloc_t>("valloc");
     real_aligned_alloc = findReal<aligned_alloc_t>("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);
 }