summaryrefslogtreecommitdiffstats
path: root/src/zabbix_agent/cpustat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/zabbix_agent/cpustat.c')
-rw-r--r--src/zabbix_agent/cpustat.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/zabbix_agent/cpustat.c b/src/zabbix_agent/cpustat.c
index 2f0d1519..c16895f3 100644
--- a/src/zabbix_agent/cpustat.c
+++ b/src/zabbix_agent/cpustat.c
@@ -283,8 +283,7 @@ static int get_cpustat(
zbx_uint64_t *cpu_iowait,
zbx_uint64_t *cpu_irq,
zbx_uint64_t *cpu_softirq,
- zbx_uint64_t *cpu_steal,
- zbx_uint64_t *cpu_guest
+ zbx_uint64_t *cpu_steal
)
{
@@ -320,7 +319,7 @@ static int get_cpustat(
return 1;
}
- *cpu_user = *cpu_nice = *cpu_system = *cpu_idle = *cpu_iowait = *cpu_irq = *cpu_softirq = *cpu_steal = *cpu_guest = -1;
+ *cpu_user = *cpu_nice = *cpu_system = *cpu_idle = *cpu_iowait = *cpu_irq = *cpu_softirq = *cpu_steal = -1;
zbx_snprintf(cpu_name, sizeof(cpu_name), "cpu%c ", cpuid > 0 ? '0' + (cpuid - 1) : ' ');
@@ -329,7 +328,7 @@ static int get_cpustat(
if(strstr(line, cpu_name) == NULL) continue;
sscanf(line, "%*s " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64 " " ZBX_FS_UI64,
- cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal, cpu_guest);
+ cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal);
break;
}
zbx_fclose(file);
@@ -394,8 +393,7 @@ static void apply_cpustat(
zbx_uint64_t cpu_iowait,
zbx_uint64_t cpu_irq,
zbx_uint64_t cpu_softirq,
- zbx_uint64_t cpu_steal,
- zbx_uint64_t cpu_guest
+ zbx_uint64_t cpu_steal
)
{
register int i = 0;
@@ -438,10 +436,6 @@ static void apply_cpustat(
steal1 = 0,
steal5 = 0,
steal15 = 0,
- guest = 0,
- guest1 = 0,
- guest5 = 0,
- guest15 = 0,
all = 0,
all1 = 0,
all5 = 0,
@@ -464,9 +458,8 @@ static void apply_cpustat(
irq = curr_cpu->h_irq[i] = cpu_irq;
softirq = curr_cpu->h_softirq[i]= cpu_softirq;
steal = curr_cpu->h_steal[i] = cpu_steal;
- guest = curr_cpu->h_guest[i] = cpu_guest;
- all = cpu_user + cpu_nice + cpu_system + cpu_idle + cpu_iowait + cpu_irq + cpu_softirq + cpu_steal + cpu_guest;
+ all = cpu_user + cpu_nice + cpu_system + cpu_idle + cpu_iowait + cpu_irq + cpu_softirq + cpu_steal;
break;
}
}
@@ -488,9 +481,8 @@ static void apply_cpustat(
irq = curr_cpu->h_irq[i];
softirq = curr_cpu->h_softirq[i];
steal = curr_cpu->h_steal[i];
- guest = curr_cpu->h_guest[i];
- all = user + system + nice + idle + iowait + irq + softirq + steal + guest;
+ all = user + system + nice + idle + iowait + irq + softirq + steal;
}
#define SAVE_CPU_CLOCK_FOR(t) \
@@ -505,8 +497,7 @@ static void apply_cpustat(
irq ## t = curr_cpu->h_irq[i]; \
softirq ## t = curr_cpu->h_softirq[i]; \
steal ## t = curr_cpu->h_steal[i]; \
- guest ## t = curr_cpu->h_guest[i]; \
- all ## t = user ## t + nice ## t + system ## t + idle ## t + iowait ## t + irq ## t + softirq ## t + steal ##t + guest ##t; \
+ all ## t = user ## t + nice ## t + system ## t + idle ## t + iowait ## t + irq ## t + softirq ## t + steal ##t; \
}
SAVE_CPU_CLOCK_FOR(1);
@@ -556,10 +547,6 @@ static void apply_cpustat(
CALC_CPU_LOAD(steal, 1);
CALC_CPU_LOAD(steal, 5);
CALC_CPU_LOAD(steal, 15);
-
- CALC_CPU_LOAD(guest, 1);
- CALC_CPU_LOAD(guest, 5);
- CALC_CPU_LOAD(guest, 15);
}
#endif /* not _WINDOWS */
@@ -679,14 +666,14 @@ void collect_cpustat(ZBX_CPUS_STAT_DATA *pcpus)
register int i = 0;
int now = 0;
- zbx_uint64_t cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal, cpu_guest;
+ zbx_uint64_t cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal;
for ( i = 0; i <= pcpus->count; i++ )
{
- if(0 != get_cpustat(i, &now, &cpu_user, &cpu_nice, &cpu_system, &cpu_idle, &cpu_iowait, &cpu_irq, &cpu_softirq, &cpu_steal, &cpu_guest))
+ if(0 != get_cpustat(i, &now, &cpu_user, &cpu_nice, &cpu_system, &cpu_idle, &cpu_iowait, &cpu_irq, &cpu_softirq, &cpu_steal))
continue;
- apply_cpustat(pcpus, i, now, cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal, cpu_guest);
+ apply_cpustat(pcpus, i, now, cpu_user, cpu_nice, cpu_system, cpu_idle, cpu_iowait, cpu_irq, cpu_softirq, cpu_steal);
}
#endif /* _WINDOWS */