cpu: Consider steal time for load calculation (#1955)
* Add steal time to cpu_time struct * Consider steal time as part of load calculations * Typo fix
This commit is contained in:
parent
ad3960e050
commit
bc560952e0
2 changed files with 4 additions and 2 deletions
|
@ -11,6 +11,7 @@ namespace modules {
|
||||||
unsigned long long nice;
|
unsigned long long nice;
|
||||||
unsigned long long system;
|
unsigned long long system;
|
||||||
unsigned long long idle;
|
unsigned long long idle;
|
||||||
|
unsigned long long steal;
|
||||||
unsigned long long total;
|
unsigned long long total;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,9 @@ namespace modules {
|
||||||
m_cputimes.back()->nice = std::stoull(values[2], nullptr, 10);
|
m_cputimes.back()->nice = std::stoull(values[2], nullptr, 10);
|
||||||
m_cputimes.back()->system = std::stoull(values[3], nullptr, 10);
|
m_cputimes.back()->system = std::stoull(values[3], nullptr, 10);
|
||||||
m_cputimes.back()->idle = std::stoull(values[4], nullptr, 10);
|
m_cputimes.back()->idle = std::stoull(values[4], nullptr, 10);
|
||||||
m_cputimes.back()->total =
|
m_cputimes.back()->steal = std::stoull(values[8], nullptr, 10);
|
||||||
m_cputimes.back()->user + m_cputimes.back()->nice + m_cputimes.back()->system + m_cputimes.back()->idle;
|
m_cputimes.back()->total = m_cputimes.back()->user + m_cputimes.back()->nice + m_cputimes.back()->system +
|
||||||
|
m_cputimes.back()->idle + m_cputimes.back()->steal;
|
||||||
}
|
}
|
||||||
} catch (const std::ios_base::failure& e) {
|
} catch (const std::ios_base::failure& e) {
|
||||||
m_log.err("Failed to read CPU values (what: %s)", e.what());
|
m_log.err("Failed to read CPU values (what: %s)", e.what());
|
||||||
|
|
Loading…
Reference in a new issue