Commit 3117a278 authored by Brendan Gregg's avatar Brendan Gregg

change some kprobe:sys* examples

parent 679574c6
......@@ -10,35 +10,38 @@ For instructions on building BPFtrace, see [INSTALL.md](INSTALL.md). There is al
Count system calls:
```
kprobe:[Ss]y[Ss]_*
tracepoint:syscalls:sys_enter_*
{
@[func] = count()
@[name] = count();
}
```
```
Attaching 376 probes...
Attaching 320 probes...
^C
...
@[sys_open]: 579
@[SyS_ioctl]: 686
@[sys_bpf]: 730
@[sys_close]: 779
@[SyS_read]: 825
@[sys_write]: 1031
@[sys_poll]: 1796
@[sys_futex]: 2237
@[sys_recvmsg]: 2634
@[tracepoint:syscalls:sys_enter_futex]: 50
@[tracepoint:syscalls:sys_enter_newfstat]: 52
@[tracepoint:syscalls:sys_enter_clock_gettime]: 56
@[tracepoint:syscalls:sys_enter_perf_event_open]: 148
@[tracepoint:syscalls:sys_enter_select]: 156
@[tracepoint:syscalls:sys_enter_dup]: 291
@[tracepoint:syscalls:sys_enter_read]: 308
@[tracepoint:syscalls:sys_enter_bpf]: 310
@[tracepoint:syscalls:sys_enter_open]: 363
@[tracepoint:syscalls:sys_enter_ioctl]: 571
@[tracepoint:syscalls:sys_enter_dup2]: 580
@[tracepoint:syscalls:sys_enter_close]: 998
```
Produce a histogram of amount of time (in nanoseconds) spent in the `read()` system call:
```
kprobe:sys_read
tracepoint:syscalls:sys_enter_read
{
@start[tid] = nsecs;
}
kretprobe:sys_read / @start[tid] /
tracepoint:syscalls:sys_exit_read / @start[tid] /
{
@times = hist(nsecs - @start[tid]);
delete(@start[tid]);
......@@ -144,7 +147,7 @@ verify_cpu+0
### kprobes
Attach a BPFtrace script to a kernel function, to be executed when that function is called:
`kprobe:sys_read { ... }`
`kprobe:vfs_read { ... }`
### uprobes
Attach script to a userland function:
......@@ -191,12 +194,12 @@ Run the script once per interval, for printing interval output:
### Multiple attachment points
A single probe can be attached to multiple events:
`kprobe:sys_read,kprobe:sys_write { ... }`
`kprobe:vfs_read,kprobe:vfs_write { ... }`
### Wildcards
Some probe types allow wildcards to be used when attaching a probe:
`kprobe:SyS_* { ... }`
`kprobe:vfs_* { ... }`
### Predicates
Define conditions for which a probe should be executed:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment