The New Linux ’ perf ’ Tools

1 Abstract The perf events infrastructure is fast moving into being the unifying channel for hardware and software performance analysis. Modern CPUs have hardware dedicated to counting events associated with performance, special registers that allow pinpointing hotspots that can possibly be optimized. Recent developments in the Linux kernel explore these features, solving problems found in previous attempts, such as OProfile. The reuse of Linux kernel code in user space applications as part of the experiment of shipping user space tools in the kernel repository is discussed. Throughout this paper the current status of development will be discussed, mentioning ongoing discussions and feedback to decisions taken, trying to help interested people in joining the effort to have better hardware and software event processing tools in the Linux environment. To avoid the disconnect of the kernel and user parts for a tool directly used by the kernel community the perf tools are being developed in the kernel repository, a first. One example of this disconnect can be read in a bug tracking entry[1] where Linus Torvalds reported not being able to use the hardware performance counters on recent hardware and kernel. The problem was that the userspace code to match the kernel support was not present on the OS used. While this happens sometimes with other OS components the nature of profiling being so close to kernel development lead to this attempt to develop both together. That does not mean that there is not an ABI guarantee, if it changes in a non backward compatible way, it is a bug. There are already several tools that are not hosted in the kernel repository that depend on the perf ABI, sysprof for instance[2]. Another goal is to reduce the barrier for coding in the kernel and in the user space tools, so the tools are being developed following kernel coding style and conventions, reusing the familiar list, rbtree, error reporting, hash facilities and others as the experiment matures.