]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdwfl_stacktrace [5/12]: introduce Dwflst_Process_Tracker
authorSerhei Makarov <serhei@serhei.io>
Fri, 25 Apr 2025 14:55:47 +0000 (10:55 -0400)
committerAaron Merey <amerey@redhat.com>
Fri, 25 Apr 2025 15:54:45 +0000 (11:54 -0400)
commit4d17ddf0864110150cfea484edba0f4f68489f9f
tree7caeee8f633f4f6de22f234251b5187159e4941d
parent3ad7277b4163756f9d3fccd66df9576e3a5f8016
libdwfl_stacktrace [5/12]: introduce Dwflst_Process_Tracker

New data structure to coordinate caching Elf data among multiple Dwfl
structs attached to different processes. Meant to reduce the overhead
for profilers that use elfutils for unwinding.

The caching is well-justified, as the prior approach (e.g. in
eu-stacktrace, sysprof-live-unwinder) of creating a separate Dwfl per
process was wildly redundant, opening ~hundreds of file descriptors
just for each common library such as libc.so and leaking the data.

Initial patch just introduces the struct, to be filled in by the rest
of the patch series.

* libdwfl_stacktrace/libdwfl_stacktrace.h
  (Dwflst_Process_Tracker): New struct.
  (dwflst_tracker_begin): New function.
  (dwflst_tracker_dwfl_begin): New function.
  (dwflst_tracker_end): New function.
* libdw/libdw.map: Add new functions.
* libdwfl_stacktrace/libdwfl_stacktraceP.h
  (struct Dwflst_Process_Tracker): New struct.
* libdwfl/libdwflP.h (Dwflst_Process_Tracker): Typedef forward decl.
  (struct Dwfl): Add 'tracker' field.
* libdwfl_stacktrace/Makefile.am (libdwfl_stacktrace_a_SOURCES):
  Add dwflst_process_tracker.c.
* libdwfl_stacktrace/dwflst_process_tracker.c: New file.
  (dwflst_tracker_begin): Initialize the tracker.
  (dwflst_tracker_dwfl_begin): Initialize Dwfl * with specified tracker.
  (dwflst_tracker_end): Deallocate the tracker.

Signed-off-by: Serhei Makarov <serhei@serhei.io>
libdw/libdw.map
libdwfl/libdwflP.h
libdwfl_stacktrace/Makefile.am
libdwfl_stacktrace/dwflst_process_tracker.c [new file with mode: 0644]
libdwfl_stacktrace/libdwfl_stacktrace.h
libdwfl_stacktrace/libdwfl_stacktraceP.h