mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 15:35:50 +00:00
Add database memory usage to 'get_counts' output.
This commit is contained in:
@@ -196,6 +196,10 @@ uint64 SqliteDatabase::getBigInt(int colIndex)
|
||||
return(sqlite3_column_int64(mCurrentStmt, colIndex));
|
||||
}
|
||||
|
||||
int SqliteDatabase::getKBUsed()
|
||||
{
|
||||
return static_cast<int>(sqlite3_memory_used() / 1024);
|
||||
}
|
||||
|
||||
static int SqliteWALHook(void *s, sqlite3* dbCon, const char *dbName, int walSize)
|
||||
{
|
||||
|
||||
@@ -57,6 +57,8 @@ public:
|
||||
|
||||
void runWal();
|
||||
void doHook(const char *db, int walSize);
|
||||
|
||||
int getKBUsed();
|
||||
};
|
||||
|
||||
class SqliteStatement
|
||||
|
||||
@@ -89,6 +89,7 @@ public:
|
||||
|
||||
virtual bool setupCheckpointing(JobQueue*) { return false; }
|
||||
virtual SqliteDatabase* getSqliteDB() { return NULL; }
|
||||
virtual int getKBUsed() { return -1; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1803,6 +1803,10 @@ Json::Value RPCHandler::doGetCounts(Json::Value jvRequest)
|
||||
BOOST_FOREACH(InstanceType::InstanceCount& it, count)
|
||||
ret[it.first] = it.second;
|
||||
|
||||
int dbKB = theApp->getLedgerDB()->getDB()->getKBUsed();
|
||||
if (dbKB > 0)
|
||||
ret["dbKB"] = dbKB;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user