mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 10:42:23 +02:00
tracing: use bitcoind pid in bcc tracing examples
BCC needs the PID of a bitcoind process to attach to the tracepoints
(instead of the binary path used before) when the tracepoints have a
semaphore.
For reference, we already use the PID in our tracepoint interface
tests. See 220a5a2841
.
This commit is contained in:
@ -132,8 +132,9 @@ def print_message(event, inbound):
|
||||
)
|
||||
|
||||
|
||||
def main(bitcoind_path):
|
||||
bitcoind_with_usdts = USDT(path=str(bitcoind_path))
|
||||
def main(pid):
|
||||
print(f"Hooking into bitcoind with pid {pid}")
|
||||
bitcoind_with_usdts = USDT(pid=int(pid))
|
||||
|
||||
# attaching the trace functions defined in the BPF program to the tracepoints
|
||||
bitcoind_with_usdts.enable_probe(
|
||||
@ -176,8 +177,8 @@ def main(bitcoind_path):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("USAGE:", sys.argv[0], "path/to/bitcoind")
|
||||
if len(sys.argv) != 2:
|
||||
print("USAGE:", sys.argv[0], "<pid of bitcoind>")
|
||||
exit()
|
||||
path = sys.argv[1]
|
||||
main(path)
|
||||
pid = sys.argv[1]
|
||||
main(pid)
|
||||
|
Reference in New Issue
Block a user