Use the LOG_TIME_MILLIS_WITH_CATEGORY_MSG_ONCE
macro to improve the logging of ChainstateManager snapshot persistance, log task start and completion separately and no longer manually track the duration, as suggested by Marco Falke in #22872 (review).
Extract the flushing into one function, which clarifies the logic, extends the improved logging to both flushing call sites, and allows logging the prefix FlushSnapshotToDisk
, which is similar to FlushStateToDisk
.
before
0[snapshot] flushing coins cache (0 MB)... done (0.00ms)
1
2[snapshot] flushing snapshot chainstate to disk
after
0FlushSnapshotToDisk: flushing coins cache (0 MB) started
1...
2FlushSnapshotToDisk: completed (0.00ms)
3
4FlushSnapshotToDisk: saving snapshot chainstate (0 MB) started
5...
6FlushSnapshotToDisk: completed (0.00ms)
The logging can be observed in the output of
0./src/test/test_bitcoin -t validation_chainstate_tests -- DEBUG_LOG_OUT