Hey all, looking at the performance of my malloc tracer which calls unw_backtrace on every call to malloc and friends, I noticed that I can greatly improve the runtime overhead by tuning DWARF_LOG_UNW_CACHE_SIZE. Currently it's set to 7 and sizeof(struct dwarf_rs_cache) = 43568 bytes. When I run my tracer on an example application (KDE4's Kate opening a blank file and closing it directly afterwards), I see ca. 190k cache misses. I played around with it and when I set DWARF_LOG_UNW_CACHE_SIZE = 10, leading to an increased cache size of 348208 bytes, the cache misses drop do ca. 50k. The performance impact is noticeable.
I assume that I cannot easily provide a patch to increase the cache size as it currently lives on the stack and libunwind wants to run on embedded devices with limited amounts of memory as well. That said, on desktop machines with gigs of ram, using one or two megabytes of ram to greatly improve the performance of a profiler is something I'd gladly do. So, what can we do about this situation? Could the cache be created on the heap and a function made public which can be called to tune the size of the cache, similar to unw_set_caching_policy? I'd welcome something like unw_set_dwarf_cache_size(unsigned long) or similar, which could then be set to a specific size. Would a patch with something like the above be accepted or is a cache on the heap a no-go here? Bye -- Milian Wolff [email protected] http://milianw.de _______________________________________________ Libunwind-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/libunwind-devel
