Changeset View
Changeset View
Standalone View
Standalone View
doc/functional-tests.md
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | |||||
``` | ``` | ||||
Note: gdb attach step may require `sudo`. To get rid of this, you can run: | Note: gdb attach step may require `sudo`. To get rid of this, you can run: | ||||
```bash | ```bash | ||||
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope | echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope | ||||
``` | ``` | ||||
### Benchmarking and profiling with perf | |||||
An easy way to profile node performance during functional tests is provided | |||||
for Linux platforms using `perf`. | |||||
Perf will sample the running node and will generate profile data in the node's | |||||
datadir. The profile data can then be presented using `perf report` or a graphical | |||||
tool like [hotspot](https://github.com/KDAB/hotspot). | |||||
There are two ways of invoking perf: one is to use the `--perf` flag when | |||||
running tests, which will profile each node during the entire test run: perf | |||||
begins to profile when the node starts and ends when it shuts down. The other | |||||
way is the use the `profile_with_perf` context manager, e.g. | |||||
```python | |||||
with node.profile_with_perf("send-big-msgs"): | |||||
# Perform activity on the node you're interested in profiling, e.g.: | |||||
for _ in range(10000): | |||||
node.p2p.send_message(some_large_message) | |||||
``` | |||||
To see useful textual output, run | |||||
```sh | |||||
perf report -i /path/to/datadir/send-big-msgs.perf.data.xxxx --stdio | c++filt | less | |||||
``` | |||||
#### See also: | |||||
- [Installing perf](https://askubuntu.com/q/50145) | |||||
- [Perf examples](http://www.brendangregg.com/perf.html) | |||||
- [Hotspot](https://github.com/KDAB/hotspot): a GUI for perf output analysis | |||||
##### Prevent using deprecated features | ##### Prevent using deprecated features | ||||
Python will issue a `DeprecationWarning` when a deprecated feature is | Python will issue a `DeprecationWarning` when a deprecated feature is | ||||
encountered in a script. By default, this warning message is ignored and not | encountered in a script. By default, this warning message is ignored and not | ||||
displayed to the user. This behavior can be changed by setting the environment | displayed to the user. This behavior can be changed by setting the environment | ||||
variable `PYTHONWARNINGS` as follow: | variable `PYTHONWARNINGS` as follow: | ||||
`PYTHONWARNINGS=default::DeprecationWarning` | `PYTHONWARNINGS=default::DeprecationWarning` | ||||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |