mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
merge bitcoin#23302: drop GetHash().ToString() argument from the validation:block_connected
tracepoint
This commit is contained in:
parent
bfdc9ad364
commit
644a47ef9a
@ -176,17 +176,12 @@ third acts as a duration threshold in milliseconds. When the `ConnectBlock()`
|
|||||||
function takes longer than the threshold, information about the block, is
|
function takes longer than the threshold, information about the block, is
|
||||||
printed. For more details, see the header comment in the script.
|
printed. For more details, see the header comment in the script.
|
||||||
|
|
||||||
By default, `bpftrace` limits strings to 64 bytes due to the limited stack size
|
|
||||||
in the kernel VM. Block hashes as zero-terminated hex strings are 65 bytes which
|
|
||||||
exceed the string limit. The string size limit can be set to 65 bytes with the
|
|
||||||
environment variable `BPFTRACE_STRLEN`.
|
|
||||||
|
|
||||||
The following command can be used to benchmark, for example, `ConnectBlock()`
|
The following command can be used to benchmark, for example, `ConnectBlock()`
|
||||||
between height 20000 and 38000 on SigNet while logging all blocks that take
|
between height 20000 and 38000 on SigNet while logging all blocks that take
|
||||||
longer than 25ms to connect.
|
longer than 25ms to connect.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ BPFTRACE_STRLEN=65 bpftrace contrib/tracing/connectblock_benchmark.bt 20000 38000 25
|
$ bpftrace contrib/tracing/connectblock_benchmark.bt 20000 38000 25
|
||||||
```
|
```
|
||||||
|
|
||||||
In a different terminal, starting Dash Core in SigNet mode and with
|
In a different terminal, starting Dash Core in SigNet mode and with
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
|
|
||||||
BPFTRACE_STRLEN=65 bpftrace contrib/tracing/connectblock_benchmark.bt <start height> <end height> <logging threshold in ms>
|
bpftrace contrib/tracing/connectblock_benchmark.bt <start height> <end height> <logging threshold in ms>
|
||||||
|
|
||||||
- The environment variable BPFTRACE_STRLEN needs to be set to 65 chars as
|
|
||||||
strings are limited to 64 chars by default. Hex strings with Dash block
|
|
||||||
hashes are 64 hex chars + 1 null-termination char.
|
|
||||||
- <start height> sets the height at which the benchmark should start. Setting
|
- <start height> sets the height at which the benchmark should start. Setting
|
||||||
the start height to 0 starts the benchmark immediately, even before the
|
the start height to 0 starts the benchmark immediately, even before the
|
||||||
first block is connected.
|
first block is connected.
|
||||||
@ -23,7 +20,7 @@
|
|||||||
|
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
|
|
||||||
BPFTRACE_STRLEN=65 bpftrace contrib/tracing/connectblock_benchmark.bt 300000 680000 1000
|
bpftrace contrib/tracing/connectblock_benchmark.bt 300000 680000 1000
|
||||||
|
|
||||||
When run together 'dashd -reindex', this benchmarks the time it takes to
|
When run together 'dashd -reindex', this benchmarks the time it takes to
|
||||||
connect the blocks between height 300.000 and 680.000 (inclusive) and prints
|
connect the blocks between height 300.000 and 680.000 (inclusive) and prints
|
||||||
@ -31,7 +28,7 @@
|
|||||||
histogram with block connection times when the benchmark is finished.
|
histogram with block connection times when the benchmark is finished.
|
||||||
|
|
||||||
|
|
||||||
BPFTRACE_STRLEN=65 bpftrace contrib/tracing/connectblock_benchmark.bt 0 0 500
|
bpftrace contrib/tracing/connectblock_benchmark.bt 0 0 500
|
||||||
|
|
||||||
When running together 'dashd', all newly connected blocks that
|
When running together 'dashd', all newly connected blocks that
|
||||||
take longer than 500ms to connect are logged. A histogram with block
|
take longer than 500ms to connect are logged. A histogram with block
|
||||||
@ -107,14 +104,23 @@ usdt:./src/dashd:validation:block_connected /arg1 >= $1 && (arg1 <= $2 || $2 ==
|
|||||||
*/
|
*/
|
||||||
usdt:./src/dashd:validation:block_connected / (uint64) arg5 / 1000> $3 /
|
usdt:./src/dashd:validation:block_connected / (uint64) arg5 / 1000> $3 /
|
||||||
{
|
{
|
||||||
$hash_str = str(arg0);
|
$hash = arg0;
|
||||||
$height = (int32) arg1;
|
$height = (int32) arg1;
|
||||||
$transactions = (uint64) arg2;
|
$transactions = (uint64) arg2;
|
||||||
$inputs = (int32) arg3;
|
$inputs = (int32) arg3;
|
||||||
$sigops = (int64) arg4;
|
$sigops = (int64) arg4;
|
||||||
$duration = (int64) arg5;
|
$duration = (int64) arg5;
|
||||||
|
|
||||||
printf("Block %d (%s) %4d tx %5d ins %5d sigops took %4d ms\n", $height, $hash_str, $transactions, $inputs, $sigops, (uint64) $duration / 1000);
|
|
||||||
|
printf("Block %d (", $height);
|
||||||
|
/* Prints each byte of the block hash as hex in big-endian (the block-explorer format) */
|
||||||
|
$p = $hash + 31;
|
||||||
|
unroll(32) {
|
||||||
|
$b = *(uint8*)$p;
|
||||||
|
printf("%02x", $b);
|
||||||
|
$p -= 1;
|
||||||
|
}
|
||||||
|
printf(") %4d tx %5d ins %5d sigops took %4d ms\n", $transactions, $inputs, $sigops, (uint64) $duration / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,19 +101,12 @@ Is called *after* a block is connected to the chain. Can, for example, be used
|
|||||||
to benchmark block connections together with `-reindex`.
|
to benchmark block connections together with `-reindex`.
|
||||||
|
|
||||||
Arguments passed:
|
Arguments passed:
|
||||||
1. Block Header Hash as `pointer to C-style String` (64 characters)
|
1. Block Header Hash as `pointer to unsigned chars` (i.e. 32 bytes in little-endian)
|
||||||
2. Block Height as `int32`
|
2. Block Height as `int32`
|
||||||
3. Transactions in the Block as `uint64`
|
3. Transactions in the Block as `uint64`
|
||||||
4. Inputs spend in the Block as `int32`
|
4. Inputs spend in the Block as `int32`
|
||||||
5. SigOps in the Block (excluding coinbase SigOps) `uint64`
|
5. SigOps in the Block (excluding coinbase SigOps) `uint64`
|
||||||
6. Time it took to connect the Block in microseconds (µs) as `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 Dash Core
|
## Adding tracepoints to Dash Core
|
||||||
|
|
||||||
|
@ -2303,14 +2303,13 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||||||
statsClient.gauge("blocks.tip.NumTransactions", block.vtx.size(), 1.0f);
|
statsClient.gauge("blocks.tip.NumTransactions", block.vtx.size(), 1.0f);
|
||||||
statsClient.gauge("blocks.tip.SigOps", nSigOps, 1.0f);
|
statsClient.gauge("blocks.tip.SigOps", nSigOps, 1.0f);
|
||||||
|
|
||||||
TRACE7(validation, block_connected,
|
TRACE6(validation, block_connected,
|
||||||
block.GetHash().ToString().c_str(),
|
block.GetHash().data(),
|
||||||
pindex->nHeight,
|
pindex->nHeight,
|
||||||
block.vtx.size(),
|
block.vtx.size(),
|
||||||
nInputs,
|
nInputs,
|
||||||
nSigOps,
|
nSigOps,
|
||||||
GetTimeMicros() - nTimeStart, // in microseconds (µs)
|
GetTimeMicros() - nTimeStart // in microseconds (µs)
|
||||||
block.GetHash().data()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user