Source
if (ZBX_TIMEKEEPER_FLUSH_DELAY < (double)(ticks - unit->cache.ticks_flush) / (double)timekeeper->ticks_per_sec)
/*
** 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 Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/* unit state cache, updated only by the execution units themselves */
typedef struct
{
/* the current usage statistics */
zbx_uint64_t counter[ZBX_PROCESS_STATE_COUNT];
/* ticks of the last timekeeper update */
clock_t ticks;
/* ticks of the last timekeeper cache flush */
clock_t ticks_flush;
/* the current process state (see ZBX_PROCESS_STATE_* defines) */
unsigned char state;
}
zbx_timekeeper_unit_cache_t;
/* execution unit state statistics */
typedef struct
{
/* historical unit state data */
zbx_uint64_t h_counter[ZBX_PROCESS_STATE_COUNT][MAX_HISTORY];
/* unit state data for the current data gathering cycle */
zbx_uint64_t counter[ZBX_PROCESS_STATE_COUNT];
/* the unit state that was already applied to the historical state data */
zbx_uint64_t counter_used[ZBX_PROCESS_STATE_COUNT];
/* the unit state cache */
zbx_timekeeper_unit_cache_t cache;
}
zbx_timekeeper_unit_t;
typedef enum
{
TIMEKEEPER_SYNC_INTERNAL,
TIMEKEEPER_SYNC_EXTERNAL
}
zbx_timekeeper_sync_source_t;