mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
validation, log: improve logging in FlushSnapshotToDisk()
Use the `LOG_TIME_MILLIS_WITH_CATEGORY_MSG_ONCE` macro to improve the logging of snapshot persistance and no longer manually track the duration. before [snapshot] flushing coins cache (0 MB)... done (0.00ms) [snapshot] flushing snapshot chainstate to disk (0 MB)... done (0.00ms) after FlushSnapshotToDisk: flushing coins cache (0 MB) started FlushSnapshotToDisk: completed (0.00ms) FlushSnapshotToDisk: saving snapshot chainstate (0 MB) started FlushSnapshotToDisk: completed (0.00ms) The logging can be observed in the output of ./src/test/test_bitcoin -t validation_chainstate_tests -- DEBUG_LOG_OUT
This commit is contained in:
parent
271252c0bd
commit
8e37fa8393
1 changed files with 5 additions and 7 deletions
|
@ -4842,16 +4842,14 @@ bool ChainstateManager::ActivateSnapshot(
|
|||
|
||||
static void FlushSnapshotToDisk(CCoinsViewCache& coins_cache, bool snapshot_loaded)
|
||||
{
|
||||
LogPrintf("[snapshot] flushing %s (%.2f MB)... ", /* Continued */
|
||||
snapshot_loaded ? "snapshot chainstate to disk" : "coins cache",
|
||||
coins_cache.DynamicMemoryUsage() / (1000 * 1000));
|
||||
|
||||
const int64_t flush_now{GetTimeMillis()};
|
||||
LOG_TIME_MILLIS_WITH_CATEGORY_MSG_ONCE(
|
||||
strprintf("%s (%.2f MB)",
|
||||
snapshot_loaded ? "saving snapshot chainstate" : "flushing coins cache",
|
||||
coins_cache.DynamicMemoryUsage() / (1000 * 1000)),
|
||||
BCLog::LogFlags::ALL);
|
||||
|
||||
// TODO: if #17487 is merged, add erase=false here if snapshot is loaded, for better performance.
|
||||
coins_cache.Flush();
|
||||
|
||||
LogPrintf("done (%.2fms)\n", GetTimeMillis() - flush_now);
|
||||
}
|
||||
|
||||
bool ChainstateManager::PopulateAndValidateSnapshot(
|
||||
|
|
Loading…
Add table
Reference in a new issue