Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bpftrace
Commits
3117a278
Commit
3117a278
authored
Sep 03, 2018
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change some kprobe:sys* examples
parent
679574c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
README.md
README.md
+20
-17
No files found.
README.md
View file @
3117a278
...
...
@@ -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 3
76
probes...
Attaching 3
20
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:
sy
s_read { ... }`
`kprobe:
vf
s_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:sy
s_write { ... }`
`kprobe:
vfs_read,kprobe:vf
s_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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment