1 /* 2 ** Zabbix 3 ** Copyright (C) 2001-2021 Zabbix SIA 4 ** 5 ** This program is free software; you can redistribute it and/or modify 6 ** it under the terms of the GNU General Public License as published by 7 ** the Free Software Foundation; either version 2 of the License, or 8 ** (at your option) any later version. 9 ** 10 ** This program is distributed in the hope that it will be useful, 11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 ** GNU General Public License for more details. 14 ** 15 ** You should have received a copy of the GNU General Public License 16 ** along with this program; if not, write to the Free Software 17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 **/ 19 20 #ifndef ZABBIX_ZBXSELF_H 21 #define ZABBIX_ZBXSELF_H 22 23 #define ZBX_PROCESS_STATE_IDLE 0 24 #define ZBX_PROCESS_STATE_BUSY 1 25 #define ZBX_PROCESS_STATE_COUNT 2 /* number of process states */ 26 27 #define ZBX_AGGR_FUNC_ONE 0 28 #define ZBX_AGGR_FUNC_AVG 1 29 #define ZBX_AGGR_FUNC_MAX 2 30 #define ZBX_AGGR_FUNC_MIN 3 31 32 #define ZBX_SELFMON_DELAY 1 33 34 /* the process statistics */ 35 typedef struct 36 { 37 double busy_max; 38 double busy_min; 39 double busy_avg; 40 double idle_max; 41 double idle_min; 42 double idle_avg; 43 int count; 44 } 45 zbx_process_info_t; 46 47 int get_process_type_forks(unsigned char proc_type); 48 49 #ifndef _WINDOWS 50 int init_selfmon_collector(char **error); 51 void free_selfmon_collector(void); 52 void update_selfmon_counter(unsigned char state); 53 void collect_selfmon_stats(void); 54 void get_selfmon_stats(unsigned char proc_type, unsigned char aggr_func, int proc_num, unsigned char state, 55 double *value); 56 int zbx_get_all_process_stats(zbx_process_info_t *stats); 57 void zbx_sleep_loop(int sleeptime); 58 void zbx_sleep_forever(void); 59 void zbx_wakeup(void); 60 int zbx_sleep_get_remainder(void); 61 #endif 62 63 #endif /* ZABBIX_ZBXSELF_H */ 64