Measure CPU utilization in ServiceQueue

This commit is contained in:
Vinnie Falco
2013-10-04 11:46:10 -07:00
parent 70f6c41ff7
commit 90282707ab
8 changed files with 50 additions and 38 deletions

View File

@@ -412,12 +412,13 @@ public:
//
// Return the current ChosenList as JSON
Json::Value rpcPrint (Json::Value const& args)
Json::Value rpcPrint (Json::Value const& args, int cpuPercent)
{
Json::Value results (Json::objectValue);
Json::Value entries (Json::arrayValue);
{
results ["cpu"] = cpuPercent;
results ["count"] = int(m_validators.size());
for (ValidatorTable::const_iterator iter (m_validators.begin());
iter != m_validators.end(); ++iter)

View File

@@ -147,7 +147,8 @@ public:
Json::Value rpcPrint (Json::Value const& args)
{
return m_logic.rpcPrint (args);
int const cpuPercent (std::ceil (m_queue.getUtilizaton() * 100));
return m_logic.rpcPrint (args, cpuPercent);
}
Json::Value rpcRebuild (Json::Value const& args)