On Montag, 8. Mai 2023 14:33:57 CEST Serhei Makarov wrote: > Hello all, > > I wanted to open up public discussion on a project I'm looking to > develop in elfutils, tentatively named eu-stacktrace. I've started to > write code on branch users/serhei/eu-stacktrace. > > eu-stacktrace will be 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 the > ones obtained from PERF_SAMPLE_CALLCHAIN), freeing various profiling > utilities from having to implement their own backtracing logic. > > My initial goal is to make the tool work with a (slightly modified) > version of the sysprof profiler. If all goes well, I hope to produce a > demonstration of sysprof using elfutils eu-stacktrace and eh_frame > data to produce useful profiles on code compiled with > -fomit-frame-pointer. (I'm aware of the problem of profiling > -fomit-frame-pointer programs being a topic of some fairly contentious > recent discussion, which I'm not looking to rehash; I'm just > interested to see if I can add a viable technical solution to the > mix.) I'm cc:ing chergert and posting a link to this thread on > GNOME Discourse so that sysprof developers can keep track of the > discussion. > > For the time being, eu-stacktrace is meant to be fed data from a > profiling tool via a pipe or fifo. We will see how well this idea > works as implementation proceeds. > > The eventual goal is to work with various profiler data formats. After > sysprof, supporting perf's native data format is an obvious > prerequisite for merging the users/serhei/eu-stacktrace branch into > elfutils. Ideally, I would like for eu-stacktrace to also convert > between different profile data formats (e.g. taking sysprof data as > input and emitting perf data, and vice-versa), but this may be > out-of-scope given the amount of code that would need to be written to > handle profile data other than stack traces. Hey Serhey, sounds like a fun project. If you want to see some prior art in that area, do have a look at perfparser [1], esp. [2], and [3]. We solved quite a few of the problems you might encounter in this area. Esp. for good performance, you'll need quite a bit of caching on the stacktrace side, such as [4] and [5]. [1]: https://codereview.qt-project.org/gitweb?p=qt-creator%2Fperfparser.git;a=summary [2]: https://codereview.qt-project.org/gitweb?p=qt-creator/ perfparser.git;a=blob;f=app/ perfunwind.cpp;h=9c09740c756beabac43b45ed6f34bbcfc77e0860;hb=refs/heads/master [3]: https://codereview.qt-project.org/gitweb?p=qt-creator/ perfparser.git;a=blob;f=app/ perfunwind.cpp;h=9c09740c756beabac43b45ed6f34bbcfc77e0860;hb=refs/heads/master [4]: https://codereview.qt-project.org/gitweb?p=qt-creator/ perfparser.git;a=blob;f=app/ perfaddresscache.cpp;h=8ff26d09a71aff0343378ff062c8fb2fcf601c08;hb=refs/heads/ master [5]: https://codereview.qt-project.org/gitweb?p=qt-creator/ perfparser.git;a=blob;f=app/ perfdwarfdiecache.cpp;h=10e432e64cdce6c5e9e6a72a49a1cd73ddb9e7ce;hb=refs/ heads/master Good luck! -- Milian Wolff mail@milianw.de http://milianw.de