You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-10-25 21:17:42 +03:00
MCOL-1875 - fixed issue with calulating module cpu usage
This commit is contained in:
@@ -556,7 +556,7 @@ void ServerMonitor::getCPUdata()
|
|||||||
|
|
||||||
string tmpsystemCpu = tmpDir + "/processCpu";
|
string tmpsystemCpu = tmpDir + "/processCpu";
|
||||||
|
|
||||||
cmd = "top -b -n 6 -d 1 | awk '{print $5}' | grep %id > " + tmpsystemCpu;
|
cmd = "top -b -n 6 -d 1 | grep '%Cpu' | awk '{print $8}' > " + tmpsystemCpu;
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
|
|
||||||
ifstream oldFile (tmpsystemCpu.c_str());
|
ifstream oldFile (tmpsystemCpu.c_str());
|
||||||
@@ -569,13 +569,17 @@ void ServerMonitor::getCPUdata()
|
|||||||
while (oldFile.getline(line, 400))
|
while (oldFile.getline(line, 400))
|
||||||
{
|
{
|
||||||
string buf = line;
|
string buf = line;
|
||||||
string::size_type pos = buf.find ('%', 0);
|
string::size_type pos = buf.find ('id,', 0);
|
||||||
|
if (pos == string::npos)
|
||||||
if (pos != string::npos)
|
|
||||||
{
|
{
|
||||||
systemIdle = systemIdle + atol(buf.substr(0, pos - 1).c_str());
|
systemIdle = systemIdle + atol(buf.substr(0, pos - 1).c_str());
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
systemIdle = systemIdle + 100;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oldFile.close();
|
oldFile.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user