mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-03 17:35:51 +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));
|
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)
|
static int SqliteWALHook(void *s, sqlite3* dbCon, const char *dbName, int walSize)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public:
|
|||||||
|
|
||||||
void runWal();
|
void runWal();
|
||||||
void doHook(const char *db, int walSize);
|
void doHook(const char *db, int walSize);
|
||||||
|
|
||||||
|
int getKBUsed();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SqliteStatement
|
class SqliteStatement
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public:
|
|||||||
|
|
||||||
virtual bool setupCheckpointing(JobQueue*) { return false; }
|
virtual bool setupCheckpointing(JobQueue*) { return false; }
|
||||||
virtual SqliteDatabase* getSqliteDB() { return NULL; }
|
virtual SqliteDatabase* getSqliteDB() { return NULL; }
|
||||||
|
virtual int getKBUsed() { return -1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1803,6 +1803,10 @@ Json::Value RPCHandler::doGetCounts(Json::Value jvRequest)
|
|||||||
BOOST_FOREACH(InstanceType::InstanceCount& it, count)
|
BOOST_FOREACH(InstanceType::InstanceCount& it, count)
|
||||||
ret[it.first] = it.second;
|
ret[it.first] = it.second;
|
||||||
|
|
||||||
|
int dbKB = theApp->getLedgerDB()->getDB()->getKBUsed();
|
||||||
|
if (dbKB > 0)
|
||||||
|
ret["dbKB"] = dbKB;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user