|
|
|
@@ -0,0 +1,29 @@ |
|
|
|
# Files opened by process |
|
|
|
bpftrace -e 'tracepoint:syscalls:sys_enter_open { printf("%s %s\n", comm, str(args->filename)); }' |
|
|
|
|
|
|
|
# Syscall count by program |
|
|
|
bpftrace -e 'tracepoint:raw_syscalls:sys_enter { @[comm] = count(); }' |
|
|
|
|
|
|
|
# Read bytes by process: |
|
|
|
bpftrace -e 'tracepoint:syscalls:sys_exit_read /args->ret/ { @[comm] = sum(args->ret); }' |
|
|
|
|
|
|
|
# Read size distribution by process: |
|
|
|
bpftrace -e 'tracepoint:syscalls:sys_exit_read { @[comm] = hist(args->ret); }' |
|
|
|
|
|
|
|
# Show per-second syscall rates: |
|
|
|
bpftrace -e 'tracepoint:raw_syscalls:sys_enter { @ = count(); } interval:s:1 { print(@); clear(@); }' |
|
|
|
|
|
|
|
# Trace disk size by process |
|
|
|
bpftrace -e 'tracepoint:block:block_rq_issue { printf("%d %s %d\n", pid, comm, args->bytes); }' |
|
|
|
|
|
|
|
# Count page faults by process |
|
|
|
bpftrace -e 'software:faults:1 { @[comm] = count(); }' |
|
|
|
|
|
|
|
# Count LLC cache misses by process name and PID (uses PMCs): |
|
|
|
bpftrace -e 'hardware:cache-misses:1000000 { @[comm, pid] = count(); }' |
|
|
|
|
|
|
|
# Profile user-level stacks at 99 Hertz, for PID 189: |
|
|
|
bpftrace -e 'profile:hz:99 /pid == 189/ { @[ustack] = count(); }' |
|
|
|
|
|
|
|
# Files opened, for processes in the root cgroup-v2 |
|
|
|
bpftrace -e 'tracepoint:syscalls:sys_enter_openat /cgroup == cgroupid("/sys/fs/cgroup/unified/mycg")/ { printf("%s\n", str(args->filename)); }' |