diff options
author | Arnab Sen <arnabsen1729@gmail.com> | 2021-09-03 22:08:53 +0530 |
---|---|---|
committer | Arnab Sen <arnabsen1729@gmail.com> | 2021-11-28 11:51:21 +0530 |
commit | 2bc51c5c3215398875c04456a3f3df1c07b830b5 (patch) | |
tree | aef191c5127b3a7e4a0d1c791e96b54c9958d082 /src | |
parent | a26e8eef43c5ff0f4a5cd44d1d331a7bd72564a5 (diff) | |
download | bitcoin-2bc51c5c3215398875c04456a3f3df1c07b830b5.tar.xz |
[tracing] tracepoints to utxocache add, spent and uncache
Signed-off-by: Arnab Sen <arnabsen1729@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/coins.cpp | 19 | ||||
-rw-r--r-- | src/validation.cpp | 13 |
2 files changed, 25 insertions, 7 deletions
diff --git a/src/coins.cpp b/src/coins.cpp index ce0b131de6..daead6055e 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -7,6 +7,7 @@ #include <consensus/consensus.h> #include <logging.h> #include <random.h> +#include <util/trace.h> #include <version.h> bool CCoinsView::GetCoin(const COutPoint &outpoint, Coin &coin) const { return false; } @@ -95,6 +96,12 @@ void CCoinsViewCache::AddCoin(const COutPoint &outpoint, Coin&& coin, bool possi it->second.coin = std::move(coin); it->second.flags |= CCoinsCacheEntry::DIRTY | (fresh ? CCoinsCacheEntry::FRESH : 0); cachedCoinsUsage += it->second.coin.DynamicMemoryUsage(); + TRACE5(utxocache, add, + outpoint.hash.data(), + (uint32_t)outpoint.n, + (uint32_t)coin.nHeight, + (int64_t)coin.out.nValue, + (bool)coin.IsCoinBase()); } void CCoinsViewCache::EmplaceCoinInternalDANGER(COutPoint&& outpoint, Coin&& coin) { @@ -120,6 +127,12 @@ bool CCoinsViewCache::SpendCoin(const COutPoint &outpoint, Coin* moveout) { CCoinsMap::iterator it = FetchCoin(outpoint); if (it == cacheCoins.end()) return false; cachedCoinsUsage -= it->second.coin.DynamicMemoryUsage(); + TRACE5(utxocache, spent, + outpoint.hash.data(), + (uint32_t)outpoint.n, + (uint32_t)it->second.coin.nHeight, + (int64_t)it->second.coin.out.nValue, + (bool)it->second.coin.IsCoinBase()); if (moveout) { *moveout = std::move(it->second.coin); } @@ -231,6 +244,12 @@ void CCoinsViewCache::Uncache(const COutPoint& hash) CCoinsMap::iterator it = cacheCoins.find(hash); if (it != cacheCoins.end() && it->second.flags == 0) { cachedCoinsUsage -= it->second.coin.DynamicMemoryUsage(); + TRACE5(utxocache, uncache, + hash.hash.data(), + (uint32_t)hash.n, + (uint32_t)it->second.coin.nHeight, + (int64_t)it->second.coin.out.nValue, + (bool)it->second.coin.IsCoinBase()); cacheCoins.erase(it); } } diff --git a/src/validation.cpp b/src/validation.cpp index 7a14218b5c..86d2ae7577 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2102,13 +2102,12 @@ bool CChainState::FlushStateToDisk( full_flush_completed = true; } TRACE6(utxocache, flush, - (int64_t)(GetTimeMicros() - nNow.count()), // in microseconds (µs) - (u_int32_t)mode, - (u_int64_t)coins_count, - (u_int64_t)coins_mem_usage, - (bool)fFlushForPrune, - (bool)fDoFullFlush - ); + (int64_t)(GetTimeMicros() - nNow.count()), // in microseconds (µs) + (u_int32_t)mode, + (u_int64_t)coins_count, + (u_int64_t)coins_mem_usage, + (bool)fFlushForPrune, + (bool)fDoFullFlush); } if (full_flush_completed) { // Update best block in wallet (so we can detect restored wallets). |