]> git.ipfire.org Git - thirdparty/elfutils.git/commit
eu-stacktrace [1/5]: src: add eu-stacktrace tool
authorSerhei Makarov <serhei@serhei.io>
Fri, 11 Oct 2024 21:05:54 +0000 (17:05 -0400)
committerSerhei Makarov <serhei@serhei.io>
Thu, 17 Oct 2024 23:30:21 +0000 (19:30 -0400)
commit3f1f22d3c58fb98715e71d78a484c27ce3c51371
tree809258eae26df9288920beafb6ec4f938128d02b
parent12d58cf3e30dee91ed7aadb6475a15c6e74cc88b
eu-stacktrace [1/5]: src: add eu-stacktrace tool

eu-stacktrace is a utility to process a stream of raw stack
samples (such as those obtained from the Linux kernel's
PERF_SAMPLE_STACK facility) into a stream of stack traces (such as
those obtained from PERF_SAMPLE_CALLCHAIN), freeing other profiling
utilities from having to implement their own backtracing logic.

eu-stacktrace accepts data from a profiling tool via a pipe or
fifo. The initial version of the tool works on x86 architectures and
accepts data from Sysprof [1]. For future work, it will make sense
to expand support to other profilers, in particular perf tool.

Further patches in this series provide configury, docs, and improved
diagnostics for tracking the method used to unwind each frame in the
stack trace.

[1]: The following patched version of Sysprof (upstream submission ETA
~very_soon) can produce data with stack samples:

https://git.sr.ht/~serhei/sysprof-experiments/log/serhei/samples-via-fifo

Invoking the patched sysprof with eu-stacktrace:

$ sudo sysprof-cli --use-stacktrace
$ sudo sysprof-cli --use-stacktrace --stacktrace-path=/path/to/eu-stacktrace

Invoking the patched sysprof and eu-stacktrace manually through a fifo:

$ mkfifo /tmp/test.fifo
$ sudo eu-stacktrace --input /tmp/test.fifo --output test.syscap &
$ sysprof-cli --sample-method=stack --use-fifo=/tmp/test.fifo test.syscap

Note that sysprof polkit actions must be installed systemwide
(e.g. installing the system sysprof package will provide these).
Otherwise, "Action org.gnome.sysprof3.profile is not registered"
error will result.

* src/stacktrace.c: Add new tool.

Signed-off-by: Serhei Makarov <serhei@serhei.io>
src/stacktrace.c [new file with mode: 0644]