The Linux perf tool was originally written to allow access to the performance monitoring hardware that counts hardware events, such as instructions executed, processor cycles, and cache misses. However, it can also be used to count software events, which can be useful in gauging how frequently some part of the system software is executed.
Recently someone at Red Hat asked whether there was a way to get a count of system calls being executed on the system. The kernel has a predefined software trace point,
raw_syscalls:sys_enter, which collects that exact information; it counts each time a system call is made. To use the trace point events, the
perf command needs to be run as root.
Continue reading “How to use the Linux perf tool to count software events”