Reputation: 249153
There are apparently some counters in Linux perf
like syscall:sys_enter_select
, but on my system perf list
does not show any of them
Evidence that other people do have these counters is here: http://www.brendangregg.com/blog/2014-07-03/perf-counting.html
If I run perf top -e 'syscalls:sys_enter_*'
it says:
Can't open event dir: Permission denied
invalid or unsupported event: 'syscalls:sys_enter_*'
Other event types (the ones in perf list
) work fine.
What do I need to do to access syscall counters in perf
? I'm using Linux kernel and perf version 3.10 on x86_64.
Upvotes: 5
Views: 3249
Reputation: 364180
You must have an old version of perf
to go with your crusty old 3.10 kernel.
On a modern system (x86-64 Arch Linux with Linux 4.15.8-1-ARCH, and a matching version of perf
), perf
answers this question for you:
$ perf stat -e 'syscalls:sys_enter_*stat*' ls -l
event syntax error: 'syscalls:sys_enter_*stat*'
\___ can't access trace events
Error: No permissions to read /sys/kernel/debug/tracing/events/syscalls/sys_enter_*stat*
Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing'
Run 'perf list' for a list of valid events
...
$ ll /sys/kernel/debug/ -d
drwx------ 33 root root 0 Mar 14 00:02 /sys/kernel/debug/
Interesting that you could make it world-readable, similar to how you can put kernel.perf_event_paranoid = 0
and kernel.yama.ptrace_scope = 0
in /etc/sysctl.d/99-local.conf
for convenient debugging / tracing / profiling on a single-user desktop without using root
all the time.
Upvotes: 3
Reputation: 249153
Some perf
counters, including all the syscall
ones, are only available to the root user. sudo perf list
will show all the counters, including syscall
ones assuming the kernel is built with CONFIG_HAVE_SYSCALL_TRACEPOINTS
(see Grisha Levit's answer regarding that).
So, to make perf top -e 'syscalls:sys_enter_*'
work, run it under sudo
--even if you do not need sudo
for other counters like cycles
.
Upvotes: 7
Reputation: 8617
These will be missing if the kernel was not built with CONFIG_HAVE_SYSCALL_TRACEPOINTS
.
You can check like so:
# grep TRACEPOINTS "/boot/config-$(uname -r)"
CONFIG_TRACEPOINTS=y
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
Upvotes: 2