Commit 04a6b214 authored by williangaspar's avatar williangaspar
parent 62e712a5
...@@ -175,7 +175,7 @@ It can also be made executable to run stand-alone. Start by adding an interprete ...@@ -175,7 +175,7 @@ It can also be made executable to run stand-alone. Start by adding an interprete
``` ```
1 #!/usr/local/bin/bpftrace 1 #!/usr/local/bin/bpftrace
1 #!/usr/bin/env bpftrace 1 #!/usr/bin/env bpftrace
2 2
3 tracepoint:syscalls:sys_enter_nanosleep 3 tracepoint:syscalls:sys_enter_nanosleep
4 { 4 {
5 printf("%s is sleeping.\n", comm); 5 printf("%s is sleeping.\n", comm);
...@@ -449,6 +449,22 @@ Attaching 1 probe... ...@@ -449,6 +449,22 @@ Attaching 1 probe...
@reads: 80 @reads: 80
``` ```
## 7. `unroll () {...}
Example:
```
# bpftrace -e 'kprobe:do_nanosleep { $i = 1; unroll(5) { printf("i: %d\n", $i); $i = $i + 1; } }'
Attaching 1 probe...
i: 1
i: 2
i: 3
i: 4
i: 5
^C
```
# Probes # Probes
- `kprobe` - kernel function start - `kprobe` - kernel function start
......
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