refactor: rename FlushStateMode::ALWAYS to FORCE_FLUSH

This prepares the addition of `FORCE_SYNC`.

`empty_cache` in `FlushStateToDisk` was moved up to be reusable and `FlushStateMode::FORCE_FLUSH` was used as a placeholder before we properly split the two new states.
`log_utxocache_flush.py` was regenerated and the alignment adjusted for the wider `FlushStateMode` values.

Co-authored-by: Pieter Wuille <pieter@wuille.net>
Co-authored-by: optout <13562139+optout21@users.noreply.github.com>
This commit is contained in:
committed 2026-01-03 12:43:57 +01:00
1 parent ab233255d4
commit 7099e93d0a
7 files changed
+22 -22

No files matched your search

+4 -4
View File
@@ -246,10 +246,10 @@ $ python3 contrib/tracing/log_utxocache_flush.py $(pidof bitcoind)
```
Logging utxocache flushes. Ctrl-C to end...
Duration (µs) Mode Coins Count Memory Usage Prune
730451 IF_NEEDED 22990 3323.54 kB True
637657 ALWAYS 122320 17124.80 kB False
81349 ALWAYS 0 1383.49 kB False
Duration (µs) Mode Coins Count Memory Usage Flush for Prune
2556340 IF_NEEDED 2899141 394844.34 kB False
2005788 FORCE_FLUSH 2238117 310189.68 kB False
2685 FORCE_FLUSH 0 262.24 kB False
```
### log_utxos.bt
+4 -4
View File
@@ -10,7 +10,7 @@ from bcc import BPF, USDT
"""Example logging Bitcoin Core utxo set cache flushes utilizing
the utxocache:flush tracepoint."""
# USAGE: ./contrib/tracing/log_utxocache_flush.py path/to/bitcoind
# USAGE: ./contrib/tracing/log_utxocache_flush.py <pid of bitcoind>
# BCC: The C program to be compiled to an eBPF program (by BCC) and loaded into
# a sandboxed Linux kernel VM.
@@ -45,7 +45,7 @@ FLUSH_MODES = [
'NONE',
'IF_NEEDED',
'PERIODIC',
'ALWAYS'
'FORCE_FLUSH',
]
@@ -61,7 +61,7 @@ class Data(ctypes.Structure):
def print_event(event):
print("%-15d %-10s %-15d %-15s %-8s" % (
print("%-15d %-12s %-15d %-15s %-8s" % (
event.duration,
FLUSH_MODES[event.mode],
event.coins_count,
@@ -88,7 +88,7 @@ def main(pid):
b["flush"].open_perf_buffer(handle_flush)
print("Logging utxocache flushes. Ctrl-C to end...")
print("%-15s %-10s %-15s %-15s %-8s" % ("Duration (µs)", "Mode",
print("%-15s %-12s %-15s %-15s %-8s" % ("Duration (µs)", "Mode",
"Coins Count", "Memory Usage",
"Flush for Prune"))