docs/reference_guide: update the examples to reflect the recent change
Since KeyboardInterrupt is not handled anymore, update the example code
and the link to the example scripts to reflect the change.
Also fix the link to 'trace_fields' example scripts.
@@ -1230,8 +1230,8 @@ while 1:
```
Examples in situ:
-[search /examples](https://github.com/iovisor/bcc/search?q=trace_print+path%3Aexamples+language%3Apython&type=Code),
-[search /tools](https://github.com/iovisor/bcc/search?q=trace_print+path%3Atools+language%3Apython&type=Code)
+[search /examples](https://github.com/iovisor/bcc/search?q=trace_fields+path%3Aexamples+language%3Apython&type=Code),
+[search /tools](https://github.com/iovisor/bcc/search?q=trace_fields+path%3Atools+language%3Apython&type=Code)
## Output
@@ -1252,11 +1252,14 @@ Example:
# loop with callback to print_event
b["events"].open_perf_buffer(print_event)
while 1:
+ try:
b.perf_buffer_poll()
+ except KeyboardInterrupt:
+ exit();
```
Examples in situ:
-[code](https://github.com/iovisor/bcc/blob/08fbceb7e828f0e3e77688497727c5b2405905fd/examples/tracing/hello_perf_output.py#L61),
+[code](https://github.com/iovisor/bcc/blob/v0.9.0/examples/tracing/hello_perf_output.py#L55),
[search /examples](https://github.com/iovisor/bcc/search?q=perf_buffer_poll+path%3Aexamples+language%3Apython&type=Code),
[search /tools](https://github.com/iovisor/bcc/search?q=perf_buffer_poll+path%3Atools+language%3Apython&type=Code)
@@ -1297,7 +1300,10 @@ def print_event(cpu, data, size):
# loop with callback to print_event
b["events"].open_perf_buffer(print_event)
while 1:
+ try:
b.perf_buffer_poll()
+ except KeyboardInterrupt:
+ exit()
```
Note that the data structure transferred will need to be declared in C in the BPF program. For example:
@@ -1337,7 +1343,7 @@ def print_event(cpu, data, size):
```
Examples in situ:
-[code](https://github.com/iovisor/bcc/blob/08fbceb7e828f0e3e77688497727c5b2405905fd/examples/tracing/hello_perf_output.py#L59),
+[code](https://github.com/iovisor/bcc/blob/v0.9.0/examples/tracing/hello_perf_output.py#L52),
[search /examples](https://github.com/iovisor/bcc/search?q=open_perf_buffer+path%3Aexamples+language%3Apython&type=Code),
[search /tools](https://github.com/iovisor/bcc/search?q=open_perf_buffer+path%3Atools+language%3Apython&type=Code)
