====== perf: Linux Profiling GSoC 2022 ====== Google Summer of Code Project ideas for perf, the Linux profiling subsystem. [[gsoc:google-summer-code-2022|(Main Linux foundation GSoC 2022 page)]] ===== What is perf? ===== perf has two components: - kernel support for performance counters, performance monitoring units and tracing; - a tool for accessing the kernel provided data, recording and visualizing it. perf has had various enhancements such as support for BPF. ===== Perf community ===== [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/MAINTAINERS|Maintainers]]: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Mailing list: [[https://www.spinics.net/lists/linux-perf-users/|linux-perf-users at vger.kernel.org]] IRC: #perf on irc.oftc.net Code Licenses: mostly GPLv2 Wiki: [[https://perf.wiki.kernel.org/index.php/Main_Page|https://perf.wiki.kernel.org/]] Mentor contacts: [[https://sites.google.com/site/rogersemail/home|Ian Rogers]] , Namhyung Kim ===== Project Proposals ===== ==== Bring your open proposal ==== If you have your own ideas for how tracing and profiling can be improved in the Linux kernel and perf tool then these are welcomed. Some areas that have been brought up in the last year are [[https://lore.kernel.org/linux-perf-users/87o85ftc3p.fsf@smart-cactus.org/|better support for more programming languages]], [[https://lore.kernel.org/linux-perf-users/CAP-5=fW7La9ZNv8Z6LHRRNXne4+dWK6dR1ye2P=zETFELtK=fg@mail.gmail.com/|better packaging in Linux distributions]] and [[https://lore.kernel.org/all/20211129231830.1117781-1-namhyung@kernel.org/|new profiling commands like function latency measuring]]. ==== User Interface ==== === Improved perf trace === ''perf trace'' provides an strace like ability using perf APIs. By avoiding ptrace APIs, ''perf trace'' can even trace itself. The filename for an open system call is fairly boring encoded as a pointer. To get the actual filename the program is sending to the kernel requires information not captured in a perf event, and so libaudit is currently used. Libaudit adds code in the kernel on a number of system calls but not all - for example, there is no libaudit on the perf_event_open system call. A different technique for intercepting system calls and sending information to user land is BPF. This project will look to add a variant to ''perf trace'' where instead of getting filenames for system calls using libaudit, it will do so with BPF programs that perf can install in the kernel when the program starts up. The large number of system calls means this is a large challenge. === Interactive perf report === Currently the ''perf report'' command will process an entire perf.data file before providing a visualization. This can be slow for large perf.data files. In contrast, the ''perf top'' command will gather data in the background while providing a visualization. This project will look to break apart ''perf report'' so that processing is performed on a background thread with the visualization periodically refreshing. === Adding or improving graphical toolkit support === Perf has different user interfaces: * stdio - the most basic UI that can use a pager like ''less'', * tui - based on [[http://www.jedsoft.org/slang/|slang]], * gtk - uses the gtk2 user interface. This option isn't enabled by default at build time. This project will look to improve the user interface experience with perf, for example, by upgrading the gtk2 code to use gtk4. The addition of other user interfaces would be an option for this project. ==== Perf data converter ==== The ''perf data'' command allows a perf.data file to be converted to other file formats, however, currently only CTF is supported. This project will look to add support for other file formats such as Firefox's [[https://github.com/firefox-devtools/profiler/blob/main/docs-developer/gecko-profile-format.md|Gecko profile format]] or Chrome's [[https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview|trace event format]]. By supporting conversion to these file formats visualization tools will be able to show a recorded perf.data file. ==== Scalability and speed ==== Large parts of the perf command are single threaded. As CPU core counts increase, this means that programming events can be slow and the command in general can be slower that it needs to be. This project will look to provide parallel approaches to processing perf data structures such as ''evlist'' so that more concurrency happens within the perf command. This work will build upon that donee by Riccardo Mancini [[https://lore.kernel.org/linux-perf-users/3c4f8dd64d07373d876990ceb16e469b4029363f.camel@gmail.com/|in GSoC 2021]].