tracing: Tracepoint for connected blocks

Can, for example, be used to benchmark block connections.
This commit is contained in:
0xb10c
2021-05-20 17:53:24 +02:00
parent 4224dec22b
commit 8f37f5c2a5
4 changed files with 259 additions and 0 deletions

View File

@@ -93,6 +93,28 @@ to user-space in full. Messages longer than a 32kb might be cut off. This can
be detected in tracing scripts by comparing the message size to the length of
the passed message.
### Context `validation`
#### Tracepoint `validation:block_connected`
Is called *after* a block is connected to the chain. Can, for example, be used
to benchmark block connections together with `-reindex`.
Arguments passed:
1. Block Header Hash as `pointer to C-style String` (64 characters)
2. Block Height as `int32`
3. Transactions in the Block as `uint64`
4. Inputs spend in the Block as `int32`
5. SigOps in the Block (excluding coinbase SigOps) `uint64`
6. Time it took to connect the Block in microseconds (µs) as `uint64`
7. Block Header Hash as `pointer to unsigned chars` (i.e. 32 bytes in little-endian)
Note: The 7th argument can't be accessed by bpftrace and is purposefully chosen
to be the block header hash as bytes. See [bpftrace argument limit] for more
details.
[bpftrace argument limit]: #bpftrace-argument-limit
## Adding tracepoints to Bitcoin Core
To add a new tracepoint, `#include <util/trace.h>` in the compilation unit where