From 8d7a7bd9456c6067e874dabf6ee08b0a4e0de7d0 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 28 Aug 2009 18:01:51 -0700 Subject: Cache inline instance lookups We used to call dwarf_func_inline_instances to get the locations where inlines are used. This function has to iterate through nearly all DIEs to find instances, which is a lot of redundant work when we're probing multiple inline functions. Now we have our own dwarf iterator to cache all inline instances back to their origin. This only needs to be called once for each CU, and all further inlines are just a map lookup. Some quick benchmarks: stap -l Before After kernel.function("*") 25010ms 2110ms module("*").function("*") 86550ms 16920ms process("stap").function("*") 41330ms 580ms * dwflpp.cxx (dwflpp::cu_inl_function_caching_callback): Removed. (dwflpp::cache_inline_instances): New caching iterator. (dwflpp::iterate_over_inline_instances): Cache each CU once. --- dwflpp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'dwflpp.h') diff --git a/dwflpp.h b/dwflpp.h index 073b9bfc..047ad602 100644 --- a/dwflpp.h +++ b/dwflpp.h @@ -296,8 +296,9 @@ private: module_cu_cache_t module_cu_cache; + std::set cu_inl_function_cache_done; // CUs that are already cached cu_inl_function_cache_t cu_inl_function_cache; - static int cu_inl_function_caching_callback (Dwarf_Die* func, void *arg); + void cache_inline_instances (Dwarf_Die* die); /* The global alias cache is used to resolve any DIE found in a * module that is stubbed out with DW_AT_declaration with a defining -- cgit