Skip to content

Instantly share code, notes, and snippets.

@maurorappa
Created March 21, 2023 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maurorappa/652b5234881684f6a6d5f646f757af86 to your computer and use it in GitHub Desktop.
Save maurorappa/652b5234881684f6a6d5f646f757af86 to your computer and use it in GitHub Desktop.
bpftrace example for debugging
Check all available kernel tracepoints, for example:
# cat /sys/kernel/debug/tracing/events/syscalls/sys_enter_adjtimex/format
name: sys_enter_adjtimex
ID: 345
format:
…..
field:int common_pid; offset:4; size:4; signed:1;
…..
Run this oneliner using bpftrace utility:
# bpftrace -e 'tracepoint:syscalls:sys_enter_adjtimex {printf("clock adjusted by pid %d\n",pid)}'
Attaching 1 probe...
clock adjusted by pid 199758
clock adjusted by pid 199758
clock adjusted by pid 199758
clock adjusted by pid 199758
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment