summaryrefslogtreecommitdiffstats
path: root/src/zabbix_agent/perfstat.h
blob: ab0f20983fc44479905b35589b3c93b188241850 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* 
** ZABBIX
** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/

#ifndef ZABBIX_PERFSTAT_H
#define ZABBIX_PERFSTAT_H

#ifdef _WINDOWS

#	include "perfmon.h"

#	define PERF_COLLECTOR_STARTED(collector)	((collector) && (collector)->perfs.pdh_query)

struct zbx_perfs
{
   struct zbx_perfs	*next;
   char			*name;
   char			*counterPath;
   int			interval;
   PDH_RAW_COUNTER	*rawValueArray;
   HCOUNTER		handle;
   double		lastValue;
   int			CurrentCounter;
   int			CurrentNum;
};

typedef struct zbx_perfs PERF_COUNTERS;

typedef struct s_perfs_stat_data
{
	PERF_COUNTERS	*pPerfCounterList;
	HQUERY		pdh_query;
} ZBX_PERF_STAT_DATA;

int	add_perf_counter(const char *name, const char *counterPath, int interval);
int	add_perfs_from_config(const char *line);
void	perfs_list_free(void);

int	init_perf_collector(ZBX_PERF_STAT_DATA *pperf);
void	collect_perfstat();
void	close_perf_collector();
#endif /* _WINDOWS */

#endif /* ZABBIX_PERFSTAT_H */