HomePhabricator

tracing: drop block_connected hash.toString() arg

Description

tracing: drop block_connected hash.toString() arg

Summary:

The tracepoint `validation:block_connected` was introduced in #22006.
The first argument was the hash of the connected block as a pointer
to a C-like String. The last argument passed the hash of the
connected block as a pointer to 32 bytes. The hash was only passed as
string to allow `bpftrace` scripts to print the hash. It was
(incorrectly) assumed that `bpftrace` cannot hex-format and print the
block hash given only the hash as bytes.

The block hash can be printed in `bpftrace` by calling
`printf("%02x")` for each byte of the hash in an `unroll () {...}`.
By starting from the last byte of the hash, it can be printed in
big-endian (the block-explorer format).

  $p = $hash + 31;
  unroll(32) {
      $b = *(uint8*)$p;
      printf("%02x", $b);
      $p -= 1;
  }

See also: https://github.com/bitcoin/bitcoin/pull/22902#discussion_r705176691

This is a breaking change to the block_connected tracepoint API, however
this tracepoint has not yet been included in a release.

Backport of core#23302.

Also updated sigops => sigchecks in the bt script, and updated the detection so it's more obvious that it's enabled.

Test Plan:
Build and run with tracing enabled, then:

sudo bpftrace ../contrib/tracing/connectblock_benchmark.bt 0 0 25

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

Subscribers: sdulfari

Differential Revision: https://reviews.bitcoinabc.org/D12674

Details

Provenance
FabienAuthored on Nov 30 2022, 15:16
FabienPushed on Nov 30 2022, 18:49
Reviewer
Restricted Project
Differential Revision
D12674: tracing: drop block_connected hash.toString() arg
Parents
rABC6cfa62f5198d: Enable clang-tidy bugprone-argument-comment and fix violations
Branches
Unknown
Tags
Unknown