aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasatake YAMATO <yamato@redhat.com>2014-04-16 15:33:10 +0900
committerDmitry V. Levin <ldv@altlinux.org>2014-05-30 22:57:39 +0000
commita0b4ee7b38e600f28e547585e754b7737b388d90 (patch)
treea1930dc1b72b43678b06171d48b152b08e8435fe
parentb45b7faa1fc0373831fb00a3892de45b4df87232 (diff)
downloadandroid_external_strace-a0b4ee7b38e600f28e547585e754b7737b388d90.tar.gz
android_external_strace-a0b4ee7b38e600f28e547585e754b7737b388d90.tar.bz2
android_external_strace-a0b4ee7b38e600f28e547585e754b7737b388d90.zip
unwind: enable dwarf cache of libunwind
Here is the benchmark of the dwarf cache. Target program: #include <sched.h> int main(void) { unsigned int max = 0x6fff, i; for (i = 0; i < max; i++) sched_yield(); return 0; } Command line: ./strace -o /dev/null -k a.out With the dwarf cache: real 0m12.081s user 0m3.858s sys 0m8.194s Without the dwarf cache: real 0m22.326s user 0m5.218s sys 0m16.952s Signed-off-by: Masatake YAMATO <yamato@redhat.com>
-rw-r--r--unwind.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/unwind.c b/unwind.c
index 53191be4..797a287a 100644
--- a/unwind.c
+++ b/unwind.c
@@ -88,6 +88,7 @@ unwind_init(void)
libunwind_as = unw_create_addr_space(&_UPT_accessors, 0);
if (!libunwind_as)
error_msg_and_die("failed to create address space for stack tracing");
+ unw_set_caching_policy(libunwind_as, UNW_CACHE_GLOBAL);
}
void
@@ -139,6 +140,8 @@ build_mmap_cache(struct tcb* tcp)
size_t blen;
size_t dlen;
+ unw_flush_cache (libunwind_as, 0, 0);
+
sprintf(filename, "/proc/%d/maps", tcp->pid);
fp = fopen(filename, "r");
if (!fp) {