zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: DCconfig_get_stats                                               *
 *                                                                            *
 * Purpose: get statistics of the database cache                              *
 *                                                                            *
 * Author: Alexander Vladishev, Aleksandrs Saveljevs                          *
 *                                                                            *
 ******************************************************************************/
DCconfig_get_stats

Purpose: get statistics of the database cache

Author: Alexander Vladishev, Aleksandrs Saveljevs
DCconfig_get_stats Purpose : get statistics of the database cache Author : Alexander Vladishev Aleksandrs Saveljevs
void	*DCconfig_get_stats(int request)
{
	static zbx_uint64_t	value_uint;
	static double		value_double;
	switch (request)
	{
		case ZBX_CONFSTATS_BUFFER_TOTAL:
			value_uint = config_mem->orig_size;
			return &value_uint;
		case ZBX_CONFSTATS_BUFFER_USED:
			value_uint = config_mem->orig_size - config_mem->free_size;
			return &value_uint;
		case ZBX_CONFSTATS_BUFFER_FREE:
			value_uint = config_mem->free_size;
			return &value_uint;
		case ZBX_CONFSTATS_BUFFER_PUSED:
			value_double = 100 * (double)(config_mem->orig_size - config_mem->free_size) /
					config_mem->orig_size;
			return &value_double;
		case ZBX_CONFSTATS_BUFFER_PFREE:
			value_double = 100 * (double)config_mem->free_size / config_mem->orig_size;
			return &value_double;
		default:
			return NULL;
	}
}
void * DCconfig_get_stats ( int request ) { static zbx_uint64_t value_uint ; static double value_double ; switch ( request ) { case ZBX_CONFSTATS_BUFFER_TOTAL : value_uint = config_mem -> orig_size ; return & value_uint ; case ZBX_CONFSTATS_BUFFER_USED : value_uint = config_mem -> orig_size - config_mem -> free_size ; return & value_uint ; case ZBX_CONFSTATS_BUFFER_FREE : value_uint = config_mem -> free_size ; return & value_uint ; case ZBX_CONFSTATS_BUFFER_PUSED : value_double = 100 * ( double ) ( config_mem -> orig_size - config_mem -> free_size ) / config_mem -> orig_size ; return & value_double ; case ZBX_CONFSTATS_BUFFER_PFREE : value_double = 100 * ( double ) config_mem -> free_size / config_mem -> orig_size ; return & value_double ; default : return NULL ; } }
Function: DCconfig_get_stats                                               
                                                                            
 Purpose: get statistics of the database cache                              
                                                                            
 Author: Alexander Vladishev, Aleksandrs Saveljevs
Function : DCconfig_get_stats Purpose : get statistics of the database cache Author : Alexander Vladishev Aleksandrs Saveljevs