Here 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 <[email protected]>
---
 unwind.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/unwind.c b/unwind.c
index 0e90a92..036d0e4 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,9 @@ 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) {
-- 
1.9.0


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to