20
20
#ifndef ZABBIX_CPUSTAT_H
21
21
#define ZABBIX_CPUSTAT_H
23
#define CPUSTAT struct cpustat_type
30
float cpu_user[60*15];
31
float cpu_system[60*15];
32
float cpu_nice[60*15];
33
float cpu_idle[60*15];
36
void collect_stats_cpustat(FILE *outfile);
23
#if defined (_WINDOWS)
26
#define MAX_CPU_HISTORY 900 /* 15 min in seconds */
28
typedef struct s_single_cpu_stat_data
30
PDH_HCOUNTER usage_couter;
31
PDH_RAW_COUNTER usage;
32
PDH_RAW_COUNTER usage_old;
38
LONG h_usage[MAX_CPU_HISTORY]; /* usage history */
40
} ZBX_SINGLE_CPU_STAT_DATA;
42
typedef struct s_cpus_stat_data
44
ZBX_SINGLE_CPU_STAT_DATA cpu[MAX_CPU];
51
LONG h_queue[MAX_CPU_HISTORY]; /* queue history */
55
PDH_RAW_COUNTER queue;
56
PDH_HCOUNTER queue_counter;
60
#else /* not _WINDOWS */
62
#define MAX_CPU_HISTORY 900 /* 15 min in seconds */
64
typedef struct s_cpus_stat_data
67
int clock[MAX_CPU_HISTORY];
68
zbx_uint64_t h_user[MAX_CPU_HISTORY];
69
zbx_uint64_t h_system[MAX_CPU_HISTORY];
70
zbx_uint64_t h_nice[MAX_CPU_HISTORY];
71
zbx_uint64_t h_idle[MAX_CPU_HISTORY];
92
int init_cpu_collector(ZBX_CPUS_STAT_DATA *pcpus);
93
void collect_cpustat(ZBX_CPUS_STAT_DATA *pcpus);
94
void close_cpu_collector(ZBX_CPUS_STAT_DATA *pcpus);