Google Summer of Code Project ideas for perf, the Linux profiling subsystem.
perf has two components:
perf has had various enhancements such as support for BPF.
Maintainers: Peter Zijlstra <peterz at infradead.org>, Ingo Molnar <mingo at redhat.com>, Arnaldo Carvalho de Melo <acme at kernel.org>, Namhyung Kim <namhyung at kernel.org>
Mailing list: linux-perf-users at vger.kernel.org
IRC: #perf on irc.oftc.net
Code Licenses: mostly GPLv2
Wiki: https://perf.wiki.kernel.org/
Mentor contacts: Ian Rogers <irogers+gsoc24 at google dot com>, Namhyung Kim <namhyung at kernel.org>, Arnaldo Carvalho de Melo <acme at kernel.org>
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 better support for more programming languages and new profiling commands like function latency measuring. The perf tool is full of metrics like flops and memory bandwidth, so adding a roofline model to determine the bottlenecks of an application would be a possibility.
Have a computer you really love but can only query the core CPU's PMU? Are there data sheets describing performance monitoring counters that could be exposed through the perf event API? Why not work to add a PMU driver to the Linux kernel and expose those performance counters or even more advanced features like sampling. Drivers can be added for accelerators, GPUs, data buses, caches, etc. For example, the Raspberry Pi 5 has performance counters only for its core CPUs and not for things like its memory bus.
A lot of what makes the perf tool useful is user interface, however, writing user interfaces in C is tedious and error prone. Python support is long established within the perf tool but it could use some TLC. Some examples of work that needs doing are:
pip
so it is easy to depend upon.flamegraph
and gecko
deserve to be top-level. Improving how this is organized should help perf users. The current command line argument processing for perf script
is also messy as arguments may be for record, report or both.With better python integration it is hoped that tools like perf report can also have a python equivalent. This would allow UI toolkits like Textualize to be used and improve the user experience.
A better python experience can also look to improve the gecko profiling experience or add other data converters like for pprof and Chrome's trace event format.
The perf tool is largely single threaded even though sometimes it needs to do something on every CPU in the system. This is embarrassingly parallel but the tool isn't exploiting it. Work was done to create a work pool mechanism but not merged due to latent bugs in memory management. Address sanitizer and reference count checking have solved this problem but we still need to integrate the work pool code.
Another improvement is that 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. Breaking apart the perf report
command so that processing is performed on a background thread with the visualization periodically refreshing in the foreground will mean that at least during the slow load the user can do something.
One more thing can do is to reduce the number of file descriptors in perf record
with –threads
option. Currently it needs a couple of pipes to communicate between the worker threads. I think it can be greatly reduced by using eventfd(2) instead of having pipes for each thread.
Data type profiling is a new technique to show memory access profiles with type information. See LWN article for more detail. It's still in the early stage and has a lot of room for improvement. For example, it needs to support C++ and other languages, better integration to other perf commands like annotate
and c2c
, performance optimization, other architecture support and so on. It'd be ok if you're not familiar with ELF or DWARF format.
perf trace
is similar to strace
but much performant since it doesn't use ptrace. So it needs to capture and understand the format of syscall arguments as strace
does. Right now, it has to build a list of format to pretty-print the syscall args. But we find it limited and manual work. Instead, it could use BTF (BPF type format) which has all the type information and is available in the (most) kernel.