Commit a2370ab5 authored by Sasha Goldshtein's avatar Sasha Goldshtein

Update examples and docs to use the new USDT API

The BPF class constructor now accepts an array of USDT
contexts instead of just one object. Update the examples
in **examples/tracing** and docs in **docs** to reflect
this change.
parent 54c1d6f1
......@@ -544,7 +544,7 @@ Constructors.
### 1. BPF
Syntax: ```BPF({text=BPF_program | src_file=filename} [, usdt=USDT_object])```
Syntax: ```BPF({text=BPF_program | src_file=filename} [, usdt_contexts=[USDT_object, ...]])```
Creates a BPF object. This is the main object for defining a BPF program, and interacting with its output.
......@@ -569,7 +569,7 @@ b = BPF(src_file = "vfsreadlat.c")
# include a USDT object:
u = USDT(pid=int(pid))
[...]
b = BPF(text=bpf_text, usdt=u)
b = BPF(text=bpf_text, usdt_contexts=[u])
```
Examples in situ:
......@@ -593,7 +593,7 @@ Examples:
# include a USDT object:
u = USDT(pid=int(pid))
[...]
b = BPF(text=bpf_text, usdt=u)
b = BPF(text=bpf_text, usdt_contexts=[u])
```
Examples in situ:
......
......@@ -629,7 +629,7 @@ u = USDT(pid=int(pid))
u.enable_probe(probe="http__server__request", fn_name="do_trace")
# initialize BPF
b = BPF(text=bpf_text, usdt=u)
b = BPF(text=bpf_text, usdt_contexts=[u])
```
Things to learn:
......@@ -638,7 +638,7 @@ Things to learn:
1. ```bpf_probe_read(&path, sizeof(path), (void *)addr)```: Now the string ```addr``` points to into our ```path``` variable.
1. ```u = USDT(pid=int(pid))```: Initialize USDT tracing for the given PID.
1. ```u.enable_probe(probe="http__server__request", fn_name="do_trace")```: Attach our ```do_trace()``` BPF C function to the Node.js ```http__server__request``` USDT probe.
1. ```b = BPF(text=bpf_text, usdt=u)```: Need to pass in our USDT object, ```u```, to BPF object creation.
1. ```b = BPF(text=bpf_text, usdt_contexts=[u])```: Need to pass in our USDT object, ```u```, to BPF object creation.
### Lesson 16. task_switch.c
......
......@@ -46,7 +46,7 @@ if debug:
print(bpf_text)
# initialize BPF
b = BPF(text=bpf_text, usdt=u)
b = BPF(text=bpf_text, usdt_contexts=[u])
# header
print("%-18s %-16s %-6s %s" % ("TIME(s)", "COMM", "PID", "QUERY"))
......
......@@ -39,7 +39,7 @@ if debug:
print(bpf_text)
# initialize BPF
b = BPF(text=bpf_text, usdt=u)
b = BPF(text=bpf_text, usdt_contexts=[u])
# header
print("%-18s %-16s %-6s %s" % ("TIME(s)", "COMM", "PID", "ARGS"))
......
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