mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-05 03:35:51 +00:00
Compare commits
4 Commits
Bronek/add
...
vlntb/tagg
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a24caba617 | ||
|
|
cf415e2a8a | ||
|
|
1226c92aa6 | ||
|
|
2107b09445 |
@@ -23,6 +23,8 @@
|
||||
#include <xrpl/basics/IntrusivePointer.ipp>
|
||||
#include <xrpl/basics/TaggedCache.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
template <
|
||||
@@ -106,6 +108,9 @@ TaggedCache<
|
||||
Mutex>::size() const
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats,"
|
||||
<< ", size, call_count = " << ++call_count << std::endl;
|
||||
return m_cache.size();
|
||||
}
|
||||
|
||||
@@ -256,6 +261,11 @@ TaggedCache<
|
||||
Mutex>::touch_if_exists(KeyComparable const& key)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats,"
|
||||
<< "touch_if_exists, call_count = " << ++call_count << std::endl;
|
||||
|
||||
auto const iter(m_cache.find(key));
|
||||
if (iter == m_cache.end())
|
||||
{
|
||||
@@ -369,8 +379,13 @@ TaggedCache<
|
||||
{
|
||||
// Remove from cache, if !valid, remove from map too. Returns true if
|
||||
// removed from cache
|
||||
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats, "
|
||||
<< "del, call_count = " << ++call_count << std::endl;
|
||||
|
||||
auto cit = m_cache.find(key);
|
||||
|
||||
if (cit == m_cache.end())
|
||||
@@ -422,6 +437,9 @@ TaggedCache<
|
||||
// Return values: true=we had the data already
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats, "
|
||||
<< "canonicalize, call_count = " << ++call_count << std::endl;
|
||||
auto cit = m_cache.find(key);
|
||||
|
||||
if (cit == m_cache.end())
|
||||
@@ -561,6 +579,11 @@ TaggedCache<
|
||||
Mutex>::fetch(key_type const& key)
|
||||
{
|
||||
std::lock_guard<mutex_type> l(m_mutex);
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats, "
|
||||
<< "fetch, call_count = " << ++call_count << std::endl;
|
||||
|
||||
auto ret = initialFetch(key, l);
|
||||
if (!ret)
|
||||
++m_misses;
|
||||
@@ -628,6 +651,11 @@ TaggedCache<
|
||||
-> std::enable_if_t<IsKeyCache, ReturnType>
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats, "
|
||||
<< "insert, call_count = " << ++call_count << std::endl;
|
||||
|
||||
clock_type::time_point const now(m_clock.now());
|
||||
auto [it, inserted] = m_cache.emplace(
|
||||
std::piecewise_construct,
|
||||
@@ -715,6 +743,11 @@ TaggedCache<
|
||||
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats, "
|
||||
<< "getKeys, call_count = " << ++call_count << std::endl;
|
||||
|
||||
v.reserve(m_cache.size());
|
||||
for (auto const& _ : m_cache)
|
||||
v.push_back(_.first);
|
||||
@@ -773,6 +806,11 @@ TaggedCache<
|
||||
{
|
||||
{
|
||||
std::lock_guard l(m_mutex);
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats, "
|
||||
<< "fetch, call_count = " << ++call_count << std::endl;
|
||||
|
||||
if (auto ret = initialFetch(digest, l))
|
||||
return ret;
|
||||
}
|
||||
@@ -901,6 +939,11 @@ TaggedCache<
|
||||
int cacheRemovals = 0;
|
||||
int mapRemovals = 0;
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats, "
|
||||
<< "sweep-KVCache, call_count = " << ++call_count
|
||||
<< std::endl;
|
||||
|
||||
// Keep references to all the stuff we sweep
|
||||
// so that we can destroy them outside the lock.
|
||||
stuffToSweep.reserve(partition.size());
|
||||
@@ -990,6 +1033,10 @@ TaggedCache<
|
||||
int cacheRemovals = 0;
|
||||
int mapRemovals = 0;
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "TaggedCache (" << m_name << ") lock stats, "
|
||||
<< "sweep-KCache, call_count = " << ++call_count << std::endl;
|
||||
|
||||
// Keep references to all the stuff we sweep
|
||||
// so that we can destroy them outside the lock.
|
||||
{
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <xrpl/basics/contract.h>
|
||||
#include <xrpl/json/to_string.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// FIXME: Need to clean up ledgers by index at some point
|
||||
@@ -65,6 +67,10 @@ LedgerHistory::insert(
|
||||
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "LedgerHistory lock stats, "
|
||||
<< "insert, call_count = " << ++call_count << std::endl;
|
||||
|
||||
bool const alreadyHad = m_ledgers_by_hash.canonicalize_replace_cache(
|
||||
ledger->info().hash, ledger);
|
||||
if (validated)
|
||||
@@ -77,6 +83,11 @@ LedgerHash
|
||||
LedgerHistory::getLedgerHash(LedgerIndex index)
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "LedgerHistory lock stats, "
|
||||
<< "getLedgerHash, call_count = " << ++call_count << std::endl;
|
||||
|
||||
if (auto it = mLedgersByIndex.find(index); it != mLedgersByIndex.end())
|
||||
return it->second;
|
||||
return {};
|
||||
@@ -87,6 +98,12 @@ LedgerHistory::getLedgerBySeq(LedgerIndex index)
|
||||
{
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "LedgerHistory lock stats, "
|
||||
<< "getLedgerBySeq, call_count = " << ++call_count
|
||||
<< std::endl;
|
||||
|
||||
auto it = mLedgersByIndex.find(index);
|
||||
|
||||
if (it != mLedgersByIndex.end())
|
||||
@@ -536,6 +553,11 @@ bool
|
||||
LedgerHistory::fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash)
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
|
||||
static unsigned long call_count{0};
|
||||
std::cout << "LedgerHistory lock stats, "
|
||||
<< "fixIndex, call_count = " << ++call_count << std::endl;
|
||||
|
||||
auto it = mLedgersByIndex.find(ledgerIndex);
|
||||
|
||||
if ((it != mLedgersByIndex.end()) && (it->second != ledgerHash))
|
||||
|
||||
Reference in New Issue
Block a user