mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
Use steady clock in FlushStateToDisk
This commit is contained in:
parent
1111e2f8b4
commit
fa1b4e5c32
2 changed files with 6 additions and 6 deletions
|
@ -2478,12 +2478,12 @@ bool Chainstate::FlushStateToDisk(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const auto nNow = GetTime<std::chrono::microseconds>();
|
const auto nNow{SteadyClock::now()};
|
||||||
// Avoid writing/flushing immediately after startup.
|
// Avoid writing/flushing immediately after startup.
|
||||||
if (m_last_write.count() == 0) {
|
if (m_last_write == decltype(m_last_write){}) {
|
||||||
m_last_write = nNow;
|
m_last_write = nNow;
|
||||||
}
|
}
|
||||||
if (m_last_flush.count() == 0) {
|
if (m_last_flush == decltype(m_last_flush){}) {
|
||||||
m_last_flush = nNow;
|
m_last_flush = nNow;
|
||||||
}
|
}
|
||||||
// The cache is large and we're within 10% and 10 MiB of the limit, but we have time now (not in the middle of a block processing).
|
// The cache is large and we're within 10% and 10 MiB of the limit, but we have time now (not in the middle of a block processing).
|
||||||
|
@ -2544,7 +2544,7 @@ bool Chainstate::FlushStateToDisk(
|
||||||
m_last_flush = nNow;
|
m_last_flush = nNow;
|
||||||
full_flush_completed = true;
|
full_flush_completed = true;
|
||||||
TRACE5(utxocache, flush,
|
TRACE5(utxocache, flush,
|
||||||
(int64_t)(GetTimeMicros() - nNow.count()), // in microseconds (µs)
|
int64_t{Ticks<std::chrono::microseconds>(SteadyClock::now() - nNow)},
|
||||||
(uint32_t)mode,
|
(uint32_t)mode,
|
||||||
(uint64_t)coins_count,
|
(uint64_t)coins_count,
|
||||||
(uint64_t)coins_mem_usage,
|
(uint64_t)coins_mem_usage,
|
||||||
|
|
|
@ -785,8 +785,8 @@ private:
|
||||||
void UpdateTip(const CBlockIndex* pindexNew)
|
void UpdateTip(const CBlockIndex* pindexNew)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||||
|
|
||||||
std::chrono::microseconds m_last_write{0};
|
SteadyClock::time_point m_last_write{};
|
||||||
std::chrono::microseconds m_last_flush{0};
|
SteadyClock::time_point m_last_flush{};
|
||||||
|
|
||||||
friend ChainstateManager;
|
friend ChainstateManager;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue