Source
void get_selfmon_stats(unsigned char proc_type, unsigned char aggr_func, int proc_num, unsigned char state,
/*
** Zabbix
** Copyright (C) 2001-2025 Zabbix SIA
**
** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/* process state cache, updated only by the processes themselves */
typedef struct
{
/* the current usage statistics */
zbx_uint64_t counter[ZBX_PROCESS_STATE_COUNT];
/* ticks of the last self monitoring update */
clock_t ticks;
/* ticks of the last self monitoring cache flush */
clock_t ticks_flush;
/* the current process state (see ZBX_PROCESS_STATE_* defines) */
unsigned char state;
}
zbx_stat_process_cache_t;
/* process state statistics */
typedef struct
{
/* historical process state data */
unsigned short h_counter[ZBX_PROCESS_STATE_COUNT][MAX_HISTORY];
/* process state data for the current data gathering cycle */
unsigned short counter[ZBX_PROCESS_STATE_COUNT];
/* the process state that was already applied to the historical state data */
zbx_uint64_t counter_used[ZBX_PROCESS_STATE_COUNT];
/* the process state cache */