mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
tracing: correctly scope utxocache:flush tracepoint
Previously, the `utxocache:flush` tracepoint was in the wrong scope and reached every time `CChainState::FlushStateToDisk` was called, even when there was no flushing of the cache. The tracepoint is now properly scoped and will be reached during a full flush. Inside the scope, the `fDoFullFlush` value will always be `true`, so it doesn't need to be logged separately. Hence, it's dropped from the tracepoint arguments.
This commit is contained in:
@@ -20,7 +20,6 @@ struct data_t
|
||||
u64 coins_count;
|
||||
u64 coins_mem_usage;
|
||||
bool is_flush_prune;
|
||||
bool is_full_flush;
|
||||
};
|
||||
|
||||
// BPF perf buffer to push the data to user space.
|
||||
@@ -33,7 +32,6 @@ int trace_flush(struct pt_regs *ctx) {
|
||||
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);
|
||||
flush.perf_submit(ctx, &data, sizeof(data));
|
||||
return 0;
|
||||
}
|
||||
@@ -55,18 +53,16 @@ class Data(ctypes.Structure):
|
||||
("coins_count", ctypes.c_uint64),
|
||||
("coins_mem_usage", ctypes.c_uint64),
|
||||
("is_flush_prune", ctypes.c_bool),
|
||||
("is_full_flush", 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
|
||||
))
|
||||
|
||||
|
||||
@@ -87,9 +83,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",
|
||||
"Prune"))
|
||||
|
||||
while True:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user