Search code examples
cdebugginglinux-kerneltrace

Retrieve Callchain Using perf_event_open()


How can I use perf_event_open() to retrieve callchain? I do not want to use the callchains provided by oprofile and perf. I want to get them directly. It seems that I need to mmap() the file descriptor returned by perf_event_open(). I do not know the size of mmap() and how to read from it.


Solution

  • Chapter 8 of this book describes, by example, how to use perf_event_open() for both counting and sampling modes.