From 98b5535d54e82d4f131fd6940c82b22018b26c6d Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Wed, 20 Aug 2008 15:07:35 -0500 Subject: remove support for guest cpu time --- src/libs/zbxsysinfo/linux/cpu.c | 8 -------- src/zabbix_agent/cpustat.c | 33 ++++++++++----------------------- src/zabbix_agent/cpustat.h | 4 ---- 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/src/libs/zbxsysinfo/linux/cpu.c b/src/libs/zbxsysinfo/linux/cpu.c index 8aa21ee3..443eac94 100644 --- a/src/libs/zbxsysinfo/linux/cpu.c +++ b/src/libs/zbxsysinfo/linux/cpu.c @@ -123,7 +123,6 @@ int SYSTEM_CPU_UTIL(const char *cmd, const char *param, unsigned flags, AGENT_RE return SYSINFO_RET_FAIL; } - if( 0 == strcmp(type,"user")) { if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].user1) @@ -183,13 +182,6 @@ int SYSTEM_CPU_UTIL(const char *cmd, const char *param, unsigned flags, AGENT_RE else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].steal15) else return SYSINFO_RET_FAIL; } - else if( 0 == strcmp(type,"guest")) - { - if( 0 == strcmp(mode,"avg1")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].guest1) - else if( 0 == strcmp(mode,"avg5")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].guest5) - else if( 0 == strcmp(mode,"avg15")) SET_DBL_RESULT(result, collector->cpus.cpu[cpu_num].guest15) - else return SYSINFO_RET_FAIL; - } else { return SYSINFO_RET_FAIL; 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 */ diff --git a/src/zabbix_agent/cpustat.h b/src/zabbix_agent/cpustat.h index 010260d8..c85ca703 100644 --- a/src/zabbix_agent/cpustat.h +++ b/src/zabbix_agent/cpustat.h @@ -74,7 +74,6 @@ zbx_uint64_t h_irq[MAX_CPU_HISTORY]; zbx_uint64_t h_softirq[MAX_CPU_HISTORY]; zbx_uint64_t h_steal[MAX_CPU_HISTORY]; - zbx_uint64_t h_guest[MAX_CPU_HISTORY]; /* public */ double user1; @@ -101,9 +100,6 @@ double steal1; double steal5; double steal15; - double guest1; - double guest5; - double guest15; } ZBX_SINGLE_CPU_STAT_DATA; -- cgit