summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6b95249)
raw | patch | inline | side by side (parent: 6b95249)
author | Xavier G <xavier@kindwolf.org> | |
Sat, 23 Sep 2017 19:27:20 +0000 (21:27 +0200) | ||
committer | Xavier G <xavier@kindwolf.org> | |
Sat, 23 Sep 2017 19:27:20 +0000 (21:27 +0200) |
src/cpu.c | patch | blob | history |
diff --git a/src/cpu.c b/src/cpu.c
index b62679bcb69f8d50575b48ed39986bfe6ce8625b..d48ab886332912a1c09e62c477d0048209dc9ab6 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
now);
cpu_stage(cpu, COLLECTD_CPU_STATE_SOFTIRQ, (derive_t)atoll(fields[7]),
now);
+ }
- if (numfields >= 9) {
- cpu_stage(cpu, COLLECTD_CPU_STATE_STEAL, (derive_t)atoll(fields[8]),
- now);
-
- if (numfields >= 10) { /* Guest (since Linux 2.6.24) */
- if (report_guest) {
- long long value = atoll(fields[9]);
- cpu_stage(cpu, COLLECTD_CPU_STATE_GUEST,
- (derive_t)value, now);
- /* Guest is included in User; optionally subtract Guest from
- User: */
- if (subtract_guest) {
- user_value -= value;
- if (user_value < 0) user_value = 0;
- }
- }
-
- if (numfields >= 11) { /* Guest_nice (since Linux 2.6.33) */
- if (report_guest) {
- long long value = atoll(fields[10]);
- cpu_stage(cpu, COLLECTD_CPU_STATE_GUEST_NICE,
- (derive_t)value, now);
- /* Guest_nice is included in Nice; optionally subtract
- Guest_nice from Nice: */
- if (subtract_guest) {
- nice_value -= value;
- if (nice_value < 0) nice_value = 0;
- }
- }
- }
+ if (numfields >= 9) { /* Steal (since Linux 2.6.11) */
+ cpu_stage(cpu, COLLECTD_CPU_STATE_STEAL, (derive_t)atoll(fields[8]), now);
+ }
+
+ if (numfields >= 10) { /* Guest (since Linux 2.6.24) */
+ if (report_guest) {
+ long long value = atoll(fields[9]);
+ cpu_stage(cpu, COLLECTD_CPU_STATE_GUEST, (derive_t)value, now);
+ /* Guest is included in User; optionally subtract Guest from User: */
+ if (subtract_guest) {
+ user_value -= value;
+ if (user_value < 0) user_value = 0;
}
}
}
+
+ if (numfields >= 11) { /* Guest_nice (since Linux 2.6.33) */
+ if (report_guest) {
+ long long value = atoll(fields[10]);
+ cpu_stage(cpu, COLLECTD_CPU_STATE_GUEST_NICE, (derive_t)value, now);
+ /* Guest_nice is included in Nice; optionally subtract Guest_nice from
+ Nice: */
+ if (subtract_guest) {
+ nice_value -= value;
+ if (nice_value < 0) nice_value = 0;
+ }
+ }
+ }
+
/* Eventually stage User and Nice: */
cpu_stage(cpu, COLLECTD_CPU_STATE_USER, (derive_t)user_value, now);
cpu_stage(cpu, COLLECTD_CPU_STATE_NICE, (derive_t)nice_value, now);