Report cache hit rates.

This commit is contained in:
JoelKatz
2013-05-21 16:10:51 -07:00
parent 51ec5787d5
commit 6b2a6ea03e
5 changed files with 14 additions and 3 deletions

View File

@@ -70,6 +70,8 @@ public:
int getLedgerSeq() const { return mLedger->getLedgerSeq(); }
int getTxnCount() const { return mMap.size(); }
static float getCacheHitRate() { return ALCache.getHitRate(); }
ALTransaction::pointer getTxn(int) const;
};

View File

@@ -67,6 +67,8 @@ public:
bool isLevelDB() { return mLevelDB; }
float getCacheHitRate() { return mCache.getHitRate(); }
bool store(HashedObjectType type, uint32 index, const std::vector<unsigned char>& data,
const uint256& hash)
{

View File

@@ -15,6 +15,7 @@ public:
void addLedger(Ledger::pointer ledger);
void addAcceptedLedger(Ledger::pointer ledger, bool fromConsensus);
float getCacheHitRate() { return mLedgersByHash.getHitRate(); }
uint256 getLedgerHash(uint32 index);
Ledger::pointer getLedgerBySeq(uint32 index);
Ledger::pointer getLedgerByHash(const uint256& hash);

View File

@@ -158,7 +158,8 @@ public:
void resumeAcquiring();
void tune(int size, int age) { mLedgerHistory.tune(size, age); }
void sweep(void) { mLedgerHistory.sweep(); }
void sweep() { mLedgerHistory.sweep(); }
float getCacheHitRate() { return mLedgerHistory.getCacheHitRate(); }
void addValidateCallback(callback& c) { mOnValidate.push_back(c); }

View File

@@ -2304,6 +2304,11 @@ Json::Value RPCHandler::doGetCounts(Json::Value jvRequest, int& cost, ScopedLock
ret["write_load"] = theApp->getHashedObjectStore().getWriteLoad();
ret["SLE_hit_rate"] = theApp->getSLECache().getHitRate();
ret["node_hit_rate"] = theApp->getHashedObjectStore().getCacheHitRate();
ret["ledger_hit_rate"] = theApp->getLedgerMaster().getCacheHitRate();
ret["AL_hit_rate"] = AcceptedLedger::getCacheHitRate();
std::string uptime;
int s = upTime();
textTime(uptime, s, "year", 365*24*60*60);