mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Merge bitcoin/bitcoin#23907: tracing: utxocache tracepoints follow up for #22902
799968e8b3tracing: misc follow-ups to 22902 (0xb10c)36a6584703tracing: correctly scope utxocache:flush tracepoint (Arnab Sen) Pull request description: This PR is a follow-up to the [#22902](https://github.com/bitcoin/bitcoin/pull/22902). Previously, the tracepoint `utxocache:flush` was called, even when it was not flushing. So, the tracepoint is now scoped to write only when coins cache to disk. ACKs for top commit: 0xB10C: ACK799968e8b3Tree-SHA512: ebb096cbf991c551c81e4339821f10d9768c14cf3d8cb14d0ad851acff5980962228a1c746914c6aba3bdb27e8be53b33349c41efe8bab5542f639916e437b5f
This commit is contained in:
@@ -16,14 +16,14 @@ from bcc import BPF, USDT
|
||||
# a sandboxed Linux kernel VM.
|
||||
program = """
|
||||
# include <uapi/linux/ptrace.h>
|
||||
|
||||
struct data_t
|
||||
{
|
||||
u64 duration;
|
||||
u32 mode;
|
||||
u64 coins_count;
|
||||
u64 coins_mem_usage;
|
||||
bool is_flush_prune;
|
||||
bool is_full_flush;
|
||||
bool is_flush_for_prune;
|
||||
};
|
||||
|
||||
// BPF perf buffer to push the data to user space.
|
||||
@@ -35,8 +35,7 @@ int trace_flush(struct pt_regs *ctx) {
|
||||
bpf_usdt_readarg(2, ctx, &data.mode);
|
||||
bpf_usdt_readarg(3, ctx, &data.coins_count);
|
||||
bpf_usdt_readarg(4, ctx, &data.coins_mem_usage);
|
||||
bpf_usdt_readarg(5, ctx, &data.is_flush_prune);
|
||||
bpf_usdt_readarg(5, ctx, &data.is_full_flush);
|
||||
bpf_usdt_readarg(5, ctx, &data.is_flush_for_prune);
|
||||
flush.perf_submit(ctx, &data, sizeof(data));
|
||||
return 0;
|
||||
}
|
||||
@@ -57,19 +56,17 @@ class Data(ctypes.Structure):
|
||||
("mode", ctypes.c_uint32),
|
||||
("coins_count", ctypes.c_uint64),
|
||||
("coins_mem_usage", ctypes.c_uint64),
|
||||
("is_flush_prune", ctypes.c_bool),
|
||||
("is_full_flush", ctypes.c_bool)
|
||||
("is_flush_for_prune", ctypes.c_bool)
|
||||
]
|
||||
|
||||
|
||||
def print_event(event):
|
||||
print("%-15d %-10s %-15d %-15s %-8s %-8s" % (
|
||||
print("%-15d %-10s %-15d %-15s %-8s" % (
|
||||
event.duration,
|
||||
FLUSH_MODES[event.mode],
|
||||
event.coins_count,
|
||||
"%.2f kB" % (event.coins_mem_usage/1000),
|
||||
event.is_flush_prune,
|
||||
event.is_full_flush
|
||||
event.is_flush_for_prune
|
||||
))
|
||||
|
||||
|
||||
@@ -90,9 +87,9 @@ def main(bitcoind_path):
|
||||
|
||||
b["flush"].open_perf_buffer(handle_flush)
|
||||
print("Logging utxocache flushes. Ctrl-C to end...")
|
||||
print("%-15s %-10s %-15s %-15s %-8s %-8s" % ("Duration (µs)", "Mode",
|
||||
"Coins Count", "Memory Usage",
|
||||
"Prune", "Full Flush"))
|
||||
print("%-15s %-10s %-15s %-15s %-8s" % ("Duration (µs)", "Mode",
|
||||
"Coins Count", "Memory Usage",
|
||||
"Flush for Prune"))
|
||||
|
||||
while True:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user